Japanese localization (#2003)

* 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 <jake@blueskyweb.xyz>
Co-authored-by: Eric Bailey <git@esb.lol>
zio/stable
Ansh 2023-12-13 01:12:19 +05:30 committed by GitHub
parent 27561ae79f
commit 90647fe7cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 2430 additions and 15 deletions

View File

@ -1,6 +1,6 @@
/** @type {import('@lingui/conf').LinguiConfig} */ /** @type {import('@lingui/conf').LinguiConfig} */
module.exports = { module.exports = {
locales: ['en', 'hi'], locales: ['en', 'hi', 'ja'],
catalogs: [ catalogs: [
{ {
path: '<rootDir>/src/locale/locales/{locale}/messages', path: '<rootDir>/src/locale/locales/{locale}/messages',

View File

@ -112,6 +112,8 @@ export function sanitizeAppLanguageSetting(appLanguage: string): AppLanguage {
return AppLanguage.en return AppLanguage.en
case 'hi': case 'hi':
return AppLanguage.hi return AppLanguage.hi
case 'ja':
return AppLanguage.ja
default: default:
continue continue
} }

View File

@ -4,6 +4,7 @@ import {i18n} from '@lingui/core'
import {useLanguagePrefs} from '#/state/preferences' import {useLanguagePrefs} from '#/state/preferences'
import {messages as messagesEn} from '#/locale/locales/en/messages' import {messages as messagesEn} from '#/locale/locales/en/messages'
import {messages as messagesHi} from '#/locale/locales/hi/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 {sanitizeAppLanguageSetting} from '#/locale/helpers'
import {AppLanguage} from '#/locale/languages' import {AppLanguage} from '#/locale/languages'
@ -16,6 +17,10 @@ export async function dynamicActivate(locale: AppLanguage) {
i18n.loadAndActivate({locale, messages: messagesHi}) i18n.loadAndActivate({locale, messages: messagesHi})
break break
} }
case AppLanguage.ja: {
i18n.loadAndActivate({locale, messages: messagesJa})
break
}
default: { default: {
i18n.loadAndActivate({locale, messages: messagesEn}) i18n.loadAndActivate({locale, messages: messagesEn})
break break

View File

@ -16,6 +16,10 @@ export async function dynamicActivate(locale: AppLanguage) {
mod = await import(`./locales/hi/messages`) mod = await import(`./locales/hi/messages`)
break break
} }
case AppLanguage.ja: {
mod = await import(`./locales/ja/messages`)
break
}
default: { default: {
mod = await import(`./locales/en/messages`) mod = await import(`./locales/en/messages`)
break break

View File

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

View File

@ -188,7 +188,7 @@ msgstr ""
msgid "and" msgid "and"
msgstr "" msgstr ""
#: src/view/screens/LanguageSettings.tsx:94 #: src/view/screens/LanguageSettings.tsx:95
msgid "App Language" msgid "App Language"
msgstr "" msgstr ""
@ -547,7 +547,7 @@ msgid "Content Filtering"
msgstr "" msgstr ""
#: src/view/com/modals/lang-settings/ContentLanguagesSettings.tsx:74 #: src/view/com/modals/lang-settings/ContentLanguagesSettings.tsx:74
#: src/view/screens/LanguageSettings.tsx:277 #: src/view/screens/LanguageSettings.tsx:278
msgid "Content Languages" msgid "Content Languages"
msgstr "" msgstr ""
@ -1099,7 +1099,7 @@ msgstr ""
msgid "Language selection" msgid "Language selection"
msgstr "" msgstr ""
#: src/view/screens/LanguageSettings.tsx:88 #: src/view/screens/LanguageSettings.tsx:89
msgid "Language Settings" msgid "Language Settings"
msgstr "" msgstr ""
@ -1603,7 +1603,7 @@ msgstr ""
msgid "Previous image" msgid "Previous image"
msgstr "" msgstr ""
#: src/view/screens/LanguageSettings.tsx:186 #: src/view/screens/LanguageSettings.tsx:187
msgid "Primary Language" msgid "Primary Language"
msgstr "" msgstr ""
@ -1886,15 +1886,15 @@ msgstr ""
msgid "Select service" msgid "Select service"
msgstr "" 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." msgid "Select which languages you want your subscribed feeds to include. If none are selected, all languages will be shown."
msgstr "" 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" msgid "Select your app language for the default text to display in the app"
msgstr "" msgstr ""
#: src/view/screens/LanguageSettings.tsx:189 #: src/view/screens/LanguageSettings.tsx:190
msgid "Select your preferred language for translations in your feed." msgid "Select your preferred language for translations in your feed."
msgstr "" msgstr ""

View File

@ -188,7 +188,7 @@ msgstr "{0} को ईमेल भेजा गया है। इसमें
msgid "and" msgid "and"
msgstr "और" msgstr "और"
#: src/view/screens/LanguageSettings.tsx:94 #: src/view/screens/LanguageSettings.tsx:95
msgid "App Language" msgid "App Language"
msgstr "ऐप भाषा" msgstr "ऐप भाषा"
@ -543,7 +543,7 @@ msgid "Content Filtering"
msgstr "सामग्री फ़िल्टरिंग" msgstr "सामग्री फ़िल्टरिंग"
#: src/view/com/modals/lang-settings/ContentLanguagesSettings.tsx:74 #: src/view/com/modals/lang-settings/ContentLanguagesSettings.tsx:74
#: src/view/screens/LanguageSettings.tsx:277 #: src/view/screens/LanguageSettings.tsx:278
msgid "Content Languages" msgid "Content Languages"
msgstr "सामग्री भाषा" msgstr "सामग्री भाषा"
@ -1091,7 +1091,7 @@ msgstr "वेटरलिस्ट में शामिल हों"
msgid "Language selection" msgid "Language selection"
msgstr "अपनी भाषा चुने" msgstr "अपनी भाषा चुने"
#: src/view/screens/LanguageSettings.tsx:88 #: src/view/screens/LanguageSettings.tsx:89
msgid "Language Settings" msgid "Language Settings"
msgstr "भाषा सेटिंग्स" msgstr "भाषा सेटिंग्स"
@ -1595,7 +1595,7 @@ msgstr "शायद एक भ्रामक लिंक"
msgid "Previous image" msgid "Previous image"
msgstr "पिछली छवि" msgstr "पिछली छवि"
#: src/view/screens/LanguageSettings.tsx:186 #: src/view/screens/LanguageSettings.tsx:187
msgid "Primary Language" msgid "Primary Language"
msgstr "प्राथमिक भाषा" msgstr "प्राथमिक भाषा"
@ -1878,15 +1878,15 @@ msgstr "मौजूदा खाते से चुनें"
msgid "Select service" msgid "Select service"
msgstr "सेवा चुनें" 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." msgid "Select which languages you want your subscribed feeds to include. If none are selected, all languages will be shown."
msgstr "चुनें कि आप अपनी सदस्यता वाली फ़ीड में कौन सी भाषाएँ शामिल करना चाहते हैं। यदि कोई भी चयनित नहीं है, तो सभी भाषाएँ दिखाई जाएंगी।" 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" msgid "Select your app language for the default text to display in the app"
msgstr "ऐप में प्रदर्शित होने वाले डिफ़ॉल्ट टेक्स्ट के लिए अपनी ऐप भाषा चुनें" msgstr "ऐप में प्रदर्शित होने वाले डिफ़ॉल्ट टेक्स्ट के लिए अपनी ऐप भाषा चुनें"
#: src/view/screens/LanguageSettings.tsx:189 #: src/view/screens/LanguageSettings.tsx:190
msgid "Select your preferred language for translations in your feed." msgid "Select your preferred language for translations in your feed."
msgstr "अपने फ़ीड में अनुवाद के लिए अपनी पसंदीदा भाषा चुनें।" msgstr "अपने फ़ीड में अनुवाद के लिए अपनी पसंदीदा भाषा चुनें।"

File diff suppressed because it is too large Load Diff