Skip to content

Commit 6ae59f1

Browse files
committed
Feature(i18n): better i18n support
* better i18n support * better immutable support * upgrade dependencies Fixes #328
1 parent 82f3e2f commit 6ae59f1

File tree

165 files changed

+3482
-4531
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+3482
-4531
lines changed

.appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
environment:
2-
nodejs_version: "10"
2+
nodejs_version: "11"
33

44
install:
55
- ps: Install-Product node $env:nodejs_version

.babelrc

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
{
22
"presets": [
33
"@babel/preset-env",
4-
"@babel/preset-react"
4+
"@babel/preset-react",
5+
"@babel/preset-typescript"
56
],
6-
"env": {
7-
"development": {
8-
"plugins": [
9-
"react-hot-loader/babel"
10-
]
11-
}
12-
},
137
"plugins": [
8+
[
9+
"@babel/plugin-proposal-class-properties",
10+
{
11+
"loose": true,
12+
}
13+
],
14+
"@babel/plugin-syntax-dynamic-import",
15+
"@babel/plugin-transform-runtime",
16+
"react-hot-loader/babel",
1417
[
1518
"prismjs",
1619
{
@@ -37,7 +40,6 @@
3740
"theme": "default",
3841
"css": true
3942
}
40-
],
41-
"@babel/plugin-syntax-dynamic-import"
43+
]
4244
]
4345
}

.circleci/config.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,22 @@ jobs:
99
build:
1010
working_directory: ~
1111
docker:
12-
- image: circleci/node:10
12+
- image: circleci/node:11
1313
steps:
1414
- checkout
15-
- run:
16-
name: Install System Dependencies
17-
command: sudo apt-get update && sudo apt-get install gcc make libpng12-dev nasm -y
1815
- run:
1916
name: Install Docker client
2017
command: |
2118
set -x
22-
VER="18.06.1-ce"
23-
curl -L -o /tmp/docker-$VER.tgz https://download.docker.com/linux/static/stable/x86_64/docker-$VER.tgz
24-
tar -xz -C /tmp -f /tmp/docker-$VER.tgz
19+
VER="18.09.1"
20+
curl -L -o /tmp/docker.tgz https://download.docker.com/linux/static/stable/x86_64/docker-$VER.tgz
21+
tar -xz -C /tmp -f /tmp/docker.tgz
2522
sudo cp -r /tmp/docker/* /usr/bin
2623
- run:
2724
name: Install Docker Compose
2825
command: |
2926
set -x
30-
VER="1.22.0"
27+
VER="1.23.2"
3128
curl -L https://github.com/docker/compose/releases/download/$VER/docker-compose-`uname -s`-`uname -m` > /tmp/docker-compose
3229
sudo cp /tmp/docker-compose /usr/local/bin/docker-compose
3330
sudo chmod +x /usr/local/bin/docker-compose

.dockerignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,12 @@ coverage/
3131
.coveralls.yml
3232

3333
# Misc
34-
.awcache/
34+
__mocks__/
35+
.circleci/
3536
.github/
3637
node_modules/
3738
dist/
39+
.appveyor.yml
40+
.*lintrc*
41+
.*lintignore*
3842
yarn.lock

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ coverage/
3131
.coveralls.yml
3232

3333
# Misc
34-
.awcache/
3534
node_modules/
3635
dist/
3736

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ARG PORT=${PORT}
55
WORKDIR /usr/src/app
66
COPY . /usr/src/app/
77

8-
RUN apk add --no-cache --update make gcc g++ libc-dev libpng-dev automake autoconf libtool nasm
8+
RUN apk add --no-cache --update make gcc libc-dev libpng-dev automake autoconf libtool nasm
99
RUN yarn install
1010
RUN yarn build
1111

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
* [x] [react](https://facebook.github.io/react/) - a JavaScript library for building user interfaces
3737
* [x] [react-hot-loader 4](https://github.com/gaearon/react-hot-loader) - hot module reload!
3838
* [x] [react-router 4](https://github.com/ReactTraining/react-router) - declarative routing for React
39-
* [x] [react-redux](https://github.com/reactjs/react-redux) - the official react bindings for [redux 4](https://github.com/reactjs/redux) (a predictable state container for js apps)
39+
* [x] [react-redux 6](https://github.com/reactjs/react-redux) - the official react bindings for [redux 4](https://github.com/reactjs/redux) (a predictable state container for js apps)
4040
* [x] [react-saga](https://github.com/redux-saga/redux-saga/) - make redux asynchronous flows easy to read, write and test, the replacement for [redux-thunk](https://github.com/reduxjs/redux-thunk)
41-
* [x] [connected-react-router](https://github.com/supasate/connected-react-router) - a redux binding for react-router 4, the replacement for [react-router-redux v5](https://github.com/ReactTraining/react-router/tree/master/packages/react-router-redux)
41+
* [x] [connected-react-router 6](https://github.com/supasate/connected-react-router) - a redux binding for react-router 4, the replacement for [react-router-redux v5](https://github.com/ReactTraining/react-router/tree/master/packages/react-router-redux)
4242
* [x] [react-loadable](https://github.com/jamiebuilds/react-loadable) - better user experience for dynamic loading components
4343
* [x] [react-i18next](https://github.com/i18next/react-i18next) - internationalization for react done right
4444
* [x] [immutable.js](https://github.com/facebook/immutable-js/) - persistent Immutable data structures for react redux state management
@@ -106,7 +106,7 @@ On development (with hot reload):
106106
yarn dev
107107
```
108108

109-
On production (with uglify-js and other optimazitions):
109+
On production (with [terser](https://github.com/terser-js/terser) and other optimazitions):
110110

111111
```bash
112112
yarn prod

__mocks__/react-i18next.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const NamespacesConsumer = ({ children }: any) => children((k: string) => k, { i18n: {} });
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"header": {
3+
"react": "React",
4+
"dropdown": "Dropdown",
5+
"notfound": "404"
6+
},
7+
"footer": {
8+
"title": "Footer Content",
9+
"content": "You can use rows and columns here to organize your footer content.",
10+
"links": "Links",
11+
"linkOne": "Link 1",
12+
"linkTwo": "Link 2",
13+
"linkThree": "Link 3",
14+
"linkFour": "Link 4",
15+
"moreLinks": "More Links"
16+
},
17+
"dropdown": {
18+
"parallax": "Parallax"
19+
}
20+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"title": "Home Page",
3+
"carousel": {
4+
"focusButtonText": "Focus me!",
5+
"firstPanelTitle": "First Panel",
6+
"secondPanelTitle": "Second Panel",
7+
"thirdPanelTitle": "Third Panel",
8+
"fourthPanelTitle": "Fourth Panel",
9+
"firstPanelDescription": "This is your first panel, try to swipe it!",
10+
"secondPanelDescription": "This is your second panel, try to swipe it!",
11+
"thirdPanelDescription": "This is your third panel, try to swipe it!",
12+
"fourthPanelDescription": "This is your fourth panel, try to swipe it!",
13+
"tooltipText": "Click me! >. <",
14+
"toastText": "I am a toast!"
15+
},
16+
"pushpin": {
17+
"green": "Green",
18+
"blue": "Blue",
19+
"orange": "Orange",
20+
"red": "Red",
21+
"purple": "Purple",
22+
"cyan": "Cyan",
23+
"linkOne": "Link 1",
24+
"linkTwo": "Link 2"
25+
}
26+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"title": "Parallax Page",
3+
"description": "Parallax is an effect where the background content or image in this case, is moved at a different speed than the foreground content while scrolling."
4+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"title": "React Page",
3+
"fetchNote": {
4+
"asyncCalls": "async calls",
5+
"fetchAllNotes": "Fetch All Notes From DB"
6+
},
7+
"todoLayout": {
8+
"title": "todos",
9+
"todoFooter": {
10+
"all": "All",
11+
"active": "Active",
12+
"completed": "Completed"
13+
},
14+
"todoInput": {
15+
"addTodo": "Add todo"
16+
}
17+
}
18+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"header": {
3+
"react": "React",
4+
"dropdown": "ドロップダウンリスト",
5+
"notfound": "404"
6+
},
7+
"footer": {
8+
"title": "フッターコンテンツ",
9+
"content": "ここでは行と列を使用してフッターのコンテンツを整理できます。",
10+
"links": "リンク",
11+
"linkOne": "リンク 1",
12+
"linkTwo": "リンク 2",
13+
"linkThree": "リンク 3",
14+
"linkFour": "リンク 4",
15+
"moreLinks": "その他のリンク"
16+
},
17+
"dropdown": {
18+
"parallax": "視差"
19+
}
20+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"title": "ホームページ",
3+
"carousel": {
4+
"focusButtonText": "フォーカス!",
5+
"firstPanelTitle": "最初のパネル",
6+
"secondPanelTitle": "第2のパネル",
7+
"thirdPanelTitle": "第3のパネル",
8+
"fourthPanelTitle": "第4のパネル",
9+
"firstPanelDescription": "これはあなたの最初のパネルです、それをスワイプしよう!",
10+
"secondPanelDescription": "これはあなたの第2のパネルです、それをスワイプしよう!",
11+
"thirdPanelDescription": "これはあなたの第3のパネルです、それをスワイプしよう!",
12+
"fourthPanelDescription": "これはあなたの第4のパネルです、それをスワイプしよう!",
13+
"tooltipText": "クリック! >. <",
14+
"toastText": "私はトーストです!"
15+
},
16+
"pushpin": {
17+
"green": "",
18+
"blue": "",
19+
"orange": "",
20+
"red": "",
21+
"purple": "",
22+
"cyan": "シアン",
23+
"linkOne": "リンク 1",
24+
"linkTwo": "リンク 2"
25+
}
26+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"title": "視差ページ",
3+
"description": "Parallax(パララックス)は、この場合のバックグラウンドコンテンツまたは画像がスクロール中にフォアグラウンドコンテンツとは異なる速度で移動される場合の効果です。"
4+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"title": "Reactページ",
3+
"fetchNote": {
4+
"asyncCalls": "非同期関数",
5+
"fetchAllNotes": "DB内のメモを取得する"
6+
},
7+
"todoLayout": {
8+
"title": "todoリスト",
9+
"todoFooter": {
10+
"all": "全部",
11+
"active": "アクティブ",
12+
"completed": "完成した"
13+
},
14+
"todoInput": {
15+
"addTodo": "追加する"
16+
}
17+
}
18+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"header": {
3+
"react": "React",
4+
"dropdown": "下拉列表",
5+
"notfound": "404"
6+
},
7+
"footer": {
8+
"title": "页脚内容",
9+
"content": "你可以在这里使用行或者列来编辑的页脚内容.",
10+
"links": "链接",
11+
"linkOne": "链接 1",
12+
"linkTwo": "链接 2",
13+
"linkThree": "链接 3",
14+
"linkFour": "链接 4",
15+
"moreLinks": "更多链接"
16+
},
17+
"dropdown": {
18+
"parallax": "视差"
19+
}
20+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"title": "首页",
3+
"carousel": {
4+
"focusButtonText": "看我看我!",
5+
"firstPanelTitle": "第一个面板",
6+
"secondPanelTitle": "第二个面板",
7+
"thirdPanelTitle": "第三个面板",
8+
"fourthPanelTitle": "第四个面板",
9+
"firstPanelDescription": "这是你的第一个面板,试试左右滑动它!",
10+
"secondPanelDescription": "这是你的第二个面板,试试左右滑动它!",
11+
"thirdPanelDescription": "这是你的第三个面板,试试左右滑动它!",
12+
"fourthPanelDescription": "这是你的第四个面板,试试左右滑动它!",
13+
"tooltipText": "戳我! >. <",
14+
"toastText": "哇我是一个toast!"
15+
},
16+
"pushpin": {
17+
"green": "绿色",
18+
"blue": "蓝色",
19+
"orange": "橘色",
20+
"red": "红色",
21+
"purple": "紫色",
22+
"cyan": "青色",
23+
"linkOne": "链接 1",
24+
"linkTwo": "链接 2"
25+
}
26+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"title": "视差页面",
3+
"description": "Parallax(视差) 是指一种背景内容或图像在滚动时以与前景内容不同的速度移动的效果。"
4+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"title": "React页面",
3+
"fetchNote": {
4+
"asyncCalls": "异步函数",
5+
"fetchAllNotes": "获取数据库所有笔记"
6+
},
7+
"todoLayout": {
8+
"title": "待办事项",
9+
"todoFooter": {
10+
"all": "全部",
11+
"active": "待办",
12+
"completed": "已完成"
13+
},
14+
"todoInput": {
15+
"addTodo": "添加待办事项"
16+
}
17+
}
18+
}

frontend/public/manifest.webmanifest

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
"description": "Full-stack boilerplate that using express with webpack, react and typescript!",
1010
"icons": [
1111
{
12-
"src": "android-chrome-192x192.png",
12+
"src": "icons/android-chrome-192x192.png",
1313
"sizes": "192x192",
1414
"type": "image/png"
1515
},
1616
{
17-
"src": "android-chrome-512x512.png",
17+
"src": "icons/android-chrome-512x512.png",
1818
"sizes": "512x512",
1919
"type": "image/png"
2020
}

frontend/src/App.tsx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import { ConnectedRouter } from 'connected-react-router';
1+
import { ConnectedRouter } from 'connected-react-router/immutable';
22
import { History } from 'history';
33
import React from 'react';
4-
import { I18nextProvider } from 'react-i18next';
54
import { Provider } from 'react-redux';
65
import { Store } from 'redux';
76

8-
import i18n from 'i18n';
97
import router from 'router';
108
import { IGlobalState } from 'types/global';
119

@@ -15,11 +13,9 @@ interface IAppProps {
1513
}
1614

1715
export default (props: IAppProps) => (
18-
<I18nextProvider i18n={i18n}>
19-
<Provider store={props.store}>
20-
<ConnectedRouter history={props.history}>
21-
{router}
22-
</ConnectedRouter>
23-
</Provider>
24-
</I18nextProvider>
16+
<Provider store={props.store}>
17+
<ConnectedRouter history={props.history}>
18+
{router}
19+
</ConnectedRouter>
20+
</Provider>
2521
);

frontend/src/components/Dropdown/__tests__/__snapshots__/dropdown.spec.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ exports[`Dropdown should renders correctly 1`] = `
1111
href="/dropdown"
1212
onClick={[Function]}
1313
>
14-
dropdown
14+
dropdown.dropdown
1515
</a>
1616
</li>
1717
</ul>

0 commit comments

Comments
 (0)