diff --git a/docs/source/translations.rst b/docs/source/translations.rst index 4486e9feb..6a2680d63 100644 --- a/docs/source/translations.rst +++ b/docs/source/translations.rst @@ -104,8 +104,8 @@ To do this for ALL languages, run: The resulting `.po` file is then what gets translated. -Generating a JavaScript file from a translations file ------------------------------------------------------ +Generating a JSON file from a translations file +----------------------------------------------- Unfortunately `Jed `_, which we use for translations in converse.js cannot use the `.po` files directly. We have @@ -136,3 +136,29 @@ To do this for ALL languages, run: If you are adding translations for a new language that is not already supported, you'll have to add the language path in main.js and make one more edit in ./src/locales.js to make sure the language is loaded by require.js. + + +Making sure the JSON file will get loaded +------------------------------------------ + +Finally, make sure that the language code is added to the list of default +values for the ``locales`` config setting. + +This is done in ``src/converse-core.js``. + +Look for the following section: + +.. code-block:: javascript + + // Default configuration values + // ---------------------------- + this.default_settings = { + // ... Omitted for brevity + locales_url: 'locale/{{{locale}}}/LC_MESSAGES/converse.json', + locales: [ + 'af', 'ar', 'bg', 'ca', 'de', 'es', 'en', 'fr', 'he', + 'hu', 'id', 'it', 'ja', 'nb', 'nl', + 'pl', 'pt_BR', 'ru', 'tr', 'uk', 'zh_CN', 'zh_TW' + ], + // ... Omitted for brevity + }; diff --git a/src/converse-core.js b/src/converse-core.js index ae44cd810..f29a0198c 100644 --- a/src/converse-core.js +++ b/src/converse-core.js @@ -312,7 +312,7 @@ keepalive: true, locales_url: 'locale/{{{locale}}}/LC_MESSAGES/converse.json', locales: [ - 'af', 'bg', 'ca', 'de', 'es', 'en', 'fr', 'he', + 'af', 'ar', 'bg', 'ca', 'de', 'es', 'eu', 'en', 'fr', 'he', 'hu', 'id', 'it', 'ja', 'nb', 'nl', 'pl', 'pt_BR', 'ru', 'tr', 'uk', 'zh_CN', 'zh_TW' ], diff --git a/src/i18n.js b/src/i18n.js index a741f483a..b570537a5 100644 --- a/src/i18n.js +++ b/src/i18n.js @@ -15,10 +15,12 @@ "lodash.noconflict", "moment", 'moment/locale/af', + 'moment/locale/ar', 'moment/locale/bg', 'moment/locale/ca', 'moment/locale/de', 'moment/locale/es', + 'moment/locale/eu', 'moment/locale/fr', 'moment/locale/he', 'moment/locale/hu',