Package de.tsl2.nano.util
Class Translator
java.lang.Object
de.tsl2.nano.util.Translator
machine translator using a REST service from WorldLingo.
- Author:
- Tom
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final Stringstatic Maptranslates all property values from srcLang to destLang.static PropertiestranslateProperties(String name, Map origin, Locale srcLang, Locale destLang) translates all property values from srcLang to destLang. splits camel case expressions.static MaptranslatePropertiesFast(String name, Map origin, Locale srcLang, Locale destLang) tries to translate all properties on one request. if values have more than one word (myEntry=one two), the mapping will fail
-
Constructor Details
-
Translator
public Translator()
-
-
Method Details
-
translate
-
translateProperties
public static Properties translateProperties(String name, Map origin, Locale srcLang, Locale destLang) translates all property values from srcLang to destLang. splits camel case expressions.- Parameters:
name- bundle nameorigin- properties to translatesrcLang- source languagedestLang- destination language- Returns:
- translated properties
-
translatePropertiesFast
tries to translate all properties on one request. if values have more than one word (myEntry=one two), the mapping will fail- Parameters:
name- bundle nameorigin- properties to translatesrcLang- source languagedestLang- destination language- Returns:
- translated properties
-
translateBundle
translates all property values from srcLang to destLang. Uses theResourceBundlewrapperMessagesto get the values for the given keys. splits camel case expressions. writes the bundle to a file and reloads the resource bundles.- Parameters:
name- bundle namekeySet- key-set of a resource bundle.srcLang- source languagedestLang- destination language- Returns:
- translated properties
-