fix circular dependency problem
This commit is contained in:
@@ -241,7 +241,7 @@ export function getRtlLocales(): Record<string, boolean> {
|
|||||||
|
|
||||||
const languageInfo = ALL_LANGUAGES[languageKey];
|
const languageInfo = ALL_LANGUAGES[languageKey];
|
||||||
|
|
||||||
if (languageInfo.textDirection === TextDirection.RTL) {
|
if (languageInfo.textDirection === 'rtl') {
|
||||||
rtlLocales[languageKey] = true;
|
rtlLocales[languageKey] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -750,7 +750,12 @@ export function useI18n() {
|
|||||||
|
|
||||||
function getCurrentLanguageTextDirection(): TextDirection {
|
function getCurrentLanguageTextDirection(): TextDirection {
|
||||||
const currentLanguageInfo = getCurrentLanguageInfo();
|
const currentLanguageInfo = getCurrentLanguageInfo();
|
||||||
return currentLanguageInfo.textDirection;
|
|
||||||
|
if (currentLanguageInfo.textDirection === 'rtl') {
|
||||||
|
return TextDirection.RTL;
|
||||||
|
} else {
|
||||||
|
return TextDirection.LTR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDefaultCurrency(): string {
|
function getDefaultCurrency(): string {
|
||||||
|
|||||||
+13
-15
@@ -11,14 +11,12 @@ import zhHans from './zh_Hans.json';
|
|||||||
import zhHant from './zh_Hant.json';
|
import zhHant from './zh_Hant.json';
|
||||||
import ptBR from './pt_BR.json';
|
import ptBR from './pt_BR.json';
|
||||||
|
|
||||||
import { TextDirection } from '@/core/text.ts';
|
|
||||||
|
|
||||||
export interface LanguageInfo {
|
export interface LanguageInfo {
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
readonly displayName: string;
|
readonly displayName: string;
|
||||||
readonly alternativeLanguageTag: string;
|
readonly alternativeLanguageTag: string;
|
||||||
readonly aliases?: string[];
|
readonly aliases?: string[];
|
||||||
readonly textDirection: TextDirection;
|
readonly textDirection: 'ltr' | 'rtl';
|
||||||
readonly content: object;
|
readonly content: object;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,70 +34,70 @@ export const ALL_LANGUAGES: Record<string, LanguageInfo> = {
|
|||||||
name: 'German',
|
name: 'German',
|
||||||
displayName: 'Deutsch',
|
displayName: 'Deutsch',
|
||||||
alternativeLanguageTag: 'de-DE',
|
alternativeLanguageTag: 'de-DE',
|
||||||
textDirection: TextDirection.LTR,
|
textDirection: 'ltr',
|
||||||
content: de
|
content: de
|
||||||
},
|
},
|
||||||
'en': {
|
'en': {
|
||||||
name: 'English',
|
name: 'English',
|
||||||
displayName: 'English',
|
displayName: 'English',
|
||||||
alternativeLanguageTag: 'en-US',
|
alternativeLanguageTag: 'en-US',
|
||||||
textDirection: TextDirection.LTR,
|
textDirection: 'ltr',
|
||||||
content: en
|
content: en
|
||||||
},
|
},
|
||||||
'es': {
|
'es': {
|
||||||
name: 'Spanish',
|
name: 'Spanish',
|
||||||
displayName: 'Español',
|
displayName: 'Español',
|
||||||
alternativeLanguageTag: 'es-ES',
|
alternativeLanguageTag: 'es-ES',
|
||||||
textDirection: TextDirection.LTR,
|
textDirection: 'ltr',
|
||||||
content: es
|
content: es
|
||||||
},
|
},
|
||||||
'it': {
|
'it': {
|
||||||
name: 'Italian',
|
name: 'Italian',
|
||||||
displayName: 'Italiano',
|
displayName: 'Italiano',
|
||||||
alternativeLanguageTag: 'it-IT',
|
alternativeLanguageTag: 'it-IT',
|
||||||
textDirection: TextDirection.LTR,
|
textDirection: 'ltr',
|
||||||
content: it
|
content: it
|
||||||
},
|
},
|
||||||
'ja': {
|
'ja': {
|
||||||
name: 'Japanese',
|
name: 'Japanese',
|
||||||
displayName: '日本語',
|
displayName: '日本語',
|
||||||
alternativeLanguageTag: 'ja-JP',
|
alternativeLanguageTag: 'ja-JP',
|
||||||
textDirection: TextDirection.LTR,
|
textDirection: 'ltr',
|
||||||
content: ja
|
content: ja
|
||||||
},
|
},
|
||||||
'nl': {
|
'nl': {
|
||||||
name: 'Dutch',
|
name: 'Dutch',
|
||||||
displayName: 'Nederlands',
|
displayName: 'Nederlands',
|
||||||
alternativeLanguageTag: 'nl-NL',
|
alternativeLanguageTag: 'nl-NL',
|
||||||
textDirection: TextDirection.LTR,
|
textDirection: 'ltr',
|
||||||
content: nl
|
content: nl
|
||||||
},
|
},
|
||||||
'pt-BR': {
|
'pt-BR': {
|
||||||
name: 'Portuguese (Brazil)',
|
name: 'Portuguese (Brazil)',
|
||||||
displayName: 'Português (Brasil)',
|
displayName: 'Português (Brasil)',
|
||||||
alternativeLanguageTag: 'pt-BR',
|
alternativeLanguageTag: 'pt-BR',
|
||||||
textDirection: TextDirection.LTR,
|
textDirection: 'ltr',
|
||||||
content: ptBR
|
content: ptBR
|
||||||
},
|
},
|
||||||
'ru': {
|
'ru': {
|
||||||
name: 'Russian',
|
name: 'Russian',
|
||||||
displayName: 'Русский',
|
displayName: 'Русский',
|
||||||
alternativeLanguageTag: 'ru-RU',
|
alternativeLanguageTag: 'ru-RU',
|
||||||
textDirection: TextDirection.LTR,
|
textDirection: 'ltr',
|
||||||
content: ru
|
content: ru
|
||||||
},
|
},
|
||||||
'uk': {
|
'uk': {
|
||||||
name: 'Ukrainian',
|
name: 'Ukrainian',
|
||||||
displayName: 'Українська',
|
displayName: 'Українська',
|
||||||
alternativeLanguageTag: 'uk-UA',
|
alternativeLanguageTag: 'uk-UA',
|
||||||
textDirection: TextDirection.LTR,
|
textDirection: 'ltr',
|
||||||
content: uk
|
content: uk
|
||||||
},
|
},
|
||||||
'vi': {
|
'vi': {
|
||||||
name: 'Vietnamese',
|
name: 'Vietnamese',
|
||||||
displayName: 'Tiếng Việt',
|
displayName: 'Tiếng Việt',
|
||||||
alternativeLanguageTag: 'vi-VN',
|
alternativeLanguageTag: 'vi-VN',
|
||||||
textDirection: TextDirection.LTR,
|
textDirection: 'ltr',
|
||||||
content: vi
|
content: vi
|
||||||
},
|
},
|
||||||
'zh-Hans': {
|
'zh-Hans': {
|
||||||
@@ -107,7 +105,7 @@ export const ALL_LANGUAGES: Record<string, LanguageInfo> = {
|
|||||||
displayName: '中文 (简体)',
|
displayName: '中文 (简体)',
|
||||||
alternativeLanguageTag: 'zh-CN',
|
alternativeLanguageTag: 'zh-CN',
|
||||||
aliases: ['zh-CHS', 'zh-CN', 'zh-SG'],
|
aliases: ['zh-CHS', 'zh-CN', 'zh-SG'],
|
||||||
textDirection: TextDirection.LTR,
|
textDirection: 'ltr',
|
||||||
content: zhHans
|
content: zhHans
|
||||||
},
|
},
|
||||||
'zh-Hant': {
|
'zh-Hant': {
|
||||||
@@ -115,7 +113,7 @@ export const ALL_LANGUAGES: Record<string, LanguageInfo> = {
|
|||||||
displayName: '中文 (繁體)',
|
displayName: '中文 (繁體)',
|
||||||
alternativeLanguageTag: 'zh-TW',
|
alternativeLanguageTag: 'zh-TW',
|
||||||
aliases: ['zh-CHT', 'zh-TW', 'zh-HK', 'zh-MO'],
|
aliases: ['zh-CHT', 'zh-TW', 'zh-HK', 'zh-MO'],
|
||||||
textDirection: TextDirection.LTR,
|
textDirection: 'ltr',
|
||||||
content: zhHant
|
content: zhHant
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user