Page MenuHomePhabricator

Language code(s) for nowiki should be changed to nb
Open, Needs TriagePublic

"Like" token, awarded by Hogne."Like" token, awarded by Kviften."Like" token, awarded by Ranveig."Like" token, awarded by jhsoby."Like" token, awarded by Danmichaelo."Like" token, awarded by Liuxinyu970226."Like" token, awarded by Mahir256.
Assigned To
Authored By
Soulkeeper, Aug 25 2017


The language code (macro code) no is too general for the nowiki project and should be changed to the more specific nb. The following two variables/fields need to be updated:

  • sites_language
  • ll_lang

This will correct the language label in both the sidebar interwiki links and the Wikidata interwiki interface

  • from Norsk / Norwegian
  • to Norsk bokmål / Norwegian bokmål

This solution would also help alleviate or make obsolete:

Note that this task does not involve changing the subdomain of the nowiki project. These two tasks should be tackled separately. Changing the language codes without changing the subdomain name will solve some technical problems, while allowing the nowiki community to keep their beloved subdomain name status quo.

Since this change will have a minimal impact on the user experience, apart from correcting the Interwiki language name, and nobody has been disputing that the Interwiki language label/name has been wrong since rMW0d82d154476bbc6adbd015072c6c90616ea8cdea was implemented (afaik), this ought to be an uncontroversial task from a language political viewpoint. Whether anyone will dispute it anyway, remains to be seen.

For the record, the variable $wgLanguageCode is already set to nb and has been for quite some time. There have been no protests against this so far.

Related Objects

Event Timeline

Restricted Application added subscribers: jeblad, jhsoby, Aklapper. · View Herald TranscriptAug 25 2017, 12:50 PM
Soulkeeper updated the task description. (Show Details)Aug 25 2017, 12:57 PM
Hogne added a subscriber: Hogne.Aug 25 2017, 1:08 PM
Soulkeeper updated the task description. (Show Details)Aug 25 2017, 1:16 PM
Abbe98 added a subscriber: Abbe98.Aug 25 2017, 1:33 PM
Soulkeeper updated the task description. (Show Details)Aug 25 2017, 1:37 PM
Danmichaelo added a subscriber: Danmichaelo.
Kjetil added a subscriber: Kjetil.Aug 27 2017, 5:27 PM
Pcoombe added a subscriber: Pcoombe.Oct 5 2017, 1:59 PM

Hi all, it would be great to know if the suggested change is technically possible. The misleading name for nowiki as simply "Norwegian" has been in place for over a month now, and this needless to say causes both confusion and frustration amongst users of the other Norwegian language and nnwiki.

Haros added a subscriber: Haros.Oct 11 2017, 8:13 AM
tstarling renamed this task from Language code(s) for nowiki should be changed to nbwiki to Language code(s) for nowiki should be changed to nb.Nov 29 2017, 10:32 PM
tstarling added a subscriber: tstarling.EditedNov 29 2017, 11:46 PM

ll_lang is actually the interwiki prefix, it's written by LinksUpdate based on what's currently in the wikitext on the page in question, you can't just change it in the database. You'd have to change it on every page with an explicit (non-Wikidata) language link to nowiki.

As for site_language, it apparently originates in SiteMatrix, where it is derived from the DB name and langlist. There is currently no langlist entry for "nb". populateSitesTable.php (in Wikibase) pulls in the language code and writes it to site_language. But I don't think it is used for the langlinks sidebar, so even if we could change it, it wouldn't help us much. Wikibase has LangLinkHandler::getInterwikiCodeFromSite() which again simply derives the interwiki prefix from the DB name. It's a deep, scattered assumption that the language code which identifies a sidebar link is the same as the interwiki prefix.

The language name for display in the sidebar is determined by SkinTemplate::getLanguages(), which only has the interwiki prefix, assumed to be the language code, it can't easily distinguish between nowiki (which desires "Norsk bokmål") from nowikisource (which desires "Norsk").

I think the options are:

  1. Break the association between DB names and interwiki prefixes. Have SiteMatrix return a different language code for nowiki as compared to nowikisource. Repopulate the sites table with this new scheme. Fix T137537 and make LangLinkHandler::getInterwikiCodeFromSite() get its interwiki prefix from Sites. Modify dumpInterwiki.php, adding a new category of language-based interwiki prefixes which can be different on different wikis. Alias no to nb on wikipedias, but not on wikitionaries. Update any wikipedia pages which use no: language links to use nb:, since language links (unlike interwiki links) cannot have aliases.
  2. Move the nowiki DB to nbwiki. Add "nb" to langlist. Update language links in Wikipedia pages as in option 1. Ideally, the domain name would also be moved, that way the no: interwiki prefix can continue to point to, which would be redirected to in apache config, avoiding the need to add new special cases to dumpInterwiki.php.
  3. Revert the autonym change (T173602). At least we will only be breaking Wikisource in the way that it has always been broken, we won't be introducing a new UI issue to our most popular Norwegian site.
  4. 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.
Liuxinyu970226 added a comment.EditedNov 30 2017, 2:17 AM

@tstarling: And what about the babel, e.g. here?

@tstarling: And what about the babel, e.g. here?

If you're asking why {{#babel:no}} gives "norsk (bokmål)" instead of "norsk", then I don't think that is relevant to this bug. It is apparently due to deprecation of "no" as language code for MW localisation, which happened in 2011, see rMW15455a4a162982d088dcce24e83baf1bb94f9286.

Hogne added a comment.Nov 30 2017, 9:28 AM

@tstarling Thank you for your analysis! The community cannot accept to do anything with the domain name (I'm sorry to say).
What do you recommend among the four alternatives? Who can decide and execute the change?

@tstarling: And what about the babel, e.g. here?

If you're asking why {{#babel:no}} gives "norsk (bokmål)" instead of "norsk", then I don't think that is relevant to this bug. It is apparently due to deprecation of "no" as language code for MW localisation, which happened in 2011, see rMW15455a4a162982d088dcce24e83baf1bb94f9286.

I'm afraid my meaning is not this, is that why Category:User no still can't be merged into Category:User nb.

@tstarling Thank you very much for looking into this! It's much appreciated.

Regarding option 1, where you write "since language links (unlike interwiki links) cannot have aliases", are you sure? See this test with the codes no, nb, be-x-old and be-tarask. I might be misunderstanding what you mean by "alias" though.

I don't really have the expertise to make any judgement, but it sounds like Option 1 is the most robust one, but also the most difficult and labour-intensive to perform. Logically it makes the most sense, but pragmatically, is it worth the investment (I guess that depends on what other problems this could help solve, I imagine it might be useful for cases like zh-min-nan, etc as well?) Option 3 is a quick temporary fix, but shouldn't be a long-term solution, IMO, but could and probably should be done until a long-term fix is in place. Option 4 seems like a good and quick solution if this is the only case where this kind of fix is needed.

Since there is no development on this, I have committed a change 454700 to revert the autonym change, as outlined as option 3 by @tstarling in T174160#3798644.

This change is meant to be temporary until a better fix comes along, but since that is not trivial it might take a while. It is not ideal, and it will affect the Wikibooks, Wikisource and Wikinews in Norwegian (which are both Bokmål and Nynorsk), but since their pageviews according to are less than 0.2 % of the Norwegian Bokmål Wikipedia, I believe it is justified.

The proposed change 454700 to revert the autonym change will break away from use of IANA language subtag registry which, in my opinion, is a pretty bad ting to do.

Note also the consequences for minority projects.

Please provide a proper solution.

Nsaa added a subscriber: Nsaa.Aug 23 2018, 9:43 PM
jeblad added a comment.EditedNov 6 2018, 4:34 PM

I would prefer solution number 4 from @tstarling post T174160#3798644. I believe this is good enough as a temporary fix until the necessary scripts are made, which I believe will take a lot more time.

That is; override the language code by using the hook SkinTemplateGetLanguageLink.

The callback should then override the language code when getTransWikiID() is *wiki of some kind, where * is a valid language code. The logic here is to extract a identifier for the family.

Only thing it will not solve that is somewhat important is w:Special:Sitematrix

I can write some example code, but should it go straight into operations or be an extension? Seems to be cleaner to make it as an extension, even if it would be really small?

Liuxinyu970226 added a comment.EditedNov 11 2018, 8:19 AM

+1 to @jeblad said above recently


Feel free to create another task that looks like T111876

Change 530768 had a related patch set uploaded (by Nikerabbit; owner: Nikerabbit):
[mediawiki/core@master] Add $wgInterlanguageLinkCodeMap

Hogne added a comment.Aug 18 2019, 5:25 PM

Yesterday Jon Harald and I had a short meeting with Amir Aharoni, the man that knows the  preliminary solution for the no.wikipedia naming issue, while the more ideal solution need more development, and probably will not be ready this year neither.

Amir says he allready has developed the local override so that the project can be named "Norsk (bokmål)" all though other "no Wikimedia" projects will still have the correct macro language name of "Norsk".

Our understanding is that Amir will deploy this local override this month.

Hogne Neteland

Change 530768 merged by jenkins-bot:
[mediawiki/core@master] Add $wgInterlanguageLinkCodeMap