Skip to content

Commit

Permalink
Add Indonesian localization (#2356)
Browse files Browse the repository at this point in the history
* Add Indonesian (id) locale

* Add Indonesian translation messages

* Update team number and add some translation

* Update for better ID translation

* Apply suggestions from code review

Co-authored-by: Aditya Dirgantara <[email protected]>
Co-authored-by: Mary <[email protected]>

* Apply suggestions from code review

Co-authored-by: Aditya Dirgantara <[email protected]>

* Apply suggestions from code review

Co-authored-by: Mary <[email protected]>

* Change translation post to postingan

* Update translation

* Fix error

* Apply suggestions from code review

Co-authored-by: Mary <[email protected]>

* Add Thinkbyte1024 and mary-ext to language team ID

* Update username to lowercase

---------

Co-authored-by: Aditya Dirgantara <[email protected]>
Co-authored-by: Mary <[email protected]>
Co-authored-by: Ansh <[email protected]>
  • Loading branch information
4 people authored Jan 9, 2024
1 parent dda5ca2 commit d7f4e13
Show file tree
Hide file tree
Showing 7 changed files with 2,493 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lingui.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @type {import('@lingui/conf').LinguiConfig} */
module.exports = {
locales: ['en', 'hi', 'ja', 'fr', 'de', 'es', 'ko', 'es', 'pt-BR', 'uk'],
locales: ['en', 'hi', 'ja', 'fr', 'de', 'es', 'ko', 'es', 'pt-BR', 'uk', 'id'],
catalogs: [
{
path: '<rootDir>/src/locale/locales/{locale}/messages',
Expand Down
1 change: 1 addition & 0 deletions src/locale/__tests__/helpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ test('sanitizeAppLanguageSetting', () => {
expect(sanitizeAppLanguageSetting('en')).toBe(AppLanguage.en)
expect(sanitizeAppLanguageSetting('pt-BR')).toBe(AppLanguage.pt_BR)
expect(sanitizeAppLanguageSetting('hi')).toBe(AppLanguage.hi)
expect(sanitizeAppLanguageSetting('id')).toBe(AppLanguage.id)
expect(sanitizeAppLanguageSetting('foo')).toBe(AppLanguage.en)
expect(sanitizeAppLanguageSetting('en,foo')).toBe(AppLanguage.en)
expect(sanitizeAppLanguageSetting('foo,en')).toBe(AppLanguage.en)
Expand Down
4 changes: 2 additions & 2 deletions src/locale/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ export function sanitizeAppLanguageSetting(appLanguage: string): AppLanguage {
// DISABLED until this translation is fixed -prf
// case 'de':
// return AppLanguage.de
// DISABLED until this translation is more thoroughly reviewed -prf
case 'id':
return AppLanguage.id
case 'es':
return AppLanguage.es
case 'fr':
Expand All @@ -132,6 +133,5 @@ export function sanitizeAppLanguageSetting(appLanguage: string): AppLanguage {
continue
}
}

return AppLanguage.en
}
5 changes: 5 additions & 0 deletions src/locale/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {useLanguagePrefs} from '#/state/preferences'
import {messages as messagesEn} from '#/locale/locales/en/messages'
// DISABLED until this translation is fixed -prf
// import {messages as messagesDe} from '#/locale/locales/de/messages'
import {messages as messagesId} from '#/locale/locales/id/messages'
import {messages as messagesEs} from '#/locale/locales/es/messages'
import {messages as messagesFr} from '#/locale/locales/fr/messages'
import {messages as messagesHi} from '#/locale/locales/hi/messages'
Expand All @@ -26,6 +27,10 @@ export async function dynamicActivate(locale: AppLanguage) {
// i18n.loadAndActivate({locale, messages: messagesDe})
// break
// }
case AppLanguage.id: {
i18n.loadAndActivate({locale, messages: messagesId})
break
}
case AppLanguage.es: {
i18n.loadAndActivate({locale, messages: messagesEs})
break
Expand Down
4 changes: 4 additions & 0 deletions src/locale/i18n.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ export async function dynamicActivate(locale: AppLanguage) {
// mod = await import(`./locales/de/messages`)
// break
// }
case AppLanguage.id: {
mod = await import(`./locales/id/messages`)
break
}
case AppLanguage.es: {
mod = await import(`./locales/es/messages`)
break
Expand Down
2 changes: 2 additions & 0 deletions src/locale/languages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export enum AppLanguage {
en = 'en',
// DISABLED until this translation is fixed -prf
// de = 'de',
id = 'id',
es = 'es',
fr = 'fr',
hi = 'hi',
Expand All @@ -26,6 +27,7 @@ export const APP_LANGUAGES: AppLanguageConfig[] = [
{code2: AppLanguage.en, name: 'English'},
// DISABLED until this translation is fixed -prf
// {code2: AppLanguage.de, name: 'Deutsch'},
{code2: AppLanguage.id, name: 'Indonesian'},
{code2: AppLanguage.es, name: 'Español'},
{code2: AppLanguage.fr, name: 'Français'},
{code2: AppLanguage.hi, name: 'हिंदी'},
Expand Down
Loading

0 comments on commit d7f4e13

Please sign in to comment.