Skip to content

Hybris : language model not found

Let’s assume we create a new languageModel in hybris vi_VN, using this impex:

INSERT_UPDATE Language; isocode[unique = true]; name[lang = en]; fallbacklanguages (isocode); active[default = true];
                      ; vi_VN                 ;  Vietnam       ; en                         ;                       ;

When the user selects the vi_VN language from the website, we use commonI18NService to get the current locale:

final Locale locale = commonI18NService.getLocaleForLanguage(language); // language isocode is "vi_VN"

So when the language is vi_VN (isocode = vi_VN“), the following line locale.getLanguage() returns vi and not vi_VN

My question is when creating a new composed languageModel like xx_XX should we also create the languageModel xx?

Answer

vi_VN has two parts: the first part is the language code and the second part is the country code.

In order to get the country code, you need to use CommonI18NService#getCountry.