Page MenuHomePhabricator

[Bug] Language fallback seems to apply even when not requested
Closed, ResolvedPublic

Description

https://www.wikidata.org/wiki/Special:ApiSandbox#action=wbgetentities&format=json&ids=Q1747618&props=labels&languages=nb%7Cno

returns

{
    "nb": {
        "language": "nb",
        "value": "Gresk kunst i antikken"
    },
    "no": {
        "language": "nb",
        "value": "Gresk kunst i antikken"
    }
}

Is this intended behaviour when languagefallback is *not* selected? How can I retrieve the actual 'no' value ("Antikkens gresk kunst", see https://www.wikidata.org/wiki/Q1747618)? I need this since I'm working on a semi-automatic tool to remove terms from deprecated languages.

Event Timeline

Danmichaelo raised the priority of this task from to Needs Triage.
Danmichaelo updated the task description. (Show Details)
Danmichaelo subscribed.
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
daniel triaged this task as Medium priority.Jun 15 2015, 6:22 PM
daniel subscribed.

This is indeed strange, especially since there is a distinct value in "no": "Antikkens gresk kunst". So the "nb" value shouldn't be used for "no", even if languagefallback was enabled. Strange...

Oh, there we go. From DefaultSettings.php:

Warning: Don't use language codes listed in $wgDummyLanguageCodes like "no"
for Norwegian (use "nb" instead), or things will break unexpectedly.

Yay. The correct language codes for norwegian are "nn" and "nb", I think. "no" is invalid, but supported as an alias for "nb":

  $wgDummyLanguageCodes = array(
	  'als' => 'gsw',
	  'bat-smg' => 'sgs',
	  'be-x-old' => 'be-tarask',
	  'bh' => 'bho',
	  'fiu-vro' => 'vro',
	  'no' => 'nb',
	  'qqq' => 'qqq', # Used for message documentation.
	  'qqx' => 'qqx', # Used for viewing message keys.
	  'roa-rup' => 'rup',
	  'simple' => 'en',
	  'zh-classical' => 'lzh',
	  'zh-min-nan' => 'nan',
	  'zh-yue' => 'yue',
  );

Wikibase shouldn't allow "no" for input, or map it to "nb". I'll add a ticket for that.

Jonas renamed this task from Language fallback seems to apply even when not requested to [Bug] Language fallback seems to apply even when not requested.Sep 10 2015, 3:44 PM
Jonas set Security to None.
Jonas added a subscriber: Addshore.
adrianheine subscribed.

I removed it from the language fallback epic since this is about a related, but different feature.

Why you want no? If you want riksmal you need to use nb-riksmal, and for Hognorsk we have nn-hognorsk.

This appears to have been fixed by something at some point, https://test.wikidata.org/wiki/Special:ApiSandbox#action=wbgetentities&format=json&ids=Q140000&props=labels&languages=nb%7Cno&formatversion=2 returns both labels. (It's the same on the main site too, but no labels are likely to get removed so there's not much point linking an example there)