Installing new languages

Introduction

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').

Which other languages are supported out of the box?

  • Catalan
  • Chinese (Simplified)
  • Chinese (Traditional)
  • Danish
  • German
  • Japanese
  • Hungarian
  • Korean
  • Polish
  • Portuguese (Brazilian)
  • Russian
  • Spanish
  • Swedish
  • Turkish

How to install new languages?

In order to install new languages, just type:

yo jhipster:languages

How to create a new language that is not supported?

All languages are saved in the folder /src/main/webapp/i18n

Here are the steps to install a new language called new_lang:

  1. Duplicate the /src/main/webapp/i18/en folder to /src/main/webapp/i18/new_lang
  2. Translate all files under the folder /src/main/webapp/i18/new_lang
  3. Update 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
    ]
            
          

The new language new_lang is now available in the language menu.