Skip to content

Commit

Permalink
Japanese localization (#2003)
Browse files Browse the repository at this point in the history
* add japanese to list of languages

* add japanese translations

* change `jp` to `ja`

* minor changes to Japanese translation

* minor changes to Japanese translation

* update japanese strings with feedback

* Update languages.ts

* Extract translations

* Gitignore new compiled file

* allow switching to japanese

---------

Co-authored-by: Jake Gold <[email protected]>
Co-authored-by: Eric Bailey <[email protected]>
  • Loading branch information
3 people authored Dec 12, 2023
1 parent 27561ae commit 90647fe
Show file tree
Hide file tree
Showing 8 changed files with 2,430 additions and 15 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'],
locales: ['en', 'hi', 'ja'],
catalogs: [
{
path: '<rootDir>/src/locale/locales/{locale}/messages',
Expand Down
2 changes: 2 additions & 0 deletions src/locale/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ export function sanitizeAppLanguageSetting(appLanguage: string): AppLanguage {
return AppLanguage.en
case 'hi':
return AppLanguage.hi
case 'ja':
return AppLanguage.ja
default:
continue
}
Expand Down
5 changes: 5 additions & 0 deletions src/locale/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {i18n} from '@lingui/core'
import {useLanguagePrefs} from '#/state/preferences'
import {messages as messagesEn} from '#/locale/locales/en/messages'
import {messages as messagesHi} from '#/locale/locales/hi/messages'
import {messages as messagesJa} from '#/locale/locales/ja/messages'
import {sanitizeAppLanguageSetting} from '#/locale/helpers'
import {AppLanguage} from '#/locale/languages'

Expand All @@ -16,6 +17,10 @@ export async function dynamicActivate(locale: AppLanguage) {
i18n.loadAndActivate({locale, messages: messagesHi})
break
}
case AppLanguage.ja: {
i18n.loadAndActivate({locale, messages: messagesJa})
break
}
default: {
i18n.loadAndActivate({locale, messages: messagesEn})
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 @@ -16,6 +16,10 @@ export async function dynamicActivate(locale: AppLanguage) {
mod = await import(`./locales/hi/messages`)
break
}
case AppLanguage.ja: {
mod = await import(`./locales/ja/messages`)
break
}
default: {
mod = await import(`./locales/en/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 @@ -7,6 +7,7 @@ interface Language {
export enum AppLanguage {
en = 'en',
hi = 'hi',
ja = 'ja',
}

interface AppLanguageConfig {
Expand All @@ -17,6 +18,7 @@ interface AppLanguageConfig {
export const APP_LANGUAGES: AppLanguageConfig[] = [
{code2: AppLanguage.en, name: 'English'},
{code2: AppLanguage.hi, name: 'हिंदी'},
{code2: AppLanguage.ja, name: '日本語'},
]

export const LANGUAGES: Language[] = [
Expand Down
14 changes: 7 additions & 7 deletions src/locale/locales/en/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ msgstr ""
msgid "and"
msgstr ""

#: src/view/screens/LanguageSettings.tsx:94
#: src/view/screens/LanguageSettings.tsx:95
msgid "App Language"
msgstr ""

Expand Down Expand Up @@ -547,7 +547,7 @@ msgid "Content Filtering"
msgstr ""

#: src/view/com/modals/lang-settings/ContentLanguagesSettings.tsx:74
#: src/view/screens/LanguageSettings.tsx:277
#: src/view/screens/LanguageSettings.tsx:278
msgid "Content Languages"
msgstr ""

Expand Down Expand Up @@ -1099,7 +1099,7 @@ msgstr ""
msgid "Language selection"
msgstr ""

#: src/view/screens/LanguageSettings.tsx:88
#: src/view/screens/LanguageSettings.tsx:89
msgid "Language Settings"
msgstr ""

Expand Down Expand Up @@ -1603,7 +1603,7 @@ msgstr ""
msgid "Previous image"
msgstr ""

#: src/view/screens/LanguageSettings.tsx:186
#: src/view/screens/LanguageSettings.tsx:187
msgid "Primary Language"
msgstr ""

Expand Down Expand Up @@ -1886,15 +1886,15 @@ msgstr ""
msgid "Select service"
msgstr ""

#: src/view/screens/LanguageSettings.tsx:280
#: src/view/screens/LanguageSettings.tsx:281
msgid "Select which languages you want your subscribed feeds to include. If none are selected, all languages will be shown."
msgstr ""

#: src/view/screens/LanguageSettings.tsx:97
#: src/view/screens/LanguageSettings.tsx:98
msgid "Select your app language for the default text to display in the app"
msgstr ""

#: src/view/screens/LanguageSettings.tsx:189
#: src/view/screens/LanguageSettings.tsx:190
msgid "Select your preferred language for translations in your feed."
msgstr ""

Expand Down
14 changes: 7 additions & 7 deletions src/locale/locales/hi/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ msgstr "{0} को ईमेल भेजा गया है। इसमें
msgid "and"
msgstr "और"

#: src/view/screens/LanguageSettings.tsx:94
#: src/view/screens/LanguageSettings.tsx:95
msgid "App Language"
msgstr "ऐप भाषा"

Expand Down Expand Up @@ -543,7 +543,7 @@ msgid "Content Filtering"
msgstr "सामग्री फ़िल्टरिंग"

#: src/view/com/modals/lang-settings/ContentLanguagesSettings.tsx:74
#: src/view/screens/LanguageSettings.tsx:277
#: src/view/screens/LanguageSettings.tsx:278
msgid "Content Languages"
msgstr "सामग्री भाषा"

Expand Down Expand Up @@ -1091,7 +1091,7 @@ msgstr "वेटरलिस्ट में शामिल हों"
msgid "Language selection"
msgstr "अपनी भाषा चुने"

#: src/view/screens/LanguageSettings.tsx:88
#: src/view/screens/LanguageSettings.tsx:89
msgid "Language Settings"
msgstr "भाषा सेटिंग्स"

Expand Down Expand Up @@ -1595,7 +1595,7 @@ msgstr "शायद एक भ्रामक लिंक"
msgid "Previous image"
msgstr "पिछली छवि"

#: src/view/screens/LanguageSettings.tsx:186
#: src/view/screens/LanguageSettings.tsx:187
msgid "Primary Language"
msgstr "प्राथमिक भाषा"

Expand Down Expand Up @@ -1878,15 +1878,15 @@ msgstr "मौजूदा खाते से चुनें"
msgid "Select service"
msgstr "सेवा चुनें"

#: src/view/screens/LanguageSettings.tsx:280
#: src/view/screens/LanguageSettings.tsx:281
msgid "Select which languages you want your subscribed feeds to include. If none are selected, all languages will be shown."
msgstr "चुनें कि आप अपनी सदस्यता वाली फ़ीड में कौन सी भाषाएँ शामिल करना चाहते हैं। यदि कोई भी चयनित नहीं है, तो सभी भाषाएँ दिखाई जाएंगी।"

#: src/view/screens/LanguageSettings.tsx:97
#: src/view/screens/LanguageSettings.tsx:98
msgid "Select your app language for the default text to display in the app"
msgstr "ऐप में प्रदर्शित होने वाले डिफ़ॉल्ट टेक्स्ट के लिए अपनी ऐप भाषा चुनें"

#: src/view/screens/LanguageSettings.tsx:189
#: src/view/screens/LanguageSettings.tsx:190
msgid "Select your preferred language for translations in your feed."
msgstr "अपने फ़ीड में अनुवाद के लिए अपनी पसंदीदा भाषा चुनें।"

Expand Down
Loading

0 comments on commit 90647fe

Please sign in to comment.