During the generation of a new project you will be asked whether or not you want to enable internationalization support.
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.
If you are sure you will never translate this application into another language you should not enable the internationalization.
These are the currently supported languages
Does JHipster not support your language? Please help us with a PR!
To do this you can run the languages sub-generator with:
yo jhipster:languages
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 src/main/webapp/i18n (client side) and src/main/resources/i18n (server side)
src/main/webapp/i18n
src/main/resources/i18n
Here are the steps to install a new language called new_lang:
new_lang
src/main/webapp/i18/en
src/main/webapp/i18/new_lang
Add the languege code new_lang to the LANGUAGES constant defined in src/main/webapp/app/components/language/language.constants.js
LANGUAGES
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 ]
messages_en.properties
messages_new_lang.properties
Add the new language's name in the function of filter('findLanguageFromKey') in the src/main/webapp/app/components/language/language.filter.js file
filter('findLanguageFromKey')
src/main/webapp/app/components/language/language.filter.js
function findLanguageFromKeyFilter(lang) { return { 'ca': 'Català', 'da': 'Dansk', 'de': 'Deutsch', 'el': 'Ελληνικά', 'en': 'English', 'es': 'Español', 'fr': 'Français', 'gl': 'Galego', 'hu': 'Magyar', 'hi': 'हिंदी', 'it': 'Italiano', 'ja': '日本語', 'ko': '한국어', 'mr': 'मराठी', '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': '繁體中文' }[lang]; }
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:
old_lang
src/main/webapp/i18/old_lang
src/main/resources/i18n/messages_old_lang.properties