Skip to content
This repository was archived by the owner on Sep 6, 2022. It is now read-only.

Commit c201729

Browse files
2manyvcosGretzky
authored andcommitted
Readded message scope variables
1 parent 8de373c commit c201729

File tree

11 files changed

+65
-43
lines changed

11 files changed

+65
-43
lines changed

app/components/Footer/messages.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
*/
66
import { defineMessages } from 'react-intl';
77

8+
export const scope = 'boilerplate.components.Footer';
9+
810
export default defineMessages({
911
licenseMessage: {
10-
id: 'boilerplate.components.Footer.license.message',
12+
id: `${scope}.license.message`,
1113
defaultMessage: 'This project is licensed under the MIT license.',
1214
},
1315
authorMessage: {
14-
id: 'boilerplate.components.Footer.author.message',
16+
id: `${scope}.author.message`,
1517
defaultMessage: `
1618
Made with love by {author}.
1719
`,

app/components/Header/messages.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
*/
66
import { defineMessages } from 'react-intl';
77

8+
export const scope = 'boilerplate.components.Header';
9+
810
export default defineMessages({
911
home: {
10-
id: 'boilerplate.components.Header.home',
12+
id: `${scope}.home`,
1113
defaultMessage: 'Home',
1214
},
1315
features: {
14-
id: 'boilerplate.components.Header.features',
16+
id: `${scope}.features`,
1517
defaultMessage: 'Features',
1618
},
1719
});

app/containers/FeaturePage/messages.js

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,28 @@
55
*/
66
import { defineMessages } from 'react-intl';
77

8+
export const scope = 'boilerplate.containers.FeaturePage';
9+
810
export default defineMessages({
911
header: {
10-
id: 'boilerplate.containers.FeaturePage.header',
12+
id: `${scope}.header`,
1113
defaultMessage: 'Features',
1214
},
1315
scaffoldingHeader: {
14-
id: 'boilerplate.containers.FeaturePage.scaffolding.header',
16+
id: `${scope}.scaffolding.header`,
1517
defaultMessage: 'Quick scaffolding',
1618
},
1719
scaffoldingMessage: {
18-
id: 'boilerplate.containers.FeaturePage.scaffolding.message',
20+
id: `${scope}.scaffolding.message`,
1921
defaultMessage: `Automate the creation of components, containers, routes, selectors
2022
and sagas - and their tests - right from the CLI!`,
2123
},
2224
feedbackHeader: {
23-
id: 'boilerplate.containers.FeaturePage.feedback.header',
25+
id: `${scope}.feedback.header`,
2426
defaultMessage: 'Instant feedback',
2527
},
2628
feedbackMessage: {
27-
id: 'boilerplate.containers.FeaturePage.feedback.message',
29+
id: `${scope}.feedback.message`,
2830
defaultMessage: `
2931
Enjoy the best DX and code your app at the speed of thought! Your
3032
saved changes to the CSS and JS are reflected instantaneously
@@ -33,39 +35,39 @@ export default defineMessages({
3335
`,
3436
},
3537
stateManagementHeader: {
36-
id: 'boilerplate.containers.FeaturePage.state_management.header',
38+
id: `${scope}.state_management.header`,
3739
defaultMessage: 'Predictable state management',
3840
},
3941
stateManagementMessages: {
40-
id: 'boilerplate.containers.FeaturePage.state_management.message',
42+
id: `${scope}.state_management.message`,
4143
defaultMessage: `
4244
Unidirectional data flow allows for change logging and time travel
4345
debugging.
4446
`,
4547
},
4648
javascriptHeader: {
47-
id: 'boilerplate.containers.FeaturePage.javascript.header',
49+
id: `${scope}.javascript.header`,
4850
defaultMessage: 'Next generation JavaScript',
4951
},
5052
javascriptMessage: {
51-
id: 'boilerplate.containers.FeaturePage.javascript.message',
53+
id: `${scope}.javascript.message`,
5254
defaultMessage: `Use template strings, object destructuring, arrow functions, JSX
5355
syntax and more, today.`,
5456
},
5557
cssHeader: {
56-
id: 'boilerplate.containers.FeaturePage.css.header',
58+
id: `${scope}.css.header`,
5759
defaultMessage: 'Features',
5860
},
5961
cssMessage: {
60-
id: 'boilerplate.containers.FeaturePage.css.message',
62+
id: `${scope}.css.message`,
6163
defaultMessage: 'Next generation CSS',
6264
},
6365
routingHeader: {
64-
id: 'boilerplate.containers.FeaturePage.routing.header',
66+
id: `${scope}.routing.header`,
6567
defaultMessage: 'Industry-standard routing',
6668
},
6769
routingMessage: {
68-
id: 'boilerplate.containers.FeaturePage.routing.message',
70+
id: `${scope}.routing.message`,
6971
defaultMessage: `
7072
Write composable CSS that's co-located with your components for
7173
complete modularity. Unique generated class names keep the
@@ -74,23 +76,23 @@ export default defineMessages({
7476
`,
7577
},
7678
networkHeader: {
77-
id: 'boilerplate.containers.FeaturePage.network.header',
79+
id: `${scope}.network.header`,
7880
defaultMessage: 'Offline-first',
7981
},
8082
networkMessage: {
81-
id: 'boilerplate.containers.FeaturePage.network.message',
83+
id: `${scope}.network.message`,
8284
defaultMessage: `
8385
The next frontier in performant web apps: availability without a
8486
network connection from the instant your users load the app.
8587
`,
8688
},
8789
intlHeader: {
88-
id: 'boilerplate.containers.FeaturePage.internationalization.header',
90+
id: `${scope}.internationalization.header`,
8991
defaultMessage:
9092
'Complete i18n Standard Internationalization & Pluralization',
9193
},
9294
intlMessage: {
93-
id: 'boilerplate.containers.FeaturePage.internationalization.message',
95+
id: `${scope}.internationalization.message`,
9496
defaultMessage:
9597
'Scalable apps need to support multiple languages, easily add and support multiple languages with `react-intl`.',
9698
},

app/containers/HomePage/messages.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,28 @@
55
*/
66
import { defineMessages } from 'react-intl';
77

8+
export const scope = 'boilerplate.containers.HomePage';
9+
810
export default defineMessages({
911
startProjectHeader: {
10-
id: 'boilerplate.containers.HomePage.start_project.header',
12+
id: `${scope}.start_project.header`,
1113
defaultMessage: 'Start your next react project in seconds',
1214
},
1315
startProjectMessage: {
14-
id: 'boilerplate.containers.HomePage.start_project.message',
16+
id: `${scope}.start_project.message`,
1517
defaultMessage:
1618
'A highly scalable, offline-first foundation with the best DX and a focus on performance and best practices',
1719
},
1820
trymeHeader: {
19-
id: 'boilerplate.containers.HomePage.tryme.header',
21+
id: `${scope}.tryme.header`,
2022
defaultMessage: 'Try me!',
2123
},
2224
trymeMessage: {
23-
id: 'boilerplate.containers.HomePage.tryme.message',
25+
id: `${scope}.tryme.message`,
2426
defaultMessage: 'Show Github repositories by',
2527
},
2628
trymeAtPrefix: {
27-
id: 'boilerplate.containers.HomePage.tryme.atPrefix',
29+
id: `${scope}.tryme.atPrefix`,
2830
defaultMessage: '@',
2931
},
3032
});

app/containers/LocaleToggle/messages.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
*/
66
import { defineMessages } from 'react-intl';
77

8+
export const scope = 'boilerplate.containers.LocaleToggle';
9+
810
export default defineMessages({
911
en: {
10-
id: 'boilerplate.containers.LocaleToggle.en',
12+
id: `${scope}.en`,
1113
defaultMessage: 'en',
1214
},
1315
de: {
14-
id: 'boilerplate.containers.LocaleToggle.de',
16+
id: `${scope}.de`,
1517
defaultMessage: 'de',
1618
},
1719
});

app/containers/NotFoundPage/messages.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
*/
66
import { defineMessages } from 'react-intl';
77

8+
export const scope = 'boilerplate.containers.NotFoundPage';
9+
810
export default defineMessages({
911
header: {
10-
id: 'boilerplate.containers.NotFoundPage.header',
12+
id: `${scope}.header`,
1113
defaultMessage: 'Page not found.',
1214
},
1315
});

docs/js/i18n.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@ https://github.com/yahoo/react-intl/wiki/API#definemessages
2525
*/
2626
import { defineMessages } from 'react-intl';
2727

28+
export const scope = 'boilerplate.components.Footer';
29+
2830
export default defineMessages({
2931
licenseMessage: {
30-
id: 'boilerplate.components.Footer.license.message',
32+
id: `${scope}.license.message`, // equals 'boilerplate.components.Footer.license.message'
3133
defaultMessage: 'This project is licensed under the MIT license.',
3234
},
3335
authorMessage: {
34-
id: 'boilerplate.components.Footer.author.message',
36+
id: `${scope}.author.message`,
3537
defaultMessage: `
3638
Made with love by {author}.
3739
`,

internals/generators/component/messages.js.hbs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66

77
import { defineMessages } from 'react-intl';
88

9+
export const scope = 'app.components.{{ properCase name }}';
10+
911
export default defineMessages({
1012
header: {
11-
id: 'app.components.{{ properCase name }}.header',
12-
defaultMessage: 'This is the {{ properCase name}} component !',
13+
id: `${scope}.header`,
14+
defaultMessage: 'This is the {{ properCase name }} component!',
1315
},
1416
});
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
/*
2-
* {{properCase name }} Messages
2+
* {{ properCase name }} Messages
33
*
4-
* This contains all the text for the {{properCase name }} component.
4+
* This contains all the text for the {{ properCase name }} container.
55
*/
66

77
import { defineMessages } from 'react-intl';
88

9+
export const scope = 'app.containers.{{ properCase name }}';
10+
911
export default defineMessages({
1012
header: {
11-
id: 'app.containers.{{properCase name }}.header',
12-
defaultMessage: 'This is {{properCase name}} container !',
13+
id: `${scope}.header`,
14+
defaultMessage: 'This is the {{ properCase name }} container!',
1315
},
1416
});
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
/*
22
* HomePage Messages
33
*
4-
* This contains all the text for the HomePage component.
4+
* This contains all the text for the HomePage container.
55
*/
66
import { defineMessages } from 'react-intl';
77

8+
export const scope = 'app.containers.HomePage';
9+
810
export default defineMessages({
911
header: {
10-
id: 'app.components.HomePage.header',
11-
defaultMessage: 'This is HomePage component!',
12+
id: `${scope}.header`,
13+
defaultMessage: 'This is the HomePage container!',
1214
},
1315
});

0 commit comments

Comments
 (0)