Skip to content

Commit 676bb30

Browse files
authored
build: upgrade lingui (#777)
1 parent ee5f837 commit 676bb30

File tree

7 files changed

+505
-324
lines changed

7 files changed

+505
-324
lines changed

.linguirc

Lines changed: 0 additions & 46 deletions
This file was deleted.

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node-linker=hoisted
22
package-import-method=copy
3+
hoist-pattern[]=!@lingui/*

client/src/javascript/i18n/languages.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import {FC, ReactNode, useEffect} from 'react';
22
import {i18n} from '@lingui/core';
33
import {I18nProvider} from '@lingui/react';
44
import {observer} from 'mobx-react';
5-
import * as plurals from 'make-plural/plurals';
65

76
import detectLocale from '@client/util/detectLocale';
87
import Languages from '@client/constants/Languages';
@@ -16,7 +15,6 @@ import type {LocaleConfig} from '@client/util/detectLocale';
1615

1716
const messagesCache: Partial<Record<Exclude<Language, 'auto'>, Record<string, string[]>>> = {en: EN};
1817

19-
i18n.loadLocaleData('en', {plurals: plurals.en});
2018
i18n.load('en', messagesCache.en as Record<string, string[]>);
2119
i18n.activate('en');
2220

@@ -59,11 +57,6 @@ const AsyncIntlProvider: FC<AsyncIntlProviderProps> = observer(({children}: Asyn
5957
}
6058

6159
(async () => {
62-
if (validatedLocale.language === 'zh-Hans' || validatedLocale.language === 'zh-Hant') {
63-
i18n.loadLocaleData(validatedLocale.locale, {plurals: plurals.zh});
64-
} else {
65-
i18n.loadLocaleData(validatedLocale.locale, {plurals: plurals[validatedLocale.language]});
66-
}
6760
i18n.load(validatedLocale.locale, {...EN, ...(await getMessages(validatedLocale.language))});
6861
i18n.activate(validatedLocale.locale);
6962
})();

lingui.config.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import {formatter} from '@lingui/format-json';
2+
3+
export default {
4+
locales: [
5+
'af',
6+
'ar',
7+
'ca',
8+
'cs',
9+
'da',
10+
'de',
11+
'el',
12+
'en',
13+
'es',
14+
'fi',
15+
'fr',
16+
'he',
17+
'hu',
18+
'it',
19+
'ja',
20+
'ko',
21+
'nl',
22+
'no',
23+
'pl',
24+
'pt',
25+
'ro',
26+
'ru',
27+
'sr',
28+
'sv',
29+
'tr',
30+
'uk',
31+
'vi',
32+
'zh-Hans',
33+
'zh-Hant',
34+
],
35+
sourceLocale: 'en',
36+
catalogs: [
37+
{
38+
path: 'client/src/javascript/i18n/strings/{locale}',
39+
include: ['<rootDir>/client/src/javascript'],
40+
exclude: ['**/node_modules/**'],
41+
},
42+
],
43+
format: formatter({style: 'minimal'}),
44+
};

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,10 @@
8989
"@fastify/compress": "^6.5.0",
9090
"@fastify/express": "^2.3.0",
9191
"@fastify/static": "^6.10.2",
92-
"@lingui/core": "^3.17.2",
93-
"@lingui/loader": "^3.17.2",
94-
"@lingui/react": "^3.17.2",
92+
"@lingui/core": "^4.11.3",
93+
"@lingui/format-json": "^4.11.3",
94+
"@lingui/loader": "^4.11.3",
95+
"@lingui/react": "^4.11.3",
9596
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
9697
"@seald-io/nedb": "^3.1.0",
9798
"@types/bencode": "^2.0.1",
@@ -173,7 +174,6 @@
173174
"jsonwebtoken": "^9.0.0",
174175
"lint-staged": "^15.2.2",
175176
"lodash": "^4.17.21",
176-
"make-plural": "^7.4.0",
177177
"mini-css-extract-plugin": "^2.7.6",
178178
"mobx": "^6.9.0",
179179
"mobx-react": "^7.6.0",
@@ -201,8 +201,8 @@
201201
"react-window": "^1.8.9",
202202
"ress": "^4.0.0",
203203
"sanitize-filename": "^1.6.3",
204-
"sass": "^1.63.3",
205-
"sass-loader": "^13.3.2",
204+
"sass": "^1.77.8",
205+
"sass-loader": "^16.0.0",
206206
"saxen": "^8.1.2",
207207
"source-map-loader": "^4.0.1",
208208
"style-loader": "^3.3.3",

0 commit comments

Comments
 (0)