Mailing List Archive

Moving special page alias translations to JSON
Hello everyone,

The Language team is working on an approach to move special page aliases to
JSON files <https://phabricator.wikimedia.org/T89947> that can then be
translated via translatewiki.net. The system we develop should also allow
translation of magic words and namespaces in the future.

An approach to do this has been described here on the Phabricator task:
https://phabricator.wikimedia.org/T89947#9358113

You can also read up on some of the other approaches that we reviewed:
https://phabricator.wikimedia.org/T89947#7684350

The format being proposed is used in the proof-of-concept patch here:
https://gerrit.wikimedia.org/r/c/mediawiki/extensions/TranslationNotifications/+/977084/2/i18n/config/en.json

We would love to hear from you what you think about this approach and if
you have any questions.

Regards,
Abijeet Patro (he/him)
Staff Software Engineer, Language Engineering
Wikimedia Foundation
Re: Moving special page alias translations to JSON [ In reply to ]
Love it! ???? It's almost a 100% literal translation of the existing
.alias.php format, which makes it very easy to learn, even using old
documentation.

The only difference is that the language is not in the array structure
any more, but in the "en.json" filename, which makes it behave the
same as the existing i18n system. That's superb! ????

This also makes it much easier to argue how and why en.json is
different from the others.

My only "complaint" is the folder name "config". But that might just
be part of the example patch. "Config" is rather meaningless. One
could argue that everything is configuration, even the existing
localizations in i18n/en.json. Why can't we make the new structure
part of the existing i18n/en.json file? Or if you really think the
separation is beneficial, why not have separate folders for
"specialpagealiases", "magicwords", and so on?

Having the extra "specialPageAliases" key in the JSON is fine either
way. This makes it a lot more flexible for any unpredictable future
addition. However, I would make it uppercase "SpecialPageAliases" to
be closer to how extension.json works.

Best
Thiemo
_______________________________________________
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
Re: Moving special page alias translations to JSON [ In reply to ]
I like this idea, but:
A PHP file can be individual for each wiki installation, while
Translatewiki will force all wikis of the same language to use the same
translations.
Am I right?
Re: Moving special page alias translations to JSON [ In reply to ]
Thank you for your feedback!

> My only "complaint" is the folder name "config". But that might just
be part of the example patch.

That was a correct assumption. I've now updated the name of the parameter to `TranslationAliasesDirs` and renamed the name of that folder to `aliases`

> Why can't we make the new structure
part of the existing i18n/en.json file? Or if you really think the
separation is beneficial, why not have separate folders for
"specialpagealiases", "magicwords", and so on?

The main reason for separation was the concerns highlighted here: https://phabricator.wikimedia.org/T89947#8210010

Another couple of reasons are related to change tracking being cleaner if these are in their own files and it being easier for translatewiki
to process these files and perform stricter validation for them.

> Or if you really think the
separation is beneficial, why not have separate folders for
"specialpagealiases", "magicwords", and so on?

That would be possible with the current format:
```
"TranslationAliasesDirs": {
"TranslationNotificationsSpecialPageAlias": "i18n/aliases/",
"TranslationNotificationsSpecialMagicWords": "i18n/magicWords/",
"TranslationNotificationsSpecialNamespaceAlias": "i18n/namespaceAlias/"
}
```

> This makes it a lot more flexible for any unpredictable future
addition. However, I would make it uppercase "SpecialPageAliases" to
be closer to how extension.json works.

This should be doable. I'll check it out.
_______________________________________________
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
Re: Moving special page alias translations to JSON [ In reply to ]
On 2023-11-30 21:18, BinĂ¡ris wrote:
> A PHP file can be individual for each wiki installation, while
> Translatewiki will force all wikis of the same language to use the same
> translations.
> Am I right?

I think this doesn't actually change.

Today, individual wikis can only customize the namespace names (using
$wgExtraNamespaces), and all other translateable items (like special
page and magic word names) are the same across all projects in the same
language.

It seems to me that this will continue working in exactly the same way,
and only the format is changed from PHP code to JSON.

--
Bartosz Dziewo?ski
_______________________________________________
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
Re: Moving special page alias translations to JSON [ In reply to ]
Like Bartosz Dziewo?ski said, this should not be affected. There should not be any difference between PHP and JSON files in terms of possibility of customization
_______________________________________________
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/