Page MenuHomePhabricator

It's unclear how can one translate the word "and" in the license note on Mobile Frontend
Open, Needs TriagePublic


To reproduce:

  1. Go to (note that it must be in Mobile View, and the UI and content language must be Hebrew)
  2. Edit.
  3. Write something.
  4. Click the Publish button (blue button at the top with an arrow).
  5. The edit summary box appears. Underneath the edit summary field, there's a license notice. (As far as I understand, the message is mobile-frontend-editor-licensing-with-terms.)

Observed: Most of the message is translated to Hebrew, but the end says "CC BY-SA 3.0 and GFDL". The word "and" is not translated.

Expected the word "end" must be translated, so the string is suppose to be something like "CC BY-SA 3.0 ו־GFDL"

I couldn't find where to translate this string.

Possibly related to T111833.

Event Timeline

	 * Check, if the given license message string holds multiple license messages.
	 * FIXME: This hack shouldn't be needed anymore after fixing T111833
	 * @param string $license License or licenses message
	 * @param Message|null $msgObj delimiter (optional)
	 * @return int Returns 2, if there are multiple licenses, 1 otherwise.
	public static function getPluralLicenseInfo( $license, $msgObj = null ) {
		// for plural support we need the info, if there is one or more licenses used in the license text
		// this check if very simple and works on the base, that more than one license will
		// use "and" as a connective
		// 1 - no plural
		// 2 - plural
		if ( $msgObj !== null ) {
			$delimiterMsg = $msgObj;
		} else {
			$delimiterMsg = wfMessage( 'and' );
		$delimiterMsg = $delimiterMsg->inContentLanguage();
		// check, if "and" isn't disabled and exists in site language
		return $delimiterMsg->isDisabled() || strpos( $license, $delimiterMsg->text() ) === false ? 1 : 2;

Didn't mean to hit enter.. but it's using

That's what I thought, and this message is translated to Hebrew, and yet it appears in English.

That's what I thought, and this message is translated to Hebrew, and yet it appears in English.

Seems that it's because of this (which, at a glance, looks very out-of-place to me):

			$delimiterMsg = wfMessage( 'and' );
		$delimiterMsg = $delimiterMsg->inContentLanguage();

I'm trying to think of a valid reason why the license separator msg ("and") would ever be in content and not UI language but I can't think of any. It certainly makes sense to have *actual* license messages (if any) "untranslatable", and separators like this fully translatable.

Looking at it in more detail, it uses the "and" message to see if the "and" appears in the string, but then returns plurality; it doesn't specifically use that and there...

(mobile-frontend-editor-licensing-with-terms: (mobile-frontend-editor-terms-link:, CC BY-SA 3.0 and GFDL, 1)

Screenshot 2021-05-18 at 14.44.19.png (136×2 px, 40 KB)

The and is there as one of the parameters being passed in

It looks fine on (Wikimedia override) for example

LGoto added a subscriber: LGoto.

This task was closed as part of backlog upkeep. If you believe it was closed in error, please respond on the ticket.

It's still a bug. Maybe not the most important one, but a bug nevertheless.

On Wikimedia wikis, the dual-license text actually comes from WikimediaMessages via a hook:
The message is wikimedia-mobile-license-links, and looking in the WikimediaMessages he.json, I think we've found our culprit.

	"wikimedia-mobile-license-links": "<a href=\"\" title=\"הגדרה של רישיון קריאייטיב קומונז ייחוס–שיתוף זהה\" target=\"_blank\">CC BY-SA 3.0</a> and <a href=\"\" title=\"הגדרה של GFDL\" target=\"_blank\">GFDL</a>",

You can fix the translation at or override it in the usual way.

It also looks like the plural detection isn't working correctly, possibly because of this hack on top of a hack. T111833 is the proper solution to that problem though.

Jdlrobson edited projects, added WikimediaMessages; removed VisualEditor, MobileFrontend.
Jdlrobson added a subscriber: ovasileva.

Thanks @AntiCompositeNumber for the detective work!