Page MenuHomePhabricator

When translation falls-back, does not use fall-back language's plural rules
Closed, ResolvedPublic8 Estimated Story PointsBUG REPORT

Description

What is the problem?

When language x does not have a translation and falls-back to language y, the plural rules for language x are still applied, even if not appropriate for language y.

For example, in Belarusian numbers like 21, 31, 41, etc. count as singular. If you watch a page for 21 days, the watchlist-expiring-days-full-text message incorrectly tells you 1 day left... because that is the English translation's singular variant of that message.

Steps to reproduce problem
  1. Watch a page for 21 days (e.g. https://en.wikipedia.beta.wmflabs.org/wiki/Special:ApiSandbox#action=watch&format=json&expiry=21%20days&titles=Foobar)
  2. Go to Special:Preferences and change your language to be - беларуская
  3. Visit the page you just watched and hover over the watch star

Expected behavior: Tooltip says "21 days left..."
Observed behavior: Tooltip says "1 day left..."

Environment

Browser: Firefox 78 and Chrome 87
Wiki(s): https://en.wikipedia.beta.wmflabs.org MediaWiki 1.36.0-alpha (77e1b24) 10:00, 23 лістапада 2020


Derived Requirement

Ensure that when a language falls back to another language's translation, the plural rules used are those of the fallback language, not the original language.

Test Steps

Test Case 1: Ensure fallback translation uses fallback language's plural rules

  1. Watch any page using the API with an expiry of 21 days (e.g., https://en.wikipedia.beta.wmflabs.org/wiki/Special:ApiSandbox#action=watch&format=json&expiry=21%20days&titles=Foobar).
  2. Go to #Special:Preferences and set your interface language to Belarusian (беларуская).
  3. Visit the watched page.
  4. Hover over the watch star icon.
  5. ✅❓❌⬜ AC1: Confirm that the tooltip correctly says "21 days left..." using plural rules from English (fallback language), not Belarusian.

Test Case 2: Ensure fallback pluralization applies consistently for other fallback cases

  1. Repeat the above steps but use a different duration such as 22 or 25 days.
  2. Observe the tooltip text each time.
  3. ✅❓❌⬜ AC2: Confirm that plural forms from the fallback language (English) are applied consistently for each number, regardless of the original language’s plural rules.

QA Results - Test Beta

ACStatusDetails
1✅T268492#10793960
2✅T268492#10793960

Event Timeline

Change #1120261 had a related patch set uploaded (by Tim Starling; author: Tim Starling):

[mediawiki/core@master] language: When using a fallback message, parse with the fallback's language

https://gerrit.wikimedia.org/r/1120261

Change #1120261 merged by jenkins-bot:

[mediawiki/core@master] language: When using a fallback message, parse with the fallback's language

https://gerrit.wikimedia.org/r/1120261

@tstarling Confirmed that the tooltip correctly says the right thing when using plural rules from English (fallback language), not Belarusian, as seen from the gifs. I will mark this as Resolved. Thanks for all your work!

Test Result - Test Beta

Status: ✅ PASS
Environment: Test Beta
OS: macOS Sequoia 15.4.1
Browser: Chrome 135
Device: MBA
Emulated Device: NA

Test Artifact(s):

Test Steps

Test Case 1: Ensure fallback translation uses fallback language's plural rules

  1. Watch any page using the API with an expiry of 21 days (e.g., https://en.wikipedia.beta.wmflabs.org/wiki/Special:ApiSandbox#action=watch&format=json&expiry=21%20days&titles=Foobar).
  2. Go to #Special:Preferences and set your interface language to Belarusian (беларуская).
  3. Visit the watched page.
  4. Hover over the watch star icon.
  5. ✅ AC1: Confirm that the tooltip correctly says "21 days left..." using plural rules from English (fallback language), not Belarusian.
21 Daysbe-->uselang=en
2025-05-05_11-24-14.mp4.gif (1,662×820 px, 3 MB)
2025-05-05_12-45-47.mp4.gif (1,678×818 px, 1 MB)

Test Case 2: Ensure fallback pluralization applies consistently for other fallback cases

  1. Repeat the above steps but use a different duration such as 22 or 25 days.
  2. Observe the tooltip text each time.
  3. ✅ AC2: Confirm that plural forms from the fallback language (English) are applied consistently for each number, regardless of the original language’s plural rules.
25 Days
2025-05-05_12-44-32.mp4.gif (1,666×856 px, 1 MB)
GMikesell-WMF updated the task description. (Show Details)
GMikesell-WMF updated Other Assignee, removed: GMikesell-WMF.

Change #1143149 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/core@master] Revert "language: When using a fallback message, parse with the fallback's language"

https://gerrit.wikimedia.org/r/1143149

Change #1143149 abandoned by Jdlrobson:

[mediawiki/core@master] Revert "language: When using a fallback message, parse with the fallback's language"

https://gerrit.wikimedia.org/r/1143149