public class StringToLocalizedStringConverter extends Object implements org.springframework.core.convert.converter.Converter<String,LocalizedString>
The strings being converted MUST start with the language identifier followed by a hyphen. For example, the string
"en-Hello" will be translated to the localized string "Hello" in English. If no language indicator is given, a
LocalizedString
with no language tag will be created.
Constructor and Description |
---|
StringToLocalizedStringConverter() |
Modifier and Type | Method and Description |
---|---|
LocalizedString |
convert(String source)
Converts strings on the format
<lang-tag>-<string according to language> . |
public LocalizedString convert(String source)
<lang-tag>-<string according to language>
. The string "en-Hello" will give a
LocalizedString where:
ls.getLanguage() => "en"
ls.getLocalString() => "Hello"
convert
in interface org.springframework.core.convert.converter.Converter<String,LocalizedString>
Copyright © 2018 Litsec AB. All rights reserved.