Package nl.rrd.wool.i18n
Class WoolTranslationParser
- java.lang.Object
-
- nl.rrd.wool.i18n.WoolTranslationParser
-
public class WoolTranslationParser extends Object
This class can parse a WOOL translation file. The file should contain a JSON object with key-value pairs as exported by POEditor. There are two types of key-value pairs:- Key and value are strings. The key is a translatable in one language,
and the value is a translatable in another language. A translatable should be
the string representation of a
WoolTranslatable. That is a text that may include variables and <<input>> commands. - The key is a string the value is a JSON object. In this case the key is a context string, and the value contains translatable key-value pairs.
This parser ignores context strings and returns a flat map of translatables. This means that it does not support different translations of the same string with different contexts.
- Key and value are strings. The key is a translatable in one language,
and the value is a translatable in another language. A translatable should be
the string representation of a
-
-
Constructor Summary
Constructors Constructor Description WoolTranslationParser()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static WoolTranslationParserResultparse(File file)static WoolTranslationParserResultparse(InputStream input)static WoolTranslationParserResultparse(Reader reader)static WoolTranslationParserResultparse(URL url)
-
-
-
Method Detail
-
parse
public static WoolTranslationParserResult parse(URL url) throws IOException
- Throws:
IOException
-
parse
public static WoolTranslationParserResult parse(File file) throws IOException
- Throws:
IOException
-
parse
public static WoolTranslationParserResult parse(InputStream input) throws IOException
- Throws:
IOException
-
parse
public static WoolTranslationParserResult parse(Reader reader) throws IOException
- Throws:
IOException
-
-