thm/uinames — pull request #48 by ClaudioAlbertin (2014-08-15 00:30:49+00:00)
Title: Update of File Format

This updates the database to a more comprehensive file format.
This pull request includes two scripts, `convert.js` and `beautify.js` that are supposed to make the switch to the new format easier. You need [node.js](http://nodejs.org) to run them.

To convert a file of the old format to the new format, simply run something similar to the following command:
```$ node convert names.json >> names.new.json```

To beautify a file that already has the new format, run something along the lines of the following. This will tidy up the indentation and sort all elements alphabetically. It will also report an error if something about the files format is invalid. I'd recommend to run this before every commit to this repository.
```$ node beautify names.json >> names.new.json```

The new file format now also supports different languages. Take a look at the entry of `Switzerland` as an example.
It's now also possible to declare exceptional behaviour of names in a certain language or country. The surname for example could be updated to always end in an `a` if the first name is female. Simply set any of `female_name`, `male_name`, `female_surname`, `male_surname` in the object found as the `exceptions` attribute to an array with the first element being the pattern and the second one being the replacement. See [the PHP manual](http://php.net/manual/en/function.preg-replace.php) for a detailed description of the method used.
A more comprehensive guide with examples should follow in the README.