feat: add i18n framework with Indonesian translation support (#124)

* feat: add i18n support with separate translation files

- Extract translations from store.js to separate files for easier management
- Add translation files for English (en.js), Indonesian (id.js), Turkish (tr.js), and Chinese (zh.js)
- Load translations via window.translations object before Alpine store initialization
- Add Bahasa Indonesia option to language selector

* feat: translate remaining hardcoded UI strings

- Update index.html to use t() for Menu and GitHub labels
- Update views to translate Tier, Quota, Live, tier badges, and close button
- Update components to use translated error messages and confirmation dialogs
- Update utils to use translated validation and error messages
- Update app-init.js to use translated OAuth success/error messages
This commit is contained in:
Irvan Fauziansyah
2026-01-15 22:33:38 +07:00
committed by GitHub
parent 9ffb83ab74
commit e2d03f9b25
17 changed files with 1413 additions and 890 deletions

View File

@@ -115,8 +115,11 @@ document.addEventListener('alpine:init', () => {
const messageHandler = (event) => {
if (event.data?.type === 'oauth-success') {
const action = reAuthEmail ? 're-authenticated' : 'added';
Alpine.store('global').showToast(`Account ${event.data.email} ${action} successfully`, 'success');
const store = Alpine.store('global');
const successMsg = reAuthEmail
? store.t('accountReauthSuccess')
: store.t('accountAddedSuccess');
store.showToast(successMsg, 'success');
Alpine.store('data').fetchData();
const modal = document.getElementById('add_account_modal');
@@ -127,10 +130,10 @@ document.addEventListener('alpine:init', () => {
window.addEventListener('message', messageHandler);
setTimeout(() => window.removeEventListener('message', messageHandler), 300000);
} else {
Alpine.store('global').showToast(data.error || 'Failed to get auth URL', 'error');
Alpine.store('global').showToast(data.error || Alpine.store('global').t('failedToGetAuthUrl'), 'error');
}
} catch (e) {
Alpine.store('global').showToast('Failed to start OAuth flow: ' + e.message, 'error');
Alpine.store('global').showToast(Alpine.store('global').t('failedToStartOAuth') + ': ' + e.message, 'error');
}
}
}));