Skip to content

Commit

Permalink
fix(core): npm run generate language is not properly created. (react-…
Browse files Browse the repository at this point in the history
…boilerplate#1199)

* rerun extract-intl

* add default language to language provider
  • Loading branch information
chaintng authored and mxstbr committed Nov 7, 2016
1 parent 73659ac commit ca6723f
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
5 changes: 4 additions & 1 deletion app/containers/LanguageProvider/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ import { fromJS } from 'immutable';
import {
CHANGE_LOCALE,
} from './constants';
import {
DEFAULT_LOCALE,
} from '../App/constants';

const initialState = fromJS({
locale: 'en',
locale: DEFAULT_LOCALE,
});

function languageProviderReducer(state = initialState, action) {
Expand Down
3 changes: 1 addition & 2 deletions internals/generators/language/app-locale.hbs
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
$1
'{{language}}',
$1 '{{language}}',
2 changes: 1 addition & 1 deletion internals/generators/language/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = {
actions.push({
type: 'modify',
path: '../../app/i18n.js',
pattern: /([\n\s'[a-z]+',)(?!.*[\n\s'[a-z]+',)/g,
pattern: /(\s+'[a-z]+',\n)(?!.*\s+'[a-z]+',)/g,
templateFile: './language/app-locale.hbs',
});
actions.push({
Expand Down
2 changes: 1 addition & 1 deletion internals/templates/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
*/
import { addLocaleData } from 'react-intl';
import { DEFAULT_LOCALE } from 'containers/App/constants';
import { DEFAULT_LOCALE } from './containers/App/constants'; // eslint-disable-line

import enLocaleData from 'react-intl/locale-data/en';

Expand Down
1 change: 1 addition & 0 deletions internals/templates/languageProvider/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
*/

export const CHANGE_LOCALE = 'app/LanguageToggle/CHANGE_LOCALE';
export const DEFAULT_LOCALE = 'en';
5 changes: 4 additions & 1 deletion internals/templates/languageProvider/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ import { fromJS } from 'immutable';
import {
CHANGE_LOCALE,
} from './constants';
import {
DEFAULT_LOCALE,
} from '../App/constants'; // eslint-disable-line

const initialState = fromJS({
locale: 'en',
locale: DEFAULT_LOCALE,
});

function languageProviderReducer(state = initialState, action) {
Expand Down

0 comments on commit ca6723f

Please sign in to comment.