zoltan-dulac / z4n

Tools to help with your i18n/l10n projects using java .properties files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

z4n

Tools to help with your i18n/l10n projects using Java .properties files. The name is a bad joke based on the author's name, Zoltan.

What's contained in this repo

This package contains the following BASH scripts.

  1. removeEntitiesInProp - this will take a *.properites file and convert all the property values to UTF-8. This conversion applies to numeric entities, named entities and '\u'-escaped Unicode characters. It also cleans up the formatting of the property name and value by putting one (and only one) space before and after the = symbol separating the two.
  2. orderPropertiesFile - this will order a properties file so that the property names are in the same order as another .properties file. It is useful to ensure consistency between .properties files.
  3. xls2tab - this will convert an Excel spreadsheet (or any other spredsheet that can be opened up by LibreOffice to a tab delimited file).
  4. xls2prop - this convert a specifically formatted spreadsheet to a Java Property File (again, this spreadsheet must be in a format readable by LibreOffice). Right now, the format should be:
A B C D E ...
# all lines that begin with a '#' are ignored
# The row that begins with "# Locales" contains the locale names
# column A is the property variable name
# columns B and greater are the values in the different locales
# Locales en_CA fr_CA ru_RU ja_JP ...
form.header.name Name Nom Имя 名前 ...
form.header.address Address Addresse Адрес 住所 ...

Things to keep in mind:

  1. All rows that have a # as the first character in the A cell will act as a comment and will not be extracted to the property file.)
  2. The row that is an a cell labelled "# Locales" will contain the locales to be translated to. I usually use IETF language tags for the locale names, but you can technically use whatever strings you want.

This repo also contains an example directory that contains an example spreadsheet and sample output from the spreadsheet. The resultant properties file was created using the following command:

xls2prop example-spreadsheet.xls example

The first parameter is the name of the input spreadsheet. The second parameter (example) is the prefix for the outfile names (in this case, the script will output the translations to example_en_CA.properties, example_fr_CA.properties, example_ru_RU.properties and example_ja_JP.properties).

Dependencies

Notes

  • These scripts have been tested under OSX and Microsoft Windows using Cygwin. It should work using Linux with no modifications (please log an issue at https://github.com/zoltan-dulac/z4n/ if there are any issues).

About

Tools to help with your i18n/l10n projects using java .properties files.

License:MIT License


Languages

Language:Shell 100.0%