Gorayni
Gorayni

Reputation: 616

Where can I define the default i18n language in JHipster?

I am new to JHipster and I would like to where can I define the default i18n language in JHipster? Is it in a Java Configuration class, in Spring-Boot yaml file, or in Javascript file?

Upvotes: 5

Views: 4481

Answers (6)

Renan Franca
Renan Franca

Reputation: 3541

And for JHipster 7.2.0 it's in src/main/webapp/app/app.module.ts under:

translateService.setDefaultLang('en');
// if user have changed language and navigates away from the application and back to the application then use previously choosed language;
const langKey = sessionStorageService.retrieve('locale') ?? 'en';

Upvotes: 1

Oussama Werfelli
Oussama Werfelli

Reputation: 513

For jhipster 6.5.1 you should edit defaultI18nLang in /src/main/webapp/app/core/core.module.ts, for example defaultI18nLang: 'ar-ly'

Upvotes: 0

Marin Shalamanov
Marin Shalamanov

Reputation: 746

And for JHipster 5.7.2 it's in src/main/webapp/app/app.module.ts under defaultI18nLang.

Upvotes: 6

allkenang
allkenang

Reputation: 1645

For jhipster: 4.12.0

Angular: 5

It's in this file: src/main/webapp/app/shared/shared-libs.module.ts under the property "defaultI18nLang"

Upvotes: 3

Robin
Robin

Reputation: 359

In the newer version of Jhipster (v 3.0.0 - the one I've been using), you will need to change two places:

  • src/main/webapp/app/blocks/config/translation.config.js: change the line $translateProvider.preferredLanguage('en'); with your preferred language key (e.g. 'en' -> 'fr');
  • src/main/webapp/app/blocks/config/translation-storage.provider.js: change the line $cookies.putObject(name, 'en'); with your preferred language key as well.

Upvotes: 3

Jean Montague
Jean Montague

Reputation: 116

You can set the language you like in the weapp/scripts/app.js file by changing the preferred language line, for instance $translateProvider.preferredLanguage('fr');changes the language to french.

Upvotes: 7

Related Questions