Localizing libGDX games via a spreadsheet

LibGDX has decent localization support via a bundle of .properties files, for example:

== strings.properties ==
app_name=Confirmation App
confirmation=Are you sure?

== strings_en_UK.properties ==
confirmation=I'm terribly sorry to bother you, but would you please be so kind to confirm your certainty on this matter?

== strings_nl.properties ==
confirmation=Weet u het zeker?

However, LibGDX doesn’t help you to create those files. It can be onerous to create them and keep them in sync. Both Eclipse and IntelliJ have features for this, but of course your translators won’t be using either of these. This is why I came up with a simple way to generate these .properties files from a spreadsheet (via CSV export). The expected input format is very simple (just a column per language) and is fully described in the README.

However, what if somebody renames or removes one of these keys? Your code would still be referring to the old key, and break at runtime when trying to access it! Not good. This is why the script also generates a Java enum like this:

package com.doubt.and.uncertainty.confirmation.app;

public enum Strings {

You can refer to these using the name() method, i.e. Strings.confirmation.name(). Now the code will fail to compile instead of crashing at runtime. Much better!

You should also write a wrapper class around I18NBundle, with methods that accept only arguments of type Strings. This way, you can never crash on a missing translation again.

The code is up on GitHub under the MIT license. I think it will actually work for any Java program, not just LibGDX games. I hope this is useful to someone!