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

Commitc6b1d75

Browse files
authored
Merge pull request#836 from raheeliftikhar5/language-switch-fixes
fix language switch issue on login + added missing translations
2 parents6fa8d8b +c27a4f8 commitc6b1d75

File tree

8 files changed

+93
-25
lines changed

8 files changed

+93
-25
lines changed

‎client/packages/lowcoder/src/app.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,9 @@ const AppIndexWithProps = connect(mapStateToProps, mapDispatchToProps)(AppIndex)
215215
exportfunctionbootstrap(){
216216
initApp();
217217
loadComps();
218+
219+
constuiLanguage=localStorage.getItem('lowcoder_uiLanguage');
220+
218221
constcontainer=document.getElementById("root");
219222
constroot=createRoot(container!);
220223
root.render(

‎client/packages/lowcoder/src/i18n/LanguageProvider.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ import React, { ReactNode } from 'react';
33
// Define the props expected by the LanguageProvider component
44
exportinterfaceLanguageProviderProps{
55
children:ReactNode;
6-
}
6+
}

‎client/packages/lowcoder/src/i18n/index.tsx‎

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,35 @@ import { getI18nObjects, Translator } from "lowcoder-core";
22
import*aslocaleDatafrom"./locales";
33
import{I18nObjects}from"./locales/types";
44
import{languagesMetadata}from"./languagesMeta";
5+
import{ReactNode}from"react";
56

6-
constuiLanguage=localStorage.getItem('lowcoder_uiLanguage');
7+
typetransType=(key:any,variables?:any)=>string;
8+
typetransToNodeType=(key:any,variables?:any)=>ReactNode;
79

8-
exportconst{ trans, transToNode, language}=newTranslator<typeoflocaleData.en>(
9-
localeData,
10-
REACT_APP_LANGUAGES,
11-
[uiLanguage||'en']
12-
);
10+
lettrans:transType;
11+
lettransToNode:transToNodeType;
12+
letlanguage='en';
13+
14+
exportconstinitTranslator=(lang?:string)=>{
15+
consttranslator=newTranslator<typeoflocaleData.en>(
16+
localeData,
17+
REACT_APP_LANGUAGES,
18+
[lang||'en']
19+
);
20+
21+
language=translator.language;
22+
transToNode=translator.transToNode;
23+
trans=translator.trans;
24+
}
1325

1426
exportconsti18nObjs=getI18nObjects<I18nObjects>(localeData,REACT_APP_LANGUAGES);
1527

1628
exportconstlanguageList=Object.keys(languagesMetadata).map(code=>({
1729
languageCode:code,
1830
languageName:languagesMetadata[code].languageName,
1931
flag:languagesMetadata[code].flag
20-
}));
32+
}));
33+
34+
initTranslator();
35+
36+
export{language,trans,transToNode};

‎client/packages/lowcoder/src/i18n/locales/de.ts‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2249,7 +2249,19 @@ export const de: typeof en = {
22492249
"alreadySetPassword":"Passwort setzen",
22502250
"setPassPlaceholder":"Du kannst dich mit Passwort anmelden",
22512251
"setPassAfterBind":"Du kannst das Passwort nach der Kontobindung festlegen",
2252-
"socialConnections":"Soziale Bindungen"
2252+
"socialConnections":"Soziale Bindungen",
2253+
"changeAvatar":"Avatar ändern",
2254+
"about":"Um",
2255+
"userId":"Benutzer-ID",
2256+
"createdAt":"Hergestellt in",
2257+
"currentOrg":"aktuelle Organisation",
2258+
"settings":"Einstellungen",
2259+
"uiLanguage":"UI-Sprache",
2260+
"info":"Die Info",
2261+
"createdApps":"Erstellte Apps",
2262+
"createdModules":"Erstellte Module",
2263+
"onMarketplace":"Auf dem Marktplatz",
2264+
"howToPublish":"So veröffentlichen Sie auf dem Marktplatz"
22532265
},
22542266
"shortcut":{
22552267
...en.shortcut,

‎client/packages/lowcoder/src/i18n/locales/en.ts‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2302,7 +2302,19 @@ export const en = {
23022302
"alreadySetPassword":"Password Set",
23032303
"setPassPlaceholder":"You Can Login with Password",
23042304
"setPassAfterBind":"You Can Set Password After Account Bind",
2305-
"socialConnections":"Social Connections"
2305+
"socialConnections":"Social Connections",
2306+
"changeAvatar":"Change Avatar",
2307+
"about":"About",
2308+
"userId":"User ID",
2309+
"createdAt":"Created At",
2310+
"currentOrg":"Current Organization",
2311+
"settings":"Settings",
2312+
"uiLanguage":"UI Language",
2313+
"info":"Info",
2314+
"createdApps":"Created Apps",
2315+
"createdModules":"Created Modules",
2316+
"onMarketplace":"On Marketplace",
2317+
"howToPublish":"How to publish on Marketplace"
23062318
},
23072319
"shortcut":{
23082320
"shortcutList":"Keyboard Shortcuts",

‎client/packages/lowcoder/src/i18n/locales/zh.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2136,6 +2136,18 @@ profile: {
21362136
setPassPlaceholder:"您可以使用密码登录",
21372137
setPassAfterBind:"账号绑定后,您可以设置密码",
21382138
socialConnections:"社交连接",
2139+
changeAvatar:"更改头像",
2140+
about:"关于",
2141+
userId:"用户身份",
2142+
createdAt:"创建于",
2143+
currentOrg:"当前组织",
2144+
settings:"设置",
2145+
uiLanguage:"用户界面语言",
2146+
info:"信息",
2147+
createdApps:"创建的应用程序",
2148+
createdModules:"创建的模块",
2149+
onMarketplace:"在市场上",
2150+
howToPublish:"如何在 Marketplace 上发布",
21392151
},
21402152
shortcut:{
21412153
shortcutList:"键盘快捷键",
@@ -2287,6 +2299,7 @@ history: {
22872299
history:"历史记录",
22882300
},
22892301
home:{
2302+
profile:"你的个人资料",
22902303
allApplications:"所有应用",
22912304
allModules:"所有模块",
22922305
allFolders:"所有文件夹",

‎client/packages/lowcoder/src/pages/ApplicationV2/UserProfileLayout.tsx‎

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ export function UserProfileLayout(props: UserProfileLayoutProps) {
239239
<StyleProfileContent>
240240
<Rowgutter={[24,24]}style={{display:'flex',alignItems:'end'}}>
241241
<Collg={4}>
242-
<StyleAvatarsrc={<imgsrc={user.avatarUrl}alt="avatar"/>}shape="square"size={120}/>
242+
<StyleAvatarsrc={<imgsrc={user.avatarUrl??`https://eu.ui-avatars.com/api/?name=${user.username}&size=250`}alt="avatar"/>}shape="square"size={120}/>
243243
</Col>
244244
<Collg={20}>
245245
<Spacestyle={{paddingLeft :"80px"}}>
@@ -265,11 +265,12 @@ export function UserProfileLayout(props: UserProfileLayoutProps) {
265265
beforeUpload={beforeImgUpload}
266266
withCredentials
267267
>
268-
<Buttonstyle={{marginTop:"8px"}}>Change Avatar</Button>
268+
<Buttonstyle={{marginTop:"8px"}}>
269+
{trans("profile.changeAvatar")}
270+
</Button>
269271
</Upload>
270272

271273
<BlurFinishInput
272-
273274
valueCheck={{
274275
rule:(val)=>val.trim()!=="",
275276
message:trans("profile.nameCheck"),
@@ -285,20 +286,20 @@ export function UserProfileLayout(props: UserProfileLayoutProps) {
285286
</Card>
286287

287288
<Cardstyle={{marginBottom:"20px"}}>
288-
<Titlelevel={4}>About</Title>
289+
<Titlelevel={4}>{trans("profile.about")}</Title>
289290
<Spacedirection="horizontal"size={10}wrap={true}>
290-
<Text>User-ID:{user.id}</Text> |
291-
<Text>Created At:{dayjs(user.createdTimeMs).format("YYYY-MM-DD HH:mm:ss")}</Text> |
292-
<Text>Current Organization:{currentOrg?.name}</Text>
291+
<Text>{trans("profile.userId")}:{user.id}</Text> |
292+
<Text>{trans("profile.createdAt")}:{dayjs(user.createdTimeMs).format("YYYY-MM-DD HH:mm:ss")}</Text> |
293+
<Text>{trans("profile.currentOrg")}:{currentOrg?.name}</Text>
293294
</Space>
294295
</Card>
295296

296297
<Cardstyle={{marginBottom:"20px"}}>
297-
<Titlelevel={4}>Settings</Title>
298+
<Titlelevel={4}>{trans("profile.settings")}</Title>
298299
<Spacedirection="vertical"size={10}>
299-
<Text>UI Language:</Text>
300+
<Text>{trans("profile.uiLanguage")}:</Text>
300301
<Select
301-
defaultValue={currentUser.uiLanguage}
302+
defaultValue={currentUser.uiLanguage??'en'}
302303
style={{width:200}}
303304
onChange={handleLanguageChange}
304305
showSearch
@@ -316,14 +317,16 @@ export function UserProfileLayout(props: UserProfileLayoutProps) {
316317
</Card>
317318

318319
<Cardstyle={{marginBottom:"20px"}}>
319-
<Titlelevel={4}>Info</Title>
320+
<Titlelevel={4}>{trans("profile.info")}</Title>
320321
<Spacedirection="horizontal"size={10}>
321322
<Rowgutter={[24,24]}>
322323
<Colxs={24}sm={12}xl={6}style={{marginBottom:"20px",minWidth:"300px"}}span={8}>
323324
<Cardhoverable>
324325
<divstyle={{display:"flex",justifyContent:"space-between"}}>
325326
<div>
326-
<pstyle={{textTransform:"uppercase",fontSize:"13px"}}>Created Apps</p>
327+
<pstyle={{textTransform:"uppercase",fontSize:"13px"}}>
328+
{trans("profile.createdApps")}
329+
</p>
327330
<h4style={{fontSize:"22px"}}>
328331
<spandata-target={apps.filter(app=>app.createBy===user.username&&app.applicationType==1).length}>
329332
<CountUpstart={0}end={apps.filter(app=>app.createBy===user.username&&app.applicationType==1).length}duration={2}/>
@@ -343,7 +346,9 @@ export function UserProfileLayout(props: UserProfileLayoutProps) {
343346
<Cardhoverable>
344347
<divstyle={{display:"flex",justifyContent:"space-between"}}>
345348
<div>
346-
<pstyle={{textTransform:"uppercase",fontSize:"13px"}}>Created Modules</p>
349+
<pstyle={{textTransform:"uppercase",fontSize:"13px"}}>
350+
{trans("profile.createdModules")}
351+
</p>
347352
<h4style={{fontSize:"22px"}}>
348353
<spandata-target={apps.filter(app=>app.createBy===user.username&&app.applicationType==2).length}>
349354
<CountUpstart={0}end={apps.filter(app=>app.createBy===user.username&&app.applicationType==2).length}duration={2}/>
@@ -363,14 +368,18 @@ export function UserProfileLayout(props: UserProfileLayoutProps) {
363368
<Cardhoverable>
364369
<divstyle={{display:"flex",justifyContent:"space-between"}}>
365370
<div>
366-
<pstyle={{textTransform:"uppercase",fontSize:"13px"}}>on Marketplace</p>
371+
<pstyle={{textTransform:"uppercase",fontSize:"13px"}}>
372+
{trans("profile.onMarketplace")}
373+
</p>
367374
<h4style={{fontSize:"22px"}}>
368375
<spandata-target={8}>
369376
<CountUpstart={0}end={8}duration={2}/>
370377
</span>
371378
</h4>
372379
<divstyle={{display:"flex",alignItems:"center"}}>
373-
<h5style={{color:"#55c27f",marginRight:"10px"}}>How to publish on Marketplce</h5>
380+
<h5style={{color:"#55c27f",marginRight:"10px"}}>
381+
{trans("profile.howToPublish")}
382+
</h5>
374383
</div>
375384
</div>
376385
<BgSuccessstyle={{padding:'6px',width:'48px',height:'48px',borderRadius:'4px',display:'flex',alignItems:'center',justifyContent:'center'}}>

‎client/packages/lowcoder/src/redux/sagas/userSagas.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { messageInstance } from "lowcoder-design/src/components/GlobalInstances"
2424

2525
import{AuthSearchParams}from"constants/authConstants";
2626
import{saveAuthSearchParams}from"pages/userAuth/authUtils";
27+
import{initTranslator}from"i18n";
2728

2829
functionvalidResponseData(response:AxiosResponse<ApiResponse>){
2930
returnresponse&&response.data&&response.data.data;
@@ -90,6 +91,8 @@ export function* getCurrentUserSaga() {
9091
type:ReduxActionTypes.FETCH_CURRENT_USER_SUCCESS,
9192
payload:response.data.data,
9293
});
94+
const{ uiLanguage}=response.data.data;
95+
initTranslator(uiLanguage);
9396
}
9497
}catch(error:any){
9598
yieldput({

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp