[Mediawiki-i18n] Sorting json files

Niklas Laxström niklas.laxstrom at gmail.com
Mon Aug 25 17:31:52 UTC 2014


2014-08-25 20:15 GMT+03:00 Jon Robson <jdlrobson at gmail.com>:
> So if I programmatically like in my script [1] I want to manipulate
> the JSON, when re-writing it, I'm struggling to maintain the original
> order.
> I wonder if thus it would be useful to sort all our i18n messages in
> alphabetical order.

http://stackoverflow.com/questions/6921699/can-i-get-json-to-load-into-an-ordereddict-in-python
provides some tips which can help to avoid having dealing with this
question in the first place.

Some projects like VisualEditor sort their messages, but most don't.

> How does translatewiki build the i18n files? Is this just a python problem?

Arrays in PHP keep their order order.

https://github.com/wikimedia/mediawiki-extensions-Translate/blob/master/ffs/JsonFFS.php#L108

  -Niklas



More information about the Mediawiki-i18n mailing list