Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6116f93

Browse files
committed
process downloading one language in lowcoder-design
1 parent1c8ce4f commit6116f93

File tree

3 files changed

+33
-7
lines changed

3 files changed

+33
-7
lines changed
Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,30 @@
1-
import{Translator}from"lowcoder-core";
1+
import{getI18nObjects,Translator}from"lowcoder-core";
22
import*aslocaleDatafrom"./locales";
3+
import{ReactNode}from"react";
34

4-
exportconst{ trans}=newTranslator<typeoflocaleData.en>(localeData,REACT_APP_LANGUAGES);
5+
typetransType=(key:any,variables?:any)=>string;
6+
typetransToNodeType=(key:any,variables?:any)=>ReactNode;
7+
8+
lettrans:transType;
9+
lettransToNode:transToNodeType;
10+
letlanguage='en';
11+
12+
exportconstinitTranslator=async(lang?:string)=>{
13+
letlangJson=await(localeDataasany)[lang||'en']();
14+
langJson={[lang||'en']:langJson}
15+
consttranslator=newTranslator<typeoflangJson>(
16+
langJson,
17+
REACT_APP_LANGUAGES,
18+
[lang||'en']
19+
);
20+
21+
language=translator.language;
22+
transToNode=(key:any,variables?:any)=>translator.transToNode?.(key,variables);
23+
trans=(key:any,variables?:any)=>translator.trans?.(key,variables);
24+
}
25+
26+
constlangJson=await(localeDataasany)[REACT_APP_LANGUAGES||'en']();
27+
28+
awaitinitTranslator();
29+
30+
export{language,trans,transToNode};
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// file examples: en, enGB, zh, zhHK
22
// fallback example: current locale is zh-HK, fallback order is zhHK => zh => en
3-
export*from"./en";
4-
export*from"./zh";
5-
export*from"./de";
6-
export*from"./pt"
3+
exportconsten=async() :Promise<Object>=>awaitimport("./en").then(module=>module.en);
4+
exportconstzh=async() :Promise<Object>=>awaitimport("./zh").then(module=>module.zh);
5+
exportconstde=async() :Promise<Object>=>awaitimport("./de").then(module=>module.de);
6+
exportconstpt=async() :Promise<Object>=>awaitimport("./pt").then(module=>module.pt);

‎client/packages/lowcoder-design/tsconfig.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"compilerOptions": {
3-
"target":"es5",
3+
"target":"es2017",
44
"experimentalDecorators":true,
55
"lib": ["dom","dom.iterable","esnext"],
66
"allowJs":true,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp