feat: add SSO workspace, named shares and Debian release tooling
This commit is contained in:
1 parent
833d908884
commit
87bc33e675
106 files changed
+4160
-5637
No files matched your search
@@ -308,5 +308,16 @@
|
||||
"minutes": "Minutes",
|
||||
"seconds": "Seconds",
|
||||
"unit": "Time Unit"
|
||||
},
|
||||
"sso": {
|
||||
"description": "Your files. One secure workspace.",
|
||||
"signIn": "Continue with SSO",
|
||||
"managed": "Your account and access are managed by AniDev SSO",
|
||||
"shortName": "Short link name",
|
||||
"randomName": "Generate automatically",
|
||||
"shortHint": "2–64 letters, digits, underscores or hyphens. Public names are discoverable; protect sensitive shares with a password.",
|
||||
"workspace": "Your workspace",
|
||||
"toggleTheme": "Switch theme",
|
||||
"itemsCount": "{count} items"
|
||||
}
|
||||
}
|
||||
+58
-36
@@ -1,42 +1,50 @@
|
||||
import dayjs from "dayjs";
|
||||
import { createI18n } from "vue-i18n";
|
||||
|
||||
import("dayjs/locale/ar");
|
||||
import("dayjs/locale/bg");
|
||||
import("dayjs/locale/ca");
|
||||
import("dayjs/locale/cs");
|
||||
import("dayjs/locale/de");
|
||||
import("dayjs/locale/el");
|
||||
import("dayjs/locale/en");
|
||||
import("dayjs/locale/es");
|
||||
import("dayjs/locale/fr");
|
||||
import("dayjs/locale/he");
|
||||
import("dayjs/locale/hr");
|
||||
import("dayjs/locale/hu");
|
||||
import("dayjs/locale/is");
|
||||
import("dayjs/locale/it");
|
||||
import("dayjs/locale/ja");
|
||||
import("dayjs/locale/ko");
|
||||
import("dayjs/locale/lv");
|
||||
import("dayjs/locale/nb");
|
||||
import("dayjs/locale/nl");
|
||||
import("dayjs/locale/nl-be");
|
||||
import("dayjs/locale/pl");
|
||||
import("dayjs/locale/pt-br");
|
||||
import("dayjs/locale/pt");
|
||||
import("dayjs/locale/ro");
|
||||
import("dayjs/locale/ru");
|
||||
import("dayjs/locale/sk");
|
||||
import("dayjs/locale/sv");
|
||||
import("dayjs/locale/tr");
|
||||
import("dayjs/locale/uk");
|
||||
import("dayjs/locale/vi");
|
||||
import("dayjs/locale/zh-cn");
|
||||
import("dayjs/locale/zh-tw");
|
||||
|
||||
// All i18n resources specified in the plugin `include` option can be loaded
|
||||
// at once using the import syntax
|
||||
import messages from "@intlify/unplugin-vue-i18n/messages";
|
||||
import en from "./en.json";
|
||||
import ru from "./ru.json";
|
||||
const messages = { en, ru };
|
||||
const loaders = import.meta.glob<{ default: typeof en }>([
|
||||
"./*.json",
|
||||
"!./en.json",
|
||||
"!./ru.json",
|
||||
]);
|
||||
const dateLoaders: Record<string, () => Promise<unknown>> = {
|
||||
ar: () => import("dayjs/locale/ar"),
|
||||
bg: () => import("dayjs/locale/bg"),
|
||||
ca: () => import("dayjs/locale/ca"),
|
||||
cs: () => import("dayjs/locale/cs"),
|
||||
de: () => import("dayjs/locale/de"),
|
||||
el: () => import("dayjs/locale/el"),
|
||||
en: () => import("dayjs/locale/en"),
|
||||
es: () => import("dayjs/locale/es"),
|
||||
fr: () => import("dayjs/locale/fr"),
|
||||
he: () => import("dayjs/locale/he"),
|
||||
hr: () => import("dayjs/locale/hr"),
|
||||
hu: () => import("dayjs/locale/hu"),
|
||||
is: () => import("dayjs/locale/is"),
|
||||
it: () => import("dayjs/locale/it"),
|
||||
ja: () => import("dayjs/locale/ja"),
|
||||
ko: () => import("dayjs/locale/ko"),
|
||||
lv: () => import("dayjs/locale/lv"),
|
||||
nb: () => import("dayjs/locale/nb"),
|
||||
nl: () => import("dayjs/locale/nl"),
|
||||
"nl-be": () => import("dayjs/locale/nl-be"),
|
||||
pl: () => import("dayjs/locale/pl"),
|
||||
"pt-br": () => import("dayjs/locale/pt-br"),
|
||||
pt: () => import("dayjs/locale/pt"),
|
||||
ro: () => import("dayjs/locale/ro"),
|
||||
ru: () => import("dayjs/locale/ru"),
|
||||
sk: () => import("dayjs/locale/sk"),
|
||||
sv: () => import("dayjs/locale/sv"),
|
||||
tr: () => import("dayjs/locale/tr"),
|
||||
uk: () => import("dayjs/locale/uk"),
|
||||
vi: () => import("dayjs/locale/vi"),
|
||||
"zh-cn": () => import("dayjs/locale/zh-cn"),
|
||||
"zh-tw": () => import("dayjs/locale/zh-tw"),
|
||||
};
|
||||
|
||||
export function detectLocale() {
|
||||
// locale is an RFC 5646 language tag
|
||||
@@ -177,8 +185,21 @@ export const isRtl = (locale?: string) => {
|
||||
return rtlLanguages.includes(locale || i18n.global.locale.value);
|
||||
};
|
||||
|
||||
export function setLocale(locale: string) {
|
||||
dayjs.locale(locale);
|
||||
let localeGeneration = 0;
|
||||
export async function setLocale(locale: string) {
|
||||
const generation = ++localeGeneration;
|
||||
if (!(i18n.global.availableLocales as string[]).includes(locale)) {
|
||||
const loader = loaders["./" + locale + ".json"];
|
||||
if (loader) {
|
||||
const data = await loader();
|
||||
i18n.global.setLocaleMessage(locale, data.default);
|
||||
}
|
||||
}
|
||||
const dateLocale =
|
||||
locale === "pt" ? "pt-br" : locale === "pt-PT" ? "pt" : locale;
|
||||
if (dateLoaders[dateLocale]) await dateLoaders[dateLocale]();
|
||||
if (generation !== localeGeneration) return;
|
||||
dayjs.locale(dateLocale);
|
||||
// according to doc u only need .value if legacy: false but they lied
|
||||
// https://vue-i18n.intlify.dev/guide/essentials/scope.html#local-scope-1
|
||||
// @ts-expect-error incorrect type when legacy
|
||||
@@ -192,4 +213,5 @@ export function setHtmlLocale(locale: string) {
|
||||
else html.dir = "ltr";
|
||||
}
|
||||
|
||||
void setLocale(detectLocale());
|
||||
export default i18n;
|
||||
@@ -305,5 +305,16 @@
|
||||
"minutes": "Минуты",
|
||||
"seconds": "Секунды",
|
||||
"unit": "Единица времени"
|
||||
},
|
||||
"sso": {
|
||||
"description": "Ваши файлы. Одно удобное пространство.",
|
||||
"signIn": "Войти через SSO",
|
||||
"managed": "Учётная запись и доступ управляются в AniDev SSO",
|
||||
"shortName": "Короткое имя ссылки",
|
||||
"randomName": "Сгенерировать автоматически",
|
||||
"shortHint": "2–64 латинские буквы, цифры, дефис или подчёркивание. Для конфиденциальных файлов установите пароль ссылки.",
|
||||
"workspace": "Файловое пространство",
|
||||
"toggleTheme": "Переключить тему",
|
||||
"itemsCount": "Объектов: {count}"
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user