mirror of
https://github.com/zoriya/flood.git
synced 2025-12-05 23:06:20 +00:00
build: upgrade lingui (#777)
This commit is contained in:
46
.linguirc
46
.linguirc
@@ -1,46 +0,0 @@
|
||||
{
|
||||
"locales": [
|
||||
"af",
|
||||
"ar",
|
||||
"ca",
|
||||
"cs",
|
||||
"da",
|
||||
"de",
|
||||
"el",
|
||||
"en",
|
||||
"es",
|
||||
"fi",
|
||||
"fr",
|
||||
"he",
|
||||
"hu",
|
||||
"it",
|
||||
"ja",
|
||||
"ko",
|
||||
"nl",
|
||||
"no",
|
||||
"pl",
|
||||
"pt",
|
||||
"ro",
|
||||
"ru",
|
||||
"sr",
|
||||
"sv",
|
||||
"tr",
|
||||
"uk",
|
||||
"vi",
|
||||
"zh-Hans",
|
||||
"zh-Hant"
|
||||
],
|
||||
"sourceLocale": "en",
|
||||
"catalogs": [
|
||||
{
|
||||
"path": "client/src/javascript/i18n/strings/{locale}",
|
||||
"include": [
|
||||
"<rootDir>/client/src/javascript"
|
||||
],
|
||||
"exclude": [
|
||||
"**/node_modules/**"
|
||||
]
|
||||
}
|
||||
],
|
||||
"format": "minimal"
|
||||
}
|
||||
1
.npmrc
1
.npmrc
@@ -1,2 +1,3 @@
|
||||
node-linker=hoisted
|
||||
package-import-method=copy
|
||||
hoist-pattern[]=!@lingui/*
|
||||
|
||||
@@ -2,7 +2,6 @@ import {FC, ReactNode, useEffect} from 'react';
|
||||
import {i18n} from '@lingui/core';
|
||||
import {I18nProvider} from '@lingui/react';
|
||||
import {observer} from 'mobx-react';
|
||||
import * as plurals from 'make-plural/plurals';
|
||||
|
||||
import detectLocale from '@client/util/detectLocale';
|
||||
import Languages from '@client/constants/Languages';
|
||||
@@ -16,7 +15,6 @@ import type {LocaleConfig} from '@client/util/detectLocale';
|
||||
|
||||
const messagesCache: Partial<Record<Exclude<Language, 'auto'>, Record<string, string[]>>> = {en: EN};
|
||||
|
||||
i18n.loadLocaleData('en', {plurals: plurals.en});
|
||||
i18n.load('en', messagesCache.en as Record<string, string[]>);
|
||||
i18n.activate('en');
|
||||
|
||||
@@ -59,11 +57,6 @@ const AsyncIntlProvider: FC<AsyncIntlProviderProps> = observer(({children}: Asyn
|
||||
}
|
||||
|
||||
(async () => {
|
||||
if (validatedLocale.language === 'zh-Hans' || validatedLocale.language === 'zh-Hant') {
|
||||
i18n.loadLocaleData(validatedLocale.locale, {plurals: plurals.zh});
|
||||
} else {
|
||||
i18n.loadLocaleData(validatedLocale.locale, {plurals: plurals[validatedLocale.language]});
|
||||
}
|
||||
i18n.load(validatedLocale.locale, {...EN, ...(await getMessages(validatedLocale.language))});
|
||||
i18n.activate(validatedLocale.locale);
|
||||
})();
|
||||
|
||||
44
lingui.config.js
Normal file
44
lingui.config.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import {formatter} from '@lingui/format-json';
|
||||
|
||||
export default {
|
||||
locales: [
|
||||
'af',
|
||||
'ar',
|
||||
'ca',
|
||||
'cs',
|
||||
'da',
|
||||
'de',
|
||||
'el',
|
||||
'en',
|
||||
'es',
|
||||
'fi',
|
||||
'fr',
|
||||
'he',
|
||||
'hu',
|
||||
'it',
|
||||
'ja',
|
||||
'ko',
|
||||
'nl',
|
||||
'no',
|
||||
'pl',
|
||||
'pt',
|
||||
'ro',
|
||||
'ru',
|
||||
'sr',
|
||||
'sv',
|
||||
'tr',
|
||||
'uk',
|
||||
'vi',
|
||||
'zh-Hans',
|
||||
'zh-Hant',
|
||||
],
|
||||
sourceLocale: 'en',
|
||||
catalogs: [
|
||||
{
|
||||
path: 'client/src/javascript/i18n/strings/{locale}',
|
||||
include: ['<rootDir>/client/src/javascript'],
|
||||
exclude: ['**/node_modules/**'],
|
||||
},
|
||||
],
|
||||
format: formatter({style: 'minimal'}),
|
||||
};
|
||||
12
package.json
12
package.json
@@ -89,9 +89,10 @@
|
||||
"@fastify/compress": "^6.5.0",
|
||||
"@fastify/express": "^2.3.0",
|
||||
"@fastify/static": "^6.10.2",
|
||||
"@lingui/core": "^3.17.2",
|
||||
"@lingui/loader": "^3.17.2",
|
||||
"@lingui/react": "^3.17.2",
|
||||
"@lingui/core": "^4.11.3",
|
||||
"@lingui/format-json": "^4.11.3",
|
||||
"@lingui/loader": "^4.11.3",
|
||||
"@lingui/react": "^4.11.3",
|
||||
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
|
||||
"@seald-io/nedb": "^3.1.0",
|
||||
"@types/bencode": "^2.0.1",
|
||||
@@ -173,7 +174,6 @@
|
||||
"jsonwebtoken": "^9.0.0",
|
||||
"lint-staged": "^15.2.2",
|
||||
"lodash": "^4.17.21",
|
||||
"make-plural": "^7.4.0",
|
||||
"mini-css-extract-plugin": "^2.7.6",
|
||||
"mobx": "^6.9.0",
|
||||
"mobx-react": "^7.6.0",
|
||||
@@ -201,8 +201,8 @@
|
||||
"react-window": "^1.8.9",
|
||||
"ress": "^4.0.0",
|
||||
"sanitize-filename": "^1.6.3",
|
||||
"sass": "^1.63.3",
|
||||
"sass-loader": "^13.3.2",
|
||||
"sass": "^1.77.8",
|
||||
"sass-loader": "^16.0.0",
|
||||
"saxen": "^8.1.2",
|
||||
"source-map-loader": "^4.0.1",
|
||||
"style-loader": "^3.3.3",
|
||||
|
||||
739
pnpm-lock.yaml
generated
739
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@
|
||||
"jsxImportSource": "@emotion/react",
|
||||
"sourceMap": true,
|
||||
"target": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"moduleResolution": "Bundler",
|
||||
"allowJs": true,
|
||||
"module": "esnext",
|
||||
"noEmit": true,
|
||||
|
||||
Reference in New Issue
Block a user