CLI Tool
CLI Information
- Current Version:
- Minimum Java:
17
The i18n generator CLI tool allows you to generate translations classes on the command-line, existing as a standalone JAR file. You can download and use it to generate translation classes whenever you can't use the Gradle plugin, including writing your own plugins for other build tools.
We plan to provide launch scripts and better support for extra formats later.
Usage
To get and use the CLI tool:
- Download and install a compatible version of Java, as listed above.
- Download the tool using the button above.
- Run the tool:
Required Arguments
To generate code using this tool, you'll need to provide the following command-line arguments:
The name of the translation bundle to process.
For example: template.strings.
Directory containing the translation bundle, without the bundle prefix.
For example, if your bundle is template.strings and it exists at
src/main/resources/translations/template/strings.properties,
you should provide src/main/resources/translations.
Package to place the generated class in.
For example: template.i18n.
For example:
Optional Arguments
You can also provide any of the following optional command-line arguments to customise the output:
Generated class name.
Path to your project's EditorConfig file, if it has one. The generator will use this to format the code it outputs.
Translations file format.
See --help for a full list.
Generate code with the internal visibility modifier, instead of using public.
Output directory for generated code.
Generate bundle objects that specify the classloader used to load their containing
object, rather than defaulting to the system classloader.
This is particularly useful if you're writing a plugin for something, as the i18n framework will need to load your translations from the plugin, rather than the system classloader.
For more information on these settings and to see a full list of available file/message formats, run the tool with
--help.
Extra Formats
If you need to add support for any file/message formats we don't ship by default, please note that the i18n framework uses a service loader to locate implementations of these formats.
We recommend placing any JARs containing extra formats in a single folder, and launching the CLI tool as follows,
replacing /path/to/jars with the path to that folder: