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:
@@ -48,7 +48,7 @@ Object.defineProperty(globalThis, 'localStorage', {
|
||||
|
||||
const TestStorageKey = {
|
||||
THEME: 'theme',
|
||||
LOCALE: 'locale',
|
||||
LANGUAGE: 'language',
|
||||
ACCESS_TOKEN: 'access_token',
|
||||
REFRESH_TOKEN: 'refresh_token',
|
||||
USER_PROFILE: 'user_profile',
|
||||
@@ -62,7 +62,7 @@ const ENCRYPTED_KEYS = new Set<TestStorageKeyValue>([
|
||||
TestStorageKey.USER_PROFILE,
|
||||
]);
|
||||
|
||||
const PLAIN_KEYS = new Set<TestStorageKeyValue>([TestStorageKey.THEME, TestStorageKey.LOCALE]);
|
||||
const PLAIN_KEYS = new Set<TestStorageKeyValue>([TestStorageKey.THEME, TestStorageKey.LANGUAGE]);
|
||||
|
||||
interface TestUser {
|
||||
id: number;
|
||||
@@ -108,10 +108,10 @@ describe('LocalStorageService', () => {
|
||||
});
|
||||
|
||||
it('stores plain JSON without encryption for non-sensitive keys', async () => {
|
||||
await storage.setItem(TestStorageKey.LOCALE, 'en-US');
|
||||
await storage.setItem(TestStorageKey.LANGUAGE, 'en-US');
|
||||
|
||||
expect(mockEncrypt).not.toHaveBeenCalled();
|
||||
expect(mockLocalStorage.setItem).toHaveBeenCalledWith(TestStorageKey.LOCALE, '"en-US"');
|
||||
expect(mockLocalStorage.setItem).toHaveBeenCalledWith(TestStorageKey.LANGUAGE, '"en-US"');
|
||||
});
|
||||
|
||||
it('encrypts sensitive keys (ACCESS_TOKEN)', async () => {
|
||||
@@ -194,7 +194,7 @@ describe('LocalStorageService', () => {
|
||||
describe('clear', () => {
|
||||
it('clears all keys from storage', async () => {
|
||||
await storage.setItem(TestStorageKey.THEME, 'dark');
|
||||
await storage.setItem(TestStorageKey.LOCALE, 'en');
|
||||
await storage.setItem(TestStorageKey.LANGUAGE, 'en');
|
||||
await storage.clear();
|
||||
|
||||
expect(mockLocalStorage.clear).toHaveBeenCalled();
|
||||
@@ -220,11 +220,11 @@ describe('LocalStorageService', () => {
|
||||
describe('keys', () => {
|
||||
it('returns all stored keys', async () => {
|
||||
await storage.setItem(TestStorageKey.THEME, 'dark');
|
||||
await storage.setItem(TestStorageKey.LOCALE, 'en');
|
||||
await storage.setItem(TestStorageKey.LANGUAGE, 'en');
|
||||
|
||||
const allKeys = await storage.keys();
|
||||
expect(allKeys).toContain(TestStorageKey.THEME);
|
||||
expect(allKeys).toContain(TestStorageKey.LOCALE);
|
||||
expect(allKeys).toContain(TestStorageKey.LANGUAGE);
|
||||
expect(allKeys).toHaveLength(2);
|
||||
});
|
||||
});
|
||||
@@ -248,8 +248,8 @@ describe('LocalStorageService', () => {
|
||||
expect(ENCRYPTED_KEYS.has(TestStorageKey.THEME)).toBe(false);
|
||||
});
|
||||
|
||||
it('LOCALE is NOT in ENCRYPTED_KEYS', () => {
|
||||
expect(ENCRYPTED_KEYS.has(TestStorageKey.LOCALE)).toBe(false);
|
||||
it('LANGUAGE is NOT in ENCRYPTED_KEYS', () => {
|
||||
expect(ENCRYPTED_KEYS.has(TestStorageKey.LANGUAGE)).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user