What's contained in this repo
This package contains the following BASH scripts.
- 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.
- 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.
- xls2tab - this will convert an Excel spreadsheet (or any other spredsheet that can be opened up by LibreOffice to a tab delimited file).
- 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:
|# 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|
Things to keep in mind:
- All rows that have a
#as the first character in the
Acell will act as a comment and will not be extracted to the property file.)
- 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
- a UNIX-like environment (if you are using Windows, you should be able to run this with Cygwin).
- 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).