I want to use programatic scripts to work with the i18n files across MediaWiki. I wrote a script to allow me to add messages, and easily update message keys as well as scan for missing qqq codes [1]
The problem I am running into is that an object is an unordered set of name/value pairs and in Python (at least to my knowledge) key order varies across Python implementations.
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.
I feel this would be a good thing as it would encourage naming messages in such a way that they appear in the same order.
E.g for an editing interface you might have myeditor-button-save myeditor-button-edit
How does translatewiki build the i18n files? Is this just a python problem?
2014-08-25 20:15 GMT+03:00 Jon Robson jdlrobson@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-or... 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/...
-Niklas
Is there any benefit in maintaining a standard order?
The Python change works but it's a bit of a pain I had to resort to that. It now means the messages in Flow will be arbitrarily ordered (either new messages will get appended at the end or manually placed somewhere in the middle)
Personally, I think alphabetical order forces you to name things consistently if you want them to appear in the same part of the file.
On Mon, Aug 25, 2014 at 10:31 AM, Niklas Laxström niklas.laxstrom@gmail.com wrote:
2014-08-25 20:15 GMT+03:00 Jon Robson jdlrobson@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-or... 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/...
-Niklas
Mediawiki-i18n mailing list Mediawiki-i18n@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-i18n
mediawiki-i18n@lists.wikimedia.org