Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property links don't work in de-formal language #5342

Open
krabina opened this issue Dec 6, 2022 · 8 comments · Fixed by #5530 · May be fixed by #5638
Open

Property links don't work in de-formal language #5342

krabina opened this issue Dec 6, 2022 · 8 comments · Fixed by #5530 · May be fixed by #5638
Labels
bug Occurrence of an unintended or unanticipated behaviour that causes a vulnerability or fatal error

Comments

@krabina
Copy link
Contributor

krabina commented Dec 6, 2022

Setup

Software Version
MediaWiki 1.35.8
PHP 7.4.3 (fpm-fcgi)
MariaDB 10.3.37-MariaDB-0ubuntu0.20.04.1
ICU 66.1
Elasticsearch 6.8.23
Semantic MediaWiki 4.0.2

Issue

The @@@-Syntax to create property links does work when the property Has property description is set so some description:
[[Has property description::Testdescription@de]]

It is working if the user has "de" as their language set. However, If a user sets "de-formal" the mouse-over-effect is not working.

Trying to set [[Has property description::Testdescription@de-formal]] fails with the massage that is not a valid language code.

So I guess this must be some kind of bug. If I cannot set de-formal as language value in monolinual text properties than somehow de-formal (and de-AT, de-CH) should fallback to de.

See also #1865 and #3562

@krabina krabina added the bug Occurrence of an unintended or unanticipated behaviour that causes a vulnerability or fatal error label Dec 6, 2022
@krabina
Copy link
Contributor Author

krabina commented Apr 19, 2024

Unfortunately, this does not solve the issue for me. You can see it here:
https://test.knowledge.wiki/Adolf_Loos
the "Objektbezug" property should be called "Siehe auch": https://test.knowledge.wiki/Attribut:Objektbezug
grafik
When I switch from de-formal. to de, the correct name is shown:
grafik

@krabina krabina reopened this Apr 19, 2024
@thomas-topway-it
Copy link
Contributor

@JeroenDeDauw I'm waiting for some feedback, here https://test.knowledge.wiki/index.php?title=Attribut:Objektbezug&action=edit I don't see de-format specified

@krabina
Copy link
Contributor Author

krabina commented Apr 22, 2024

That is right. I was not expecting having to set a property description to de-formal, I was expecting it to fall back to de if the wiki is set to de-formal.
So the PR is working, and this is an improvement. However, I don't think it is very likely that a property name or description will have language where formal or informal tone is required. You would usually never address the user in a property description.

@krabina
Copy link
Contributor Author

krabina commented Apr 22, 2024

@thomas-topway-it would it be easy to implement a fallback to "de" if the wiki is set to a subset of de (like de-formal) and there are no annotations with de-formal, but only with de?

@thomas-topway-it
Copy link
Contributor

thomas-topway-it commented Apr 22, 2024

@krabina I've checked. In the MW files there isn't a fallback from de-formal to de, so they are considered two different languages. (this is not correct, please see below) However there is a fallback in the file jquery.i18n.fallbacks.js , so we can translate it to PHP

	$.extend( $.i18n.fallbacks, {
		ab: [ 'ru' ],
		ace: [ 'id' ],
		aln: [ 'sq' ],
		// Not so standard - als is supposed to be Tosk Albanian,
		// but in Wikipedia it's used for a Germanic language.
		als: [ 'gsw', 'de' ],
		an: [ 'es' ],
		anp: [ 'hi' ],
		arn: [ 'es' ],
		arz: [ 'ar' ],
		av: [ 'ru' ],
		ay: [ 'es' ],
		ba: [ 'ru' ],
		bar: [ 'de' ],
		'bat-smg': [ 'sgs', 'lt' ],
		bcc: [ 'fa' ],
		'be-x-old': [ 'be-tarask' ],
		bh: [ 'bho' ],
		bjn: [ 'id' ],
		bm: [ 'fr' ],
		bpy: [ 'bn' ],
		bqi: [ 'fa' ],
		bug: [ 'id' ],
		'cbk-zam': [ 'es' ],
		ce: [ 'ru' ],
		crh: [ 'crh-latn' ],
		'crh-cyrl': [ 'ru' ],
		csb: [ 'pl' ],
		cv: [ 'ru' ],
		'de-at': [ 'de' ],
		'de-ch': [ 'de' ],
		'de-formal': [ 'de' ],
		dsb: [ 'de' ],
		dtp: [ 'ms' ],
		egl: [ 'it' ],
		eml: [ 'it' ],
		ff: [ 'fr' ],
		fit: [ 'fi' ],
		'fiu-vro': [ 'vro', 'et' ],
		frc: [ 'fr' ],
		frp: [ 'fr' ],
		frr: [ 'de' ],
		fur: [ 'it' ],
		gag: [ 'tr' ],
		gan: [ 'gan-hant', 'zh-hant', 'zh-hans' ],
		'gan-hans': [ 'zh-hans' ],
		'gan-hant': [ 'zh-hant', 'zh-hans' ],
		gl: [ 'pt' ],
		glk: [ 'fa' ],
		gn: [ 'es' ],
		gsw: [ 'de' ],
		hif: [ 'hif-latn' ],
		hsb: [ 'de' ],
		ht: [ 'fr' ],
		ii: [ 'zh-cn', 'zh-hans' ],
		inh: [ 'ru' ],
		iu: [ 'ike-cans' ],
		jut: [ 'da' ],
		jv: [ 'id' ],
		kaa: [ 'kk-latn', 'kk-cyrl' ],
		kbd: [ 'kbd-cyrl' ],
		khw: [ 'ur' ],
		kiu: [ 'tr' ],
		kk: [ 'kk-cyrl' ],
		'kk-arab': [ 'kk-cyrl' ],
		'kk-latn': [ 'kk-cyrl' ],
		'kk-cn': [ 'kk-arab', 'kk-cyrl' ],
		'kk-kz': [ 'kk-cyrl' ],
		'kk-tr': [ 'kk-latn', 'kk-cyrl' ],
		kl: [ 'da' ],
		'ko-kp': [ 'ko' ],
		koi: [ 'ru' ],
		krc: [ 'ru' ],
		ks: [ 'ks-arab' ],
		ksh: [ 'de' ],
		ku: [ 'ku-latn' ],
		'ku-arab': [ 'ckb' ],
		kv: [ 'ru' ],
		lad: [ 'es' ],
		lb: [ 'de' ],
		lbe: [ 'ru' ],
		lez: [ 'ru' ],
		li: [ 'nl' ],
		lij: [ 'it' ],
		liv: [ 'et' ],
		lmo: [ 'it' ],
		ln: [ 'fr' ],
		ltg: [ 'lv' ],
		lzz: [ 'tr' ],
		mai: [ 'hi' ],
		'map-bms': [ 'jv', 'id' ],
		mg: [ 'fr' ],
		mhr: [ 'ru' ],
		min: [ 'id' ],
		mo: [ 'ro' ],
		mrj: [ 'ru' ],
		mwl: [ 'pt' ],
		myv: [ 'ru' ],
		mzn: [ 'fa' ],
		nah: [ 'es' ],
		nap: [ 'it' ],
		nds: [ 'de' ],
		'nds-nl': [ 'nl' ],
		'nl-informal': [ 'nl' ],
		no: [ 'nb' ],
		os: [ 'ru' ],
		pcd: [ 'fr' ],
		pdc: [ 'de' ],
		pdt: [ 'de' ],
		pfl: [ 'de' ],
		pms: [ 'it' ],
		pt: [ 'pt-br' ],
		'pt-br': [ 'pt' ],
		qu: [ 'es' ],
		qug: [ 'qu', 'es' ],
		rgn: [ 'it' ],
		rmy: [ 'ro' ],
		'roa-rup': [ 'rup' ],
		rue: [ 'uk', 'ru' ],
		ruq: [ 'ruq-latn', 'ro' ],
		'ruq-cyrl': [ 'mk' ],
		'ruq-latn': [ 'ro' ],
		sa: [ 'hi' ],
		sah: [ 'ru' ],
		scn: [ 'it' ],
		sg: [ 'fr' ],
		sgs: [ 'lt' ],
		sli: [ 'de' ],
		sr: [ 'sr-ec', 'sr-cyrl' ],
		srn: [ 'nl' ],
		stq: [ 'de' ],
		su: [ 'id' ],
		szl: [ 'pl' ],
		tcy: [ 'kn' ],
		tg: [ 'tg-cyrl' ],
		tt: [ 'tt-cyrl', 'ru' ],
		'tt-cyrl': [ 'ru' ],
		ty: [ 'fr' ],
		udm: [ 'ru' ],
		ug: [ 'ug-arab' ],
		uk: [ 'ru' ],
		vec: [ 'it' ],
		vep: [ 'et' ],
		vls: [ 'nl' ],
		vmf: [ 'de' ],
		vot: [ 'fi' ],
		vro: [ 'et' ],
		wa: [ 'fr' ],
		wo: [ 'fr' ],
		wuu: [ 'zh-hans' ],
		xal: [ 'ru' ],
		xmf: [ 'ka' ],
		yi: [ 'he' ],
		za: [ 'zh-hans' ],
		zea: [ 'nl' ],
		zh: [ 'zh-hans' ],
		'zh-classical': [ 'lzh' ],
		'zh-cn': [ 'zh-hans' ],
		'zh-hant': [ 'zh-hans' ],
		'zh-hk': [ 'zh-hant', 'zh-hans' ],
		'zh-min-nan': [ 'nan' ],
		'zh-mo': [ 'zh-hk', 'zh-hant', 'zh-hans' ],
		'zh-my': [ 'zh-sg', 'zh-hans' ],
		'zh-sg': [ 'zh-hans' ],
		'zh-tw': [ 'zh-hant', 'zh-hans' ],
		'zh-yue': [ 'yue' ]
	} );

@krabina
Copy link
Contributor Author

krabina commented Apr 22, 2024

Interesting. But in MediaWiki, when you change interface messages, you don't have to put everything in de-formal. de is sufficient. For example, there is an uploadtext https://test.knowledge.wiki/MediaWiki:Uploadtext/de that is working even if the wiki is in de-formal language. I don't have to create a https://test.knowledge.wiki/MediaWiki:Uploadtext/de-formal

@thomas-topway-it
Copy link
Contributor

My comment wasn't correct. There is a fallback specified in the file MessagesDe_formal.php.
However within the frame of the current issue, I'm not sure it is a problem of fallback but rather the inverse operation. (the language code is expressed as 'de' in the property page but the expected result should reflect the language of the wiki set as de-formal)
This seems legitimate considering that

I don't think it is very likely that a property name or description will have language where formal or informal tone is required. You would usually never address the user in a property description

however for this to work in our case we have to use an inverse map (not a fallback) from de to de-formal specifically for the Has preferred property label property, that takes into account the language of the wiki

@krabina
Copy link
Contributor Author

krabina commented Apr 22, 2024

I am not sure I completely understand this. But from a user perspective, I would see it this way.

  • if there is a preferred property defined, display it for the language the user is currently using (independent of the wikis language). This is working
  • if there is no preferred property defined in the user language, use the wikis language. This is working and is used for anonymous users.
  • if there is a definition in de-xxx and one in de, use the one the user specified. For anonymous users use the one in the wiki setting. This is working since this PR

Edge-Cases (only if the definition does not match)

  • If there is a definition in de-xxx and the wiki is in de, use the de-xxx
  • if there is a definition in de and the wiki is in de-xxx, use de

@thomas-topway-it thomas-topway-it linked a pull request May 16, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Occurrence of an unintended or unanticipated behaviour that causes a vulnerability or fatal error
Projects
None yet
2 participants