Page MenuHomePhabricator

Test that namespace names are not identical to language codes
Open, Needs TriagePublic

Description

At the moment, we have at least two cases of namespace names that are identical to language codes: "Jam" (Talk) in Dinka (din) and "Sa" (Category) in Tyap (kcg). This creates an unwanted ambiguity, because a category looks the same as an interlanguage link.

I'll try to discuss changing these particular names with people who know the languages, but going forward, there should be an automatic test that prevents it.

I know little about how PHPUnit tests work, but I can imagine something like this:

  • Load all the language codes from Names.php. (Or better, from another source that includes all the codes from ISO 639. However, Names.php should still be checked because it has some custom and non-standard codes.)
  • In core, go over all the languages/messages/Messages*.php files, check the values of $namespaceNames and $namespaceGenderAliases and the keys of $namespaceAliases. Fail if any of them is identical to a language code.
  • In extensions, if Example.namespaces.php exists, go over all the values of $namespaceNames for each language and all the keys of $namespaceAliases for each language. Fail if any of them is identical to a language code.

Since it should probably work the same for all the extensions, this test probably needs to be in some central place and not replicated for each extension. Hence

I'd be happy to try doing it myself, but I'll need some guidance where to start doing it correctly.