public interface CommonI18NService
CountryModel,
CurrencyModel, LanguageModel.| Modifier and Type | Method and Description |
|---|---|
double |
convertAndRoundCurrency(double sourceFactor,
double targetFactor,
int digits,
double value)
Converts a (price) value of this currency into a value for the specified target currency and rounds the result
according to the target currency's digits.
|
double |
convertCurrency(double sourceFactor,
double targetFactor,
double value)
Used to converts a numeric price value from one currency to another.
|
List<CountryModel> |
getAllCountries()
Return a set of all CountryModels.
|
List<CurrencyModel> |
getAllCurrencies()
Return a set of all
CurrencyModel. |
List<LanguageModel> |
getAllLanguages()
Gets all languages.
|
List<RegionModel> |
getAllRegions()
Return a set of all RegionModel.
|
CurrencyModel |
getBaseCurrency()
Returns the base currency (
CurrencyModel.getBase()) of this system or null if no base
currency is set. |
CountryModel |
getCountry(String isocode)
Returns a country by its isocode.
|
CurrencyModel |
getCurrency(String code)
Returns a currency by its code.
|
CurrencyModel |
getCurrentCurrency()
Gets session currency.
|
LanguageModel |
getCurrentLanguage()
Gets current session language.
|
LanguageModel |
getLanguage(String isocode)
Gets the language for the given isocode.
|
Locale |
getLocaleForIsoCode(String isoCode)
Returns a
Locale for ISO code. |
Locale |
getLocaleForLanguage(LanguageModel languageModel)
Returns a
Locale according language (ISO code), country (ISO code) and vendor id. |
RegionModel |
getRegion(CountryModel model,
String code)
Returns a region by its isocode within the country.
|
double |
roundCurrency(double value,
int digits)
Rounds a price value according to this currency's number of digits.
|
void |
setCurrentCurrency(CurrencyModel currency)
Sets the current currency to the session.
|
void |
setCurrentLanguage(LanguageModel language)
Sets the current language to the session.
|
Locale getLocaleForLanguage(LanguageModel languageModel)
Locale according language (ISO code), country (ISO code) and vendor id. The three parameters are
passed as a isocode of the LanguageModel instance. Supported delimiters are: _ , . ;
LanguageModel languageModel = new LanguageModel();
languageModel.setIsocode("de_DE_WIN");
getLocaleForLanguage(languageModel);
languageModel.setIsocode("en,AT,");
getLocaleForLanguage(languageModel);
LanguageModel getLanguage(String isocode)
isocode - the isocode a language is searched forUnknownIdentifierException - if the language with given isocode is not foundList<LanguageModel> getAllLanguages()
LanguageModel getCurrentLanguage()
void setCurrentLanguage(LanguageModel language)
language - the new languageCountryModel getCountry(String isocode)
isocode - the isocodeUnknownIdentifierException - in case no country can be foundList<CountryModel> getAllCountries()
RegionModel getRegion(CountryModel model, String code)
model - the country modelcode - the region codeUnknownIdentifierException - in case no country can be foundList<RegionModel> getAllRegions()
CurrencyModel getCurrency(String code)
code - the codeUnknownIdentifierException - in case no currency can be foundvoid setCurrentCurrency(CurrencyModel currency)
currency - the new currencyCurrencyModel getCurrentCurrency()
null if not setCurrencyModel getBaseCurrency()
CurrencyModel.getBase()) of this system or null if no base
currency is set. There should be always one such Currency in the hybris Platform. The base currency
should be the most likely-to-us currency.CurrencyModel or null if no base currency is setList<CurrencyModel> getAllCurrencies()
CurrencyModel.double convertAndRoundCurrency(double sourceFactor,
double targetFactor,
int digits,
double value)
sourceFactor - the conversionFactor of the source currencytargetFactor - the conversionFactor of the target currencydigits - currency's number of digitsvalue - the value which should be converteddouble convertCurrency(double sourceFactor,
double targetFactor,
double value)
roundCurrency(double,int) to achieve this, or just use
convertAndRoundCurrency(double, double, int, double) sourceFactor - the conversionFactor of the source currencytargetFactor - the conversionFactor of the target currencyvalue - the source valuedouble roundCurrency(double value,
int digits)
value - the currency value which should be rounded.digits - currency's number of digitsCopyright © 2017 SAP SE. All Rights Reserved.