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.
|
java.util.List<CountryModel> |
getAllCountries()
Return a set of all CountryModels.
|
java.util.List<CurrencyModel> |
getAllCurrencies()
Return a set of all
CurrencyModel . |
java.util.List<LanguageModel> |
getAllLanguages()
Gets all languages.
|
java.util.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(java.lang.String isocode)
Returns a country by its isocode.
|
CurrencyModel |
getCurrency(java.lang.String code)
Returns a currency by its code.
|
CurrencyModel |
getCurrentCurrency()
Gets session currency.
|
LanguageModel |
getCurrentLanguage()
Gets current session language.
|
LanguageModel |
getLanguage(java.lang.String isocode)
Gets the language for the given isocode.
|
java.util.Locale |
getLocaleForIsoCode(java.lang.String isoCode)
Returns a
Locale for ISO code. |
java.util.Locale |
getLocaleForLanguage(LanguageModel languageModel)
Returns a
Locale according language (ISO code), country (ISO code) and vendor id. |
RegionModel |
getRegion(CountryModel model,
java.lang.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.
|
java.util.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);
java.util.Locale getLocaleForIsoCode(java.lang.String isoCode)
Locale
for ISO code.LanguageModel getLanguage(java.lang.String isocode)
isocode
- the isocode a language is searched forUnknownIdentifierException
- if the language with given isocode is not foundjava.util.List<LanguageModel> getAllLanguages()
LanguageModel getCurrentLanguage()
void setCurrentLanguage(LanguageModel language)
language
- the new languageCountryModel getCountry(java.lang.String isocode)
isocode
- the isocodeUnknownIdentifierException
- in case no country can be foundjava.util.List<CountryModel> getAllCountries()
RegionModel getRegion(CountryModel model, java.lang.String code)
model
- the country modelcode
- the region codeUnknownIdentifierException
- in case no country can be foundjava.util.List<RegionModel> getAllRegions()
CurrencyModel getCurrency(java.lang.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 setjava.util.List<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 © 2018 SAP SE. All Rights Reserved.