summaryrefslogtreecommitdiffstats
path: root/ui/src/utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'ui/src/utils.ts')
-rw-r--r--ui/src/utils.ts16
1 files changed, 15 insertions, 1 deletions
diff --git a/ui/src/utils.ts b/ui/src/utils.ts
index c6f43c94..c0a62114 100644
--- a/ui/src/utils.ts
+++ b/ui/src/utils.ts
@@ -170,6 +170,20 @@ export function debounce(func: any, wait: number = 500, immediate: boolean = fal
}
}
-export function getLanguage() {
+export function getLanguage(): string {
return (navigator.language || navigator.userLanguage);
}
+
+export function getMomentLanguage(): string {
+ let lang = getLanguage();
+ if (lang.startsWith('zh')) {
+ lang = 'zh-cn';
+ } else if (lang.startsWith('sv')) {
+ lang = 'sv';
+ } else if (lang.startsWith('fr')) {
+ lang = 'fr';
+ } else {
+ lang = 'en';
+ }
+ return lang;
+}