Hi,
The JSON i18nj files in MediaWiki extensions are getting filled by apihelp messages. They are usually added to the end of the files.
In addition to docs internationalization, which is pretty awesome by itself, this happens to have another somewhat useful side effect on the i18n files themselves. Most messages that are added to the JSON files are not apihelp messages. When messages are added to the end of the file, a comma must be added to the last JSON line, even if the message on that line doesn't actually change. This change is not really meaningful, but it adds one more line to the diff in review.
Keeping the apihelp messages in the end and adding all other messages before them prevents this comma-adding and shortens the diff by one line. It is, of course, a small thing, but it saves a few moments when reviewing code or doing git blame or git bisect.
I suggest adopting this as a good practice.
-- Amir Elisha Aharoni · אָמִיר אֱלִישָׁע אַהֲרוֹנִי http://aharoni.wordpress.com “We're living in pieces, I want to live in peace.” – T. Moore
On Sat, Nov 8, 2014 at 4:29 AM, Amir E. Aharoni < amir.aharoni@mail.huji.ac.il> wrote:
Keeping the apihelp messages in the end and adding all other messages before them prevents this comma-adding and shortens the diff by one line. It is, of course, a small thing, but it saves a few moments when reviewing code or doing git blame or git bisect.
I suggest adopting this as a good practice.
OTOH, you're likely to get the same effect by sorting the i18n files by key (which I recently learned some teams enforce), since it's not that common that you add a new message alphabetically after every other message in the file.
OTOH, you're likely to get the same effect by sorting the i18n files by
key
(which I recently learned some teams enforce), since it's not that common that you add a new message alphabetically after every other message in the file.
Sorting alphabetically by key seems rather pointless to me, though I might miss some advantage of this. I tend to group by features, but not strictly.
Sorting alphabetically doesn't relate to what I wrote; apihelp messages will be in the beginning, and new messages might get added in the end.
Using my proposal, messages will be rarely added in the end of the file.
-- Amir Elisha Aharoni · אָמִיר אֱלִישָׁע אַהֲרוֹנִי http://aharoni.wordpress.com “We're living in pieces, I want to live in peace.” – T. Moore
wikitech-l@lists.wikimedia.org