Skip to content

Commit 23ddb6a

Browse files
authored
Merge pull request #71 from fs-webdev/i18n
Add i18n
2 parents 99fad91 + 7f2dd1d commit 23ddb6a

File tree

9 files changed

+1314
-526
lines changed

9 files changed

+1314
-526
lines changed

packages/react-scripts/config/webpack.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,15 @@ module.exports = function(webpackEnv) {
344344
name: 'static/media/[name].[hash:8].[ext]',
345345
},
346346
},
347+
// load locale files
348+
{
349+
test: /locales/,
350+
loader: '@alienfast/i18next-loader',
351+
options: {
352+
debug: true,
353+
basenameAsNamespace: true,
354+
}
355+
},
347356
// Process application JS with Babel.
348357
// The preset includes JSX, Flow, TypeScript, and some ESnext features.
349358
{

packages/react-scripts/package-lock.json

Lines changed: 1277 additions & 510 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/react-scripts/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
},
2525
"types": "./lib/react-app.d.ts",
2626
"dependencies": {
27+
"@alienfast/i18next-loader": "^1.0.18",
2728
"@babel/core": "7.2.2",
2829
"@fs/babel-preset-frontier": "^1.0.0",
2930
"@fs/eslint-config-frontier-react": "^1.3.0",

packages/react-scripts/scripts/utils/frontierInit.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ function installFrontierDependencies(appPath, appName, answers, ownPath) {
6767
depsToInstall.push(
6868
...[
6969
'@fs/axios',
70+
'@fs/locale',
7071
'@fs/user',
7172
'@fs/router',
7273
'@fs/error-boundary',

packages/react-scripts/template-ef/blueprint.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,17 @@ deploy:
4848
- prod
4949
bindings:
5050
<<: *BINDING_DEFAULTS
51+
5152
deliver:
5253
deploy_order:
53-
- int
54-
- beta
55-
- prod
54+
- name: integration
55+
type: coupled
56+
systems: int
57+
58+
- name: beta
59+
type: coupled
60+
systems: beta
61+
62+
- name: production
63+
type: coupled
64+
systems: prod

packages/react-scripts/template-ef/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const app = express()
44
// Statically serve up the production built React App
55
app.use(express.static('build'))
66

7-
const port = process.env.PORT || 3000
7+
const port = process.env.PORT || 5000
88
app.listen(port, () => {
99
console.log(`Listening on port ${port}`)
1010
})

packages/react-scripts/template-hf/server.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
const setProxies = require('exo/proxy')
22
const snow = require('snow')
33
const setWebpackManifest = require('snow/lib/utils/webpackManifest.js')
4-
const snowConfig = require('./snow.config.js')
54
const hf = require('hf')
5+
const snowConfig = require('./snow.config.js')
66

77
/**
88
* Expose the app
@@ -12,13 +12,13 @@ const app = (module.exports = snow(__dirname, hf, snowConfig))
1212
setWebpackManifest(app, 'build')
1313

1414
if (app.get('env') === 'development') {
15-
app.stack.front(function() {
15+
app.stack.front(() => {
1616
setProxies(app)
1717
})
1818
}
1919

20-
app.stack.postRoute(function() {
21-
app.get('/', (req, res) => {
20+
app.stack.postRoute(() => {
21+
app.get('*', (req, res) => {
2222
res.render('index', {
2323
indexPath: '../build/_index.html',
2424
// _layoutFile: './async_layout'

packages/react-scripts/template-hf/snow.config.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
var urlLookup = {
2-
'cas-public-api.cas.ident.service': process.env.BASE_URL + '/cas-public-api',
3-
'cis-public-api.cis.ident.service': process.env.BASE_URL + '/cis-public-api',
1+
const urlLookup = {
2+
'cas-public-api.cas.ident.service': `${process.env.SG_BASE_URL}/service/ident/cas/cas-public-api`,
3+
'cis-public-api.cis.ident.service': `${process.env.SG_BASE_URL}/service/ident/cis/cis-public-api`,
44
}
55

6-
var serviceLocatorOptions = {
7-
fallbackFunction: function(serviceName) {
6+
const serviceLocatorOptions = {
7+
fallbackFunction(serviceName) {
88
if (urlLookup[serviceName]) {
99
return urlLookup[serviceName]
1010
}
@@ -15,9 +15,9 @@ var serviceLocatorOptions = {
1515
module.exports = {
1616
experiments: [
1717
{
18-
name: 'coolExperimentEx',
19-
description: 'The coolest experiment. Author/Owner: Tyler Graf and the Tree Team',
20-
default: true,
18+
name: 'coolEx',
19+
description: 'The coolest experiment. Author/Owner: {Your Name}',
20+
default: false,
2121
},
2222
],
2323
proxyUser: true,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// This file is intentionally blank, used as a mount point to load the locales

0 commit comments

Comments
 (0)