Some projects has been configured with erroneous language codes, and the situation is quite annoying. A complete fix of the root case imply moving the projects, which are not feasible without automated processes. That is scripts must be made, and running them could imply serious downtime. See {T83609} and #Wiki-Setup (Rename).
As a temporary stop gap measure the language links in the sidebar can be fixed with an extension. Such an extension should at least fix
- the `lang` attribute
- the `hreflang`attribute
- the `text`attribute
- the `class` attribute
An extension like this is described as solution number 4 by @tstarling in post T174160#3798644
> Hook `SkinTemplate::getLanguages()` to determine the site being linked to, and implement a special case for nowiki which uses the "nb" autonym for the "no" language code.
A core problem is how to make a reasonably small config, as only some projects has language codes that are wrong. For example, Wikipedia has a project where "no" is used and interpreted incorrectly as "nb", while Wikisource has a project where "no" is used correctly. Overriding "no" everywhere will be wrong, but overriding only on dbnames will create a huge configuration file. A simple workaround would be to extract the group from SiteLookup by using `$wgDBname`, and make a two-level configuration. The extension uses this approach.
{F27229237}
The proof of concept is at [[https://github.com/jeblad/LangCodeOverride|Github: jeblad/LangCodeOverride]].
=Prerequisites & expectations=
Follows the [[ https://www.mediawiki.org/wiki/Review_queue#General_prerequisites_and_expectations | General prerequisites and expectations ]].
- [X] Create an [[ https://www.mediawiki.org/wiki/Review_queue#extension_page | extension page ]] at MediaWiki.
- [ ] ~~Create a [[ https://www.mediawiki.org/wiki/Review_queue#help_page | help page ]] at MediaWiki. It is probably not necessary for this extension, as it has no user interface component.~~
- [X] Create an external repo at Github ([[ https://github.com/jeblad/LangCodeOverride | Github: jeblad/LangCodeOverride ]]) to avoid confusion as an official extension. Move to Gerrit if it become official. ([[ https://www.mediawiki.org/wiki/Review_queue#code_hosting | code hosting ]])
- [ ] Create a project entry at Phabricator. This is necessary for the deployment process. Github has [[ https://www.mediawiki.org/wiki/Review_queue#issue_tracker | issue tracker ]] for the code.
- [X] Create a translate entry at translatewiki.net. This is for [[ https://www.mediawiki.org/wiki/Review_queue#localization | localization ]] of the code.
- [X] Prepare for [[ https://www.mediawiki.org/wiki/Review_queue#gated_deployment | gated deployment ]].
- [X] Create a role for a [[https://www.mediawiki.org/wiki/MediaWiki-Vagrant | mw:MediaWiki-Vagrant ]] instance
- [ ] Create sufficient [[ https://www.mediawiki.org/wiki/Review_queue#unit _tests | unit tests ]] for the extension.
- [ ] ~~Describe any changes to the [[ https://www.mediawiki.org/wiki/Review_queue#database_schema | database schema ]].~~
- [ ] Verify [[ https://www.mediawiki.org/wiki/Review_queue#compatibility | compatibility ]] with other extensions. (In particular Wikibase!)
- [ ] Create or somehow [[ https://www.mediawiki.org/wiki/Review_queue#host_a_test | host a test ]] version of the extension.
- [ ] Get initial [[ https://www.mediawiki.org/wiki/Review_queue#code_review | code review ]] from some capable developer.
- [ ] Get feedback and [[ https://www.mediawiki.org/wiki/Review_queue#community_support | community support]] at nowiki.
- [ ] Get feedback from [[ https://www.mediawiki.org/wiki/Review_queue#wikitech-l | wikitech-l ]].
=Preparations for deployment=
Follows the [[ https://www.mediawiki.org/wiki/Review_queue#Preparing_for_deployment | Preparing for deployment ]]. (Stuff missing.)
- [ ] Register a [[ https://www.mediawiki.org/wiki/Review_queue#maintainer | maintainer ]] for the extension at [[ https://www.mediawiki.org/wiki/Developers/Maintainers | mw:Developers/Maintainers]]. (Not before initial deployment.)
- [ ] Create a task in [[https://phabricator.wikimedia.org/maniphest/task/create/?projects=Wikimedia-Extension-setup,wikimedia-extension-review-queue | Phabricator]] in the #Wikimedia-Extension-setup and #Wikimedia-Extension-Review-Queue projects to get the extension into the review queue.
- [ ] Get a [[ https://www.mediawiki.org/wiki/Wikimedia_Security_Team/Security_reviews|mw:security review]] and mark the security review as a subtask of the main deployment task.
- [ ] Get a product review, if applicable
- [ ] Get a [[ https://www.mediawiki.org/wiki/WMF_Project_Design_Review_Process|mw:design review]], if applicable.
- [ ] ~~Get a [[ https://www.mediawiki.org/wiki/Beta_Features#Creating_your_own | mw:beta feature review]], if your extension adds a beta feature.~~
- [ ] ~~Get a database review, if applicable~~
- [ ] Request deployment to the [[ https://www.mediawiki.org/wiki/Beta_Cluster | mw:Beta Cluster]]
- [ ] Make sure the extension is automatically branched by make-wmf-branch
- [ ] Request a date/time for deployment