Work In Progress
This documentation is in beta. It's missing lots of content, search is broken, and many links go nowhere. These problems will be fixed before release, but there's plenty of work left!
Skip to main content

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:

-b bundle--bundle bundle

The name of the translation bundle to process. For example: template.strings.

-i path--input-path path

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.

-p package--class-package package

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:

-c name--class-name nameDefault: Translations

Generated class name.

-ec path--editorconfig pathDefault: .editorconfig

Path to your project's EditorConfig file, if it has one. The generator will use this to format the code it outputs.

-f format--file-format formatDefault: properties

Translations file format.

See --help for a full list.

-in--internal

Generate code with the internal visibility modifier, instead of using public.

-o path--output-dir pathDefault: ./output

Output directory for generated code.

-ucc--use-class-classloader

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: