Skip to content

Commit f52e17a

Browse files
authored
Merge pull request #830 from lowcoder-org/translation
Translation & User-Profile
2 parents ded99fd + d354c9b commit f52e17a

File tree

589 files changed

+27091
-566
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

589 files changed

+27091
-566
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,4 @@ You can access Lowcoder from [cloud-hosted version](https://app.lowcoder.cloud/)
101101
Accelerate the growth of Lowcoder and unleash its potential with your Sponsorship – together, we're shaping the future of Lowcode for everyone!
102102
[Be a Sponsor](https://github.com/sponsors/lowcoder-org)
103103

104-
Like ... [@spacegoats-io](https://github.com/spacegoats-io), [@Jomedya](https://github.com/Jomedya), [@CHSchuepfer](https://github.com/CHSchuepfer), Thank you very much!!
104+
Like ... [@Darkjamin](https://github.com/Darkjamin), [@spacegoats-io](https://github.com/spacegoats-io), [@Jomedya](https://github.com/Jomedya), [@CHSchuepfer](https://github.com/CHSchuepfer), Thank you very much!!

client/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@
7676
"@types/styled-components": "^5.1.34",
7777
"antd-mobile": "^5.34.0",
7878
"chalk": "4",
79+
"flag-icons": "^7.2.1",
7980
"number-precision": "^1.6.0",
81+
"react-countup": "^6.5.3",
8082
"react-player": "^2.11.0",
8183
"resize-observer-polyfill": "^1.5.1",
8284
"rollup": "^4.13.0",

client/packages/lowcoder-core/lib/index.cjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11513,6 +11513,7 @@ var IntlMessageFormat = IntlMessageFormat$1;
1151311513

1151411514
var defaultLocale = "en";
1151511515
var locales = [defaultLocale];
11516+
1151611517
if (globalThis.navigator) {
1151711518
if (navigator.languages && navigator.languages.length > 0) {
1151811519
locales = __spreadArray([], navigator.languages, true);
@@ -11521,6 +11522,7 @@ if (globalThis.navigator) {
1152111522
locales = [navigator.language || navigator.userLanguage || defaultLocale];
1152211523
}
1152311524
}
11525+
1152411526
function parseLocale(s) {
1152511527
var locale = s.trim();
1152611528
if (!locale) {

client/packages/lowcoder-core/lib/index.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,9 @@ declare const i18n: {
648648
region?: string | undefined;
649649
locales: string[];
650650
};
651+
651652
declare function getValueByLocale<T>(defaultValue: T, func: (info: LocaleInfo) => T | undefined): T;
653+
652654
type AddDot<T extends string> = T extends "" ? "" : `.${T}`;
653655
type ValidKey<T> = Exclude<keyof T, symbol>;
654656
type NestedKey<T> = (T extends object ? {
@@ -658,6 +660,7 @@ type AddPrefix<T, P extends string> = {
658660
[K in keyof T as K extends string ? `${P}${K}` : never]: T[K];
659661
};
660662
declare const globalMessages: AddPrefix<{}, "@">;
663+
661664
type GlobalMessageKey = NestedKey<typeof globalMessages>;
662665
type VariableValue = string | number | boolean | Date | React.ReactNode;
663666

client/packages/lowcoder-core/lib/index.js

Lines changed: 64 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7581,15 +7581,62 @@ function requireReactJsxRuntime_development () {
75817581
} (jsxRuntime));
75827582

75837583
var en = {};
7584-
75857584
var zh = {};
7585+
var de = {};
7586+
var fr = {};
7587+
var es = {};
7588+
var it = {};
7589+
var ar = {};
7590+
var th = {};
7591+
var vi = {};
7592+
var ms = {};
7593+
var id = {};
7594+
var hi = {};
7595+
var ta = {};
7596+
var kn = {};
7597+
var ml = {};
7598+
var ru = {};
7599+
var pl = {};
7600+
var cs = {};
7601+
var uk = {};
7602+
var bg = {};
7603+
var sr = {};
7604+
var hr = {};
7605+
var sk = {};
7606+
var sl = {};
7607+
var mk = {};
7608+
var pt = {};
75867609

75877610
// file examples: en, enGB, zh, zhHK
75887611

75897612
var localeData = /*#__PURE__*/Object.freeze({
75907613
__proto__: null,
75917614
en: en,
7592-
zh: zh
7615+
zh: zh,
7616+
de: de,
7617+
fr: fr,
7618+
es: es,
7619+
it: it,
7620+
ar: ar,
7621+
th: th,
7622+
vi: vi,
7623+
ms: ms,
7624+
id: id,
7625+
hi: hi,
7626+
ta: ta,
7627+
kn: kn,
7628+
ml: ml,
7629+
ru: ru,
7630+
pl: pl,
7631+
cs: cs,
7632+
uk: uk,
7633+
bg: bg,
7634+
sr: sr,
7635+
hr: hr,
7636+
sk: sk,
7637+
sl: sl,
7638+
mk: mk,
7639+
pt: pt
75937640
});
75947641

75957642
var ErrorKind;
@@ -11505,14 +11552,22 @@ var IntlMessageFormat = IntlMessageFormat$1;
1150511552

1150611553
var defaultLocale = "en";
1150711554
var locales = [defaultLocale];
11555+
11556+
// Falk - Adapted the central translator to check if a localStorage key is existing.
11557+
11558+
const uiLanguage = localStorage.getItem('lowcoder_uiLanguage');
1150811559
if (globalThis.navigator) {
11509-
if (navigator.languages && navigator.languages.length > 0) {
11560+
if (uiLanguage) {
11561+
locales = [uiLanguage];
11562+
}
11563+
else if (navigator.languages && navigator.languages.length > 0) {
1151011564
locales = __spreadArray([], navigator.languages, true);
1151111565
}
1151211566
else {
1151311567
locales = [navigator.language || navigator.userLanguage || defaultLocale];
1151411568
}
1151511569
}
11570+
1151611571
function parseLocale(s) {
1151711572
var locale = s.trim();
1151811573
if (!locale) {
@@ -11572,9 +11627,13 @@ function getDataByLocale(fileData, suffix, filterLocales, targetLocales) {
1157211627
return { data: data, language: name_1.slice(0, 2) };
1157311628
}
1157411629
}
11575-
throw new Error("Not found ".concat(names));
11630+
// throw new Error("Not found ".concat(names));
11631+
// better to continue the app without crashing
11632+
console.error("Not found ".concat(names));
1157611633
}
11634+
1157711635
var globalMessageKeyPrefix = "@";
11636+
1157811637
var globalMessages = Object.fromEntries(Object.entries(getDataByLocale(localeData, "").data).map(function (_a) {
1157911638
var k = _a[0], v = _a[1];
1158011639
return [
@@ -11635,7 +11694,7 @@ var Translator = /** @class */ (function () {
1163511694
}());
1163611695

1163711696
function getI18nObjects(fileData, filterLocales) {
11638-
return getDataByLocale(fileData, "Obj", filterLocales).data;
11697+
return getDataByLocale(fileData, "Obj", filterLocales)?.data;
1163911698
}
1164011699

1164111700
export { AbstractComp, AbstractNode, CachedNode, CodeNode, CompActionTypes, FetchCheckNode, FunctionNode, MultiBaseComp, RecordNode, RelaxedJsonParser, SimpleAbstractComp, SimpleComp, SimpleNode, Translator, ValueAndMsg, WrapContextNodeV2, WrapNode, changeChildAction, changeDependName, changeEditDSLAction, changeValueAction, clearMockWindow, clearStyleEval, customAction, deferAction, deleteCompAction, dependingNodeMapEquals, evalFunc, evalFunctionResult, evalNodeOrMinor, evalPerfUtil, evalScript, evalStyle, executeQueryAction, fromRecord, fromUnevaledValue, fromValue, fromValueWithCache, getDynamicStringSegments, getI18nObjects, getValueByLocale, i18n, isBroadcastAction, isChildAction, isCustomAction, isDynamicSegment, isFetching, isMyCustomAction, mergeExtra, multiChangeAction, nodeIsRecord, onlyEvalAction, relaxedJSONToJSON, renameAction, replaceCompAction, routeByNameAction, transformWrapper, triggerModuleEventAction, unwrapChildAction, updateActionContextAction, updateNodesV2Action, withFunction, wrapActionExtraInfo, wrapChildAction, wrapContext, wrapDispatch };

client/packages/lowcoder-core/src/i18n/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ function getDataByLocale<T>(
6868
filterLocales?: string,
6969
targetLocales?: string[]
7070
) {
71+
72+
console.log("Überraschung", fileData);
73+
7174
let localeInfos = [...fallbackLocaleInfos];
7275

7376
const targetLocaleInfo = parseLocales(targetLocales || []);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { en } from "./en";
2+
3+
export const de: typeof en = {};

client/packages/lowcoder-core/src/i18n/locales/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
// fallback example: current locale is zh-HK, fallback order is zhHK => zh => en
33
export * from "./en";
44
export * from "./zh";
5+
export * from "./de";
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { en } from "./en";
2+
3+
export const de: typeof en = {...en};

client/packages/lowcoder-design/src/i18n/design/locales/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
// fallback example: current locale is zh-HK, fallback order is zhHK => zh => en
33
export * from "./en";
44
export * from "./zh";
5+
export * from "./de";

0 commit comments

Comments
 (0)