Skip to content

Commit

Permalink
Add linguijs support. Ref #1
Browse files Browse the repository at this point in the history
  • Loading branch information
ruscoder committed Feb 4, 2022
1 parent f838439 commit c9c3b1b
Show file tree
Hide file tree
Showing 8 changed files with 1,279 additions and 12 deletions.
13 changes: 13 additions & 0 deletions .linguirc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"catalogs": [{
"path": "<rootDir>/shared/src/locale/{locale}/messages",
"include": ["<rootDir>"],
"exclude": ["**/node_modules/**"]
}],
"extractBabelOptions": {
"rootMode": "upward",
},
"format": "po",
"locales": ["en", "ru"],
}

1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ ADD . /app
ARG TIER
RUN cp shared/src/config.${TIER}.ts shared/src/config.ts

RUN yarn compile
RUN yarn build
9 changes: 9 additions & 0 deletions babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"presets": [
"@babel/preset-env",
"@babel/preset-react",
"@lingui/babel-preset-react"
],
"plugins": ["macros"]
}

12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@
"start:web": "lerna run start --parallel --scope web",
"build": "lerna run --parallel build",
"typecheck": "lerna run --parallel typecheck",
"lint": "lerna run --parallel lint"
"lint": "lerna run --parallel lint",
"extract": "lingui extract",
"compile": "lingui compile"
},
"devDependencies": {
"@babel/preset-env": "^7.14.1",
"@babel/preset-react": "^7.13.13",
"@lingui/babel-preset-react": "^2.9.2",
"@lingui/cli": "^3.8.10",
"@lingui/macro": "^3.8.10",
"@types/node": "^16.11.7",
"@typescript-eslint/eslint-plugin": "^5.3.1",
"@typescript-eslint/parser": "^5.3.1",
Expand All @@ -27,6 +34,9 @@
"rimraf": "^3.0.2",
"typescript": "^4.5.4"
},
"dependencies": {
"@lingui/react": "^3.8.10"
},
"workspaces": {
"packages": [
"web",
Expand Down
8 changes: 8 additions & 0 deletions shared/src/locale/en/messages.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
msgid ""
msgstr ""
"POT-Creation-Date: 2022-02-04 15:23+0300\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: @lingui/cli\n"
"Language: en\n"
8 changes: 8 additions & 0 deletions shared/src/locale/ru/messages.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
msgid ""
msgstr ""
"POT-Creation-Date: 2022-02-04 15:23+0300\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: @lingui/cli\n"
"Language: ru\n"
8 changes: 8 additions & 0 deletions shared/src/services/i18n.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { i18n } from '@lingui/core';

import { messages as messagesEn } from 'shared/src/locale/en/messages.js';
import { messages as messagesRu } from 'shared/src/locale/ru/messages.js';

i18n.load('en', messagesEn);
i18n.load('ru', messagesRu);
i18n.activate('en');
1,232 changes: 1,221 additions & 11 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit c9c3b1b

Please sign in to comment.