Use default language constant
This commit is contained in:
@@ -53,6 +53,7 @@ import { getErrorMessage } from '@/lib/HelperFunctions.ts';
|
|||||||
import { assertIsDefined } from '@/base/Asserts.ts';
|
import { assertIsDefined } from '@/base/Asserts.ts';
|
||||||
import { Confirmation } from '@/base/AppAwaitableComponent.ts';
|
import { Confirmation } from '@/base/AppAwaitableComponent.ts';
|
||||||
import { UrlUtil } from '@/lib/UrlUtil.ts';
|
import { UrlUtil } from '@/lib/UrlUtil.ts';
|
||||||
|
import { DEFAULT_LANGUAGE } from '@/lib/ISOLanguageUtil.ts';
|
||||||
|
|
||||||
type MangaToMigrate = NonNullable<GetMangaToMigrateQuery['manga']>;
|
type MangaToMigrate = NonNullable<GetMangaToMigrateQuery['manga']>;
|
||||||
type MangaToMigrateTo = NonNullable<GetMangaToMigrateToFetchMutation['fetchManga']>['manga'];
|
type MangaToMigrateTo = NonNullable<GetMangaToMigrateToFetchMutation['fetchManga']>['manga'];
|
||||||
@@ -657,7 +658,7 @@ export class Mangas {
|
|||||||
const translateMangaTagsByMangaTypeEntries = Object.entries(MANGA_TAGS_BY_MANGA_TYPE).map(
|
const translateMangaTagsByMangaTypeEntries = Object.entries(MANGA_TAGS_BY_MANGA_TYPE).map(
|
||||||
([mangaType, tags]) => [
|
([mangaType, tags]) => [
|
||||||
mangaType,
|
mangaType,
|
||||||
['en', i18n.locale, manga.source?.lang]
|
[DEFAULT_LANGUAGE, i18n.locale, manga.source?.lang]
|
||||||
.filter((lng) => !!lng)
|
.filter((lng) => !!lng)
|
||||||
.flatMap((language) =>
|
.flatMap((language) =>
|
||||||
tags.flatMap((tag) =>
|
tags.flatMap((tag) =>
|
||||||
@@ -667,6 +668,7 @@ export class Mangas {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
const translatedMangaTagsByMangaType = Object.fromEntries(translateMangaTagsByMangaTypeEntries) as Record<
|
const translatedMangaTagsByMangaType = Object.fromEntries(translateMangaTagsByMangaTypeEntries) as Record<
|
||||||
string,
|
string,
|
||||||
string[]
|
string[]
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { DAYJS_LOCALES, DayJsLocale } from '@/lib/dayjs/Locales.ts';
|
import { DAYJS_LOCALES, DayJsLocale } from '@/lib/dayjs/Locales.ts';
|
||||||
|
import { DEFAULT_LANGUAGE } from '@/lib/ISOLanguageUtil.ts';
|
||||||
|
|
||||||
export const getDayJsLocale = (locale: string): DayJsLocale => {
|
export const getDayJsLocale = (locale: string): DayJsLocale => {
|
||||||
if (DAYJS_LOCALES.includes(locale as DayJsLocale)) {
|
if (DAYJS_LOCALES.includes(locale as DayJsLocale)) {
|
||||||
@@ -22,7 +23,7 @@ export const getDayJsLocale = (locale: string): DayJsLocale => {
|
|||||||
return convertedLocale as DayJsLocale;
|
return convertedLocale as DayJsLocale;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'en';
|
return DEFAULT_LANGUAGE;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const importDayJsLocale = async (locale: string): Promise<DayJsLocale> => {
|
export const importDayJsLocale = async (locale: string): Promise<DayJsLocale> => {
|
||||||
|
|||||||
Reference in New Issue
Block a user