Multi Language Settings
You will get three in-build language English, German &
Spanish
integration with template. You can add more as per your
requirements.
Add new Language
For e.g. we are going to add new language Russian in template.
1. First of all you have to create a json file ru.json
file in
src/assets/i18n
directory. You can see other json file for reference.
2. Now add new language entry in language array in
src/app/core/services/language.service.ts
public languages: string[] = ['en', 'es', 'de', 'ru'];
translate.use(browserLang.match(/en|es|de|ru/) ? browserLang : 'en');
3. Now add new language in header dropdown menu, for that go to
layout/header/header.component.ts
file and add new entry for Russian
language
listLang = [
{ text: 'English', flag: 'assets/images/flags/us.jpg', lang: 'en' },
{ text: 'Spanish', flag: 'assets/images/flags/spain.jpg', lang: 'es' },
{ text: 'German', flag: 'assets/images/flags/germany.jpg', lang: 'de' },
{ text: 'Russian', flag: 'assets/images/flags/russian.jpg', lang: 'ru' },
];
Add Rusian flag image russian.jpg in images/flags
directory.