diff --git a/pages/installing_new_languages.html b/pages/installing_new_languages.html index 3600788463..7e511c30e8 100644 --- a/pages/installing_new_languages.html +++ b/pages/installing_new_languages.html @@ -9,23 +9,24 @@ lastmod: 2014-12-10T00:00:00-00:00 --- -
- During the generation of a new project, JHipster only installs English and French languages. However, JHipster supports more languages that can be installed using this sub-generator. + During the generation of a new project you will be asked whether or not you want to enable internationalization support.
- The default language in JHipster is English, but this can be changed in the src/main/webapp/scripts/app/app.js, by modifying the following code:
+ If enabling it you will need to select the native language of your application.
+ After that you can choose the additional languages you would like to install.
+ If you don't want to support any additional languages from start you can always add languages later when needed by running the language sub-generator.
- $translateProvider.preferredLanguage('en');
- (using your preferred language's code instead of 'en').
+ If you are sure you will never translate this application into another language you should not enable the internationalization.
By default we provide French and English, but you can add many more languages:
+These are the currently supported languages
Does JHipster not support your language? Please help us with a PR!
- In order to install new languages, just type: + To do this you can run the languages sub-generator with:
+ Note that you will need to regenerate your entities if you would like to have them translated in the language you just added.
+
- All languages are saved in the folder
Here are the steps to install a new language called Update the Add the languege code Add the new language's name in the function of If the messageformat locale file exits in previous step add the file in If the messageformat locale file does not exits in the previous step include the file manually in
@@ -65,45 +69,88 @@ How to install new languages?
How to create a new language that is not supported?
+How to add a new language that is not supported?
/src/main/webapp/i18n
+ All languages are saved in the folder src/main/webapp/i18n (client side) and src/main/resources/i18n (server side)
new_lang:
-
/src/main/webapp/i18/en folder to /src/main/webapp/i18/new_lang: this where all the front-end translations are stored /src/main/webapp/i18/new_langsrc/main/webapp/i18/en folder to src/main/webapp/i18/new_lang (this is where all the front-end translations are stored)src/main/webapp/i18/new_langLANGUAGES constant defined in the folder src/main/webapp/components/language/language.service.js
-
to add the new language new_lang
-
+
-.constant('LANGUAGES', [
- 'en', 'fr', 'new_lang'
- //JHipster will add new languages here
-]
-
- new_lang to the LANGUAGES constant defined in src/main/webapp/app/components/language/language.constants.js
+ .constant('LANGUAGES', [
+ 'en',
+ 'fr',
+ 'new_lang'
+ // jhipster-needle-i18n-language-constant - JHipster will add/remove languages in this array
+]src/main/resources/i18n folder, copy the messages_en.properties file to messages_new_lang.properties: this where the server-side translations are storedsrc/main/resources/i18n folder, copy the messages_en.properties file to messages_new_lang.properties (this is where the server-side translations are stored)messages_new_lang.properties filefilter('findLanguageFromKey') in the src/main/webapp/scripts/components/language/language.controller.js filesrc/main/webapp/bower_components/messageformat/locale, you may need to create it. More info in [Angular translate](http://angular-translate.github.io/docs/#/guide/14_pluralization) and [MessageFormat](https://github.com/SlexAxton/messageformat.js)src/main/webapp/index.htmlfilter('findLanguageFromKey') in the src/main/webapp/app/components/language/language.filter.js file
+ function findLanguageFromKeyFilter(lang) {
+ return {
+ 'ca': 'Català',
+ 'da': 'Dansk',
+ 'de': 'Deutsch',
+ 'en': 'English',
+ 'es': 'Español',
+ 'fr': 'Français',
+ 'gl': 'Galego',
+ 'hu': 'Magyar',
+ 'it': 'Italiano',
+ 'ja': '日本語',
+ 'ko': '한국어',
+ 'nl': 'Nederlands',
+ 'pl': 'Polski',
+ 'pt-br': 'Português (Brasil)',
+ 'pt-pt': 'Português',
+ 'ro': 'Română',
+ 'ru': 'Русский',
+ 'sv': 'Svenska',
+ 'ta': 'தமிழ்',
+ 'tr': 'Türkçe',
+ 'zh-cn': '中文(简体)',
+ 'zh-tw': '繁體中文',
+ 'new_lang': 'New Lang'
+ }[lang];
+}src/main/webapp/bower_components/messageformat/locale you need to create it.
+ More info in Angular translate
+ and MessageFormatbower.json
+ "messageformat": {
+ "main": [
+ "messageformat.js",
+ "locale/en.js",
+ "locale/fr.js",
+ "locale/new_lang.js"
+ ]
+}src/main/webapp/index.html
- The new language new_lang is now available in the language menu, and is available both in the front-end AngularJS application and in the back-end Spring application.
+ The new language new_lang is now available in the language menu, and it is available both in the front-end AngularJS application and in the back-end Spring application.
Here are the steps to remove a language called old_lang:
/src/main/webapp/i18/old_langsrc/main/webapp/scripts/components/language/language.service.jssrc/main/webapp/i18/old_langsrc/main/webapp/app/components/language/language.constants.jssrc/main/resources/i18n/messages_old_lang.properties file