Refactor i18n structure and update language files

- Removed old validation and common language files for English and Indonesian.
- Created new language files for English and Indonesian under the updated directory structure.
- Updated setup to reflect new language file paths and changed default language to English.
- Modified storage keys from 'locale' to 'language' for consistency.
- Added new language files for various modules including bookmarks, history, navigation, and system settings.
- Introduced new booking module language files for both English and Indonesian.
- Implemented a login page component with basic structure.
This commit is contained in:
Firman Ramdhani
2026-07-16 10:35:08 +07:00
parent 03eb4a803b
commit 9b09938a50
44 changed files with 147 additions and 99 deletions
+7 -7
View File
@@ -1,11 +1,11 @@
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import commonEn from './locales/en/common.json';
import commonId from './locales/id/common.json';
import validationEn from './locales/en/validation.json';
import validationId from './locales/id/validation.json';
import commonEn from './languages/en/common.json';
import commonId from './languages/id/common.json';
import validationEn from './languages/en/validation.json';
import validationId from './languages/id/validation.json';
const DEFAULT_LANGUAGE = 'id';
const DEFAULT_LANGUAGE = 'en';
const SUPPORTED_LANGUAGES = ['en', 'id'] as const;
export type SupportedLanguage = (typeof SUPPORTED_LANGUAGES)[number];
@@ -32,10 +32,10 @@ export let globalStorageAdapter: I18nStorageAdapter | undefined;
*
* It accepts an optional storage adapter to read the initial language.
*/
export async function setupI18n(config: I18nConfig = {}): Promise<void> {
export async function setupI18n(config: I18nConfig = {}, defaultLanguage?: string): Promise<void> {
globalStorageAdapter = config.storageAdapter;
let initialLng = DEFAULT_LANGUAGE;
let initialLng = defaultLanguage ? defaultLanguage : DEFAULT_LANGUAGE;
try {
if (globalStorageAdapter) {
const storedLng = await globalStorageAdapter.getLanguage();