mirror of
https://github.com/jellyfin/jellyfin-vue.git
synced 2026-09-02 21:04:08 +03:00
fix(i18n): re-fix types
Signed-off-by: Fernando Fernández <ferferga@hotmail.com>
This commit is contained in:
Vendored
+6
-1
@@ -17,11 +17,16 @@
|
||||
"i18n-ally.keystyle": "flat",
|
||||
"i18n-ally.sortKeys": true,
|
||||
"i18n-ally.sourceLanguage": "en",
|
||||
"i18n-ally.includeSubfolders": false,
|
||||
"i18n-ally.fullReloadOnChanged": true,
|
||||
"i18n-ally.extract.autoDetect": true,
|
||||
"i18n-ally.annotations": false,
|
||||
"i18n-ally.localesPaths": [
|
||||
"packages/i18n/strings"
|
||||
],
|
||||
"i18n-ally.enabledFrameworks": [
|
||||
"vue"
|
||||
"i18next",
|
||||
"vue-sfc"
|
||||
],
|
||||
"eslint.validate": [
|
||||
"vue",
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
],
|
||||
"types": [
|
||||
"axios",
|
||||
"@jellyfin-vue/i18n",
|
||||
"unplugin-vue-router/client",
|
||||
"vite/client",
|
||||
"vuetify",
|
||||
|
||||
Generated
+2
@@ -81,6 +81,7 @@
|
||||
"@storybook/blocks": "*",
|
||||
"@storybook/vue3": "*",
|
||||
"@storybook/vue3-vite": "*",
|
||||
"@vue/shared": "*",
|
||||
"storybook": "*",
|
||||
"type-fest": "*",
|
||||
"vite": "*"
|
||||
@@ -13735,6 +13736,7 @@
|
||||
"@jellyfin-vue/configs": "*"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@jellyfin-vue/i18n": "*",
|
||||
"@vueuse/core": "*",
|
||||
"comlink": "*",
|
||||
"i18next-vue": "*",
|
||||
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
import './types/i18next.d.ts';
|
||||
import './types/virtual-modules.d.ts';
|
||||
@@ -2,11 +2,14 @@
|
||||
"name": "@jellyfin-vue/i18n",
|
||||
"type": "module",
|
||||
"description": "All internacionalization files for Jellyfin Vue",
|
||||
"types": "./types.d.ts",
|
||||
"exports": {
|
||||
".": "./src/index.ts",
|
||||
".": {
|
||||
"import": "./src/index.ts",
|
||||
"types": "./index.d.ts"
|
||||
},
|
||||
"./vite": "./src/vite.ts"
|
||||
},
|
||||
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"lint:fix": "eslint . --fix",
|
||||
|
||||
@@ -16,13 +16,13 @@ await i18next
|
||||
type: 'backend',
|
||||
init: NOOP,
|
||||
read: (language, _, done) => {
|
||||
const promise = resources[language] as Promise<Record<string, string>>;
|
||||
const loadFn = resources[language];
|
||||
|
||||
void (async () => {
|
||||
const data = await promise;
|
||||
|
||||
done(undefined, data);
|
||||
})();
|
||||
if (loadFn) {
|
||||
void (async () => done(undefined, await loadFn()))();
|
||||
} else {
|
||||
done(new Error(`Language ${language} not found`), {});
|
||||
}
|
||||
}
|
||||
} satisfies BackendModule)
|
||||
.init({
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
"coverage"
|
||||
],
|
||||
"include": [
|
||||
"*.d.ts",
|
||||
"*.ts",
|
||||
"**/*.d.ts",
|
||||
"**/*.ts",
|
||||
"src/*.ts",
|
||||
"**/*.json"
|
||||
],
|
||||
|
||||
Vendored
-34
@@ -1,34 +0,0 @@
|
||||
import type en from './strings/en.json';
|
||||
|
||||
type Resources = Record<string, () => Promise<typeof en>>;
|
||||
|
||||
declare module 'i18next' {
|
||||
interface CustomTypeOptions {
|
||||
resources: Resources;
|
||||
strictKeyChecks: true;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'virtual:locales/date-fns' {
|
||||
import * as locales from 'date-fns/locale';
|
||||
|
||||
export = locales;
|
||||
}
|
||||
|
||||
declare module 'virtual:locales/vuetify' {
|
||||
import type * as locales from 'vuetify/locale';
|
||||
|
||||
const typeWithoutRtl: Omit<typeof locales, 'defaultRtl'>;
|
||||
|
||||
export = typeWithoutRtl;
|
||||
}
|
||||
|
||||
declare module 'virtual:i18next/resources' {
|
||||
export const resources: Resources;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is important: https://stackoverflow.com/a/64189046
|
||||
* https://www.typescriptlang.org/docs/handbook/modules.html
|
||||
*/
|
||||
export { };
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
import type en from '../strings/en.json';
|
||||
|
||||
export type LanguageKeys = typeof en;
|
||||
|
||||
declare module 'i18next' {
|
||||
interface CustomTypeOptions {
|
||||
resources: Record<string, LanguageKeys>;
|
||||
strictKeyChecks: true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is important: https://stackoverflow.com/a/64189046
|
||||
* https://www.typescriptlang.org/docs/handbook/modules.html
|
||||
*/
|
||||
export { };
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
declare module 'virtual:locales/date-fns' {
|
||||
import * as locales from 'date-fns/locale';
|
||||
|
||||
export = locales;
|
||||
}
|
||||
|
||||
declare module 'virtual:locales/vuetify' {
|
||||
import type * as locales from 'vuetify/locale';
|
||||
|
||||
const typeWithoutRtl: BetterOmit<typeof locales, 'defaultRtl'>;
|
||||
|
||||
export = typeWithoutRtl;
|
||||
}
|
||||
|
||||
declare module 'virtual:i18next/resources' {
|
||||
import type { LanguageKeys } from './types/i18next';
|
||||
|
||||
export const resources: Record<string, () => Promise<Record<LanguageKeys, string>>>;
|
||||
}
|
||||
@@ -26,6 +26,7 @@
|
||||
"@jellyfin-vue/configs": "*"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@jellyfin-vue/i18n": "*",
|
||||
"@vueuse/core": "*",
|
||||
"comlink": "*",
|
||||
"i18next-vue": "*",
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"DOM"
|
||||
],
|
||||
"types": [
|
||||
"@jellyfin-vue/i18n",
|
||||
"vite/client",
|
||||
"vue"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user