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.
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:
$translateProvider.preferredLanguage('en');
(using your preferred language's code instead of 'en').
In order to install new languages, just type:
yo jhipster:languages
All languages are saved in the folder /src/main/webapp/i18n
Here are the steps to install a new language called 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_langUpdate the LANGUAGES 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
]
src/main/resources/i18n folder, copy the messages_en.properties file to messages_new_lang.properties: this where the server-side translations are storedmessages_new_lang.properties file
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.
Here are the steps to remove a language called old_lang:
/src/main/webapp/i18/old_langsrc/main/webapp/components/language/language.service.jssrc/main/resources/i18n/messages_old_lang.properties file