More information about this topic from the translator side is provided at Translating JabRef Interface.
All labeled UI elements, descriptions and messages shown to the user should be localized, i.e., should be displayed in the chosen language.
JabRef uses ResourceBundles (see Oracle Tutorial) to store
key=value pairs for each String to be localized.
To show an localized String the following
org.jabref.logic.l10n.Localization has to be used. The Class currently provides three methods to obtain translated strings:
public static String lang(String key); public static String lang(String key, String... params); public static String menuTitle(String key, String... params);
The actual usage might look like:
Localization.lang("Get me a translated String"); Localization.lang("Using %0 or more %1 is also possible", "one", "parameter"); Localization.menuTitle("Used for Menus only");
- Use the String you want to localize directly, do not use members or local variables:
Localization.lang("Translate me");instead of
Localization.lang(someVariable)(possibly in the form
someVariable = Localization.lang("Translate me")
%x-variables where appropriate:
Localization.lang("Exported %0 entries.", number)instead of
Localization.lang("Exported ") + number + Localization.lang(" entries.");
- Use a full stop/period (“.”) to end full sentences
The tests check whether translation strings appear correctly in the resource bundles.
Localization.lang("KEY")to Java file. Run the
- Tests fail. In the test output a snippet is generated which must be added to the English translation file.
- Add snippet to English translation file located at
- Please do not add translations for other languages directly in the properties. They will be overwritten by Crowdin
- Add the new Language to the Language enum in https://github.com/JabRef/jabref/blob/master/src/main/java/org/jabref/logic/l10n/Language.java
- Create an empty <locale code>.properties file
- Configure the new language in Crowdin
If the language is a variant of a language
pt_BR it is necessary to add a language mapping for Crowdin to the crowdin.yml file in the root. Of course the properties file also has to be named according to the language code and locale.