Locale is a combination of country and language and is very useful when creating a commerce site for multiple countries as it helps define globalized cultural attributes for various features address, number formatting, currency formatting, character classification, date\time formatting.etc.
Using in JSP with fmt tag:
fmt:setLocale value="${CommandContext.locale}" />
If you are using fmt for number formatting\date time formatting. Can set the locale from command context.
e.g. locale="en_US";
If you need a snippet to create a locale from language and country:
String language=locale.substring(0, locale.indexOf(LOCALE_SEPERATOR));
String country=locale.substring(locale.indexOf(LOCALE_SEPERATOR)+1,locale.length());
Locale localeObj = new Locale(language, country);
LangPair:
This is very useful when supporting a multi-language sites. All the relations for a particular Storetntity e.g. CATENTDESC, if does not have an entry for all the SKU descriptions, for the language in context. It would fall back to the default language in the langpair.
e.g.:
insert into langpair values (20120, -2, -1, 0, null);
Using in JSP with fmt tag:
fmt:setLocale value="${CommandContext.locale}" />
If you are using fmt for number formatting\date time formatting. Can set the locale from command context.
e.g. locale="en_US";
If you need a snippet to create a locale from language and country:
String language=locale.substring(0, locale.indexOf(LOCALE_SEPERATOR));
String country=locale.substring(locale.indexOf(LOCALE_SEPERATOR)+1,locale.length());
Locale localeObj = new Locale(language, country);
LangPair:
This is very useful when supporting a multi-language sites. All the relations for a particular Storetntity e.g. CATENTDESC, if does not have an entry for all the SKU descriptions, for the language in context. It would fall back to the default language in the langpair.
e.g.:
insert into langpair values (20120, -2, -1, 0, null);
No comments:
Post a Comment