Use proper plural form in editor.searchResults and sourceSearch.resultsSummary

REOPENED
Unassigned

Status

P2
normal
REOPENED
2 years ago
2 months ago

People

(Reporter: flod, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

2 years ago
Problem was raised in https://bugzilla.mozilla.org/show_bug.cgi?id=1331654#c24 but I never filed a bug.

editor.searchResults=%d of %d results

Several languages require a proper plural form based on the second variable.
https://developer.mozilla.org/en-US/docs/Mozilla/Localization/Localization_content_best_practices#Use_proper_plural_forms

There's an additional problem though: plural form expects variables in the form #1, #2, etc.
https://hg.mozilla.org/l10n/compare-locales/file/tip/compare_locales/checks.py#l63
(Reporter)

Comment 1

2 years ago
Actually, there's another string in debugger

sourceSearch.resultsSummary=%d instances of “%S”
Summary: Use proper plural form in editor.searchResults → Use proper plural form in editor.searchResults and sourceSearch.resultsSummary

Comment 2

10 months ago
Per policy at https://wiki.mozilla.org/Bug_Triage/Projects/Bug_Handling/Bug_Husbandry#Inactive_Bugs. If this bug is not an enhancement request or a bug not present in a supported release of Firefox, then it may be reopened.
Status: NEW → RESOLVED
Last Resolved: 10 months ago
Resolution: --- → INACTIVE
(Reporter)

Updated

10 months ago
Status: RESOLVED → REOPENED
Resolution: INACTIVE → ---

Updated

9 months ago
Product: Firefox → DevTools
Hey, David could you check and see if this is still relevant?
Flags: needinfo?(dwalsh)

:flod Could you provide me the proper strings? I can get them changed ASAP.

Flags: needinfo?(dwalsh) → needinfo?(francesco.lodolo)
(Reporter)

Comment 6

2 months ago

Consider the first string.

# LOCALIZATION NOTE (editor.searchResults): Editor Search bar message
# for the summarizing the selected search result. e.g. 5 of 10 results.
editor.searchResults=%d of %d results

"results" needs to be a proper plural.

English has 2 plurals (for "1" and any other number), each one separated by a semicolon character. Also, you need to use #1 for the variable replace by the number, not %S or %d

editor.searchResultsMessage=%d of #1 result;%d of #1 results

If you really want, you can leave the first form empty, and start with a semicolon.

editor.searchResultsMessage=;%d of #1 results

You also need a specific comment (and a new ID), per https://developer.mozilla.org/en-US/docs/Mozilla/Localization/Localization_content_best_practices#Use_proper_plural_forms

# LOCALIZATION NOTE (editor.searchResultsMessage): Semi-colon list of plural forms.
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
# Editor Search bar message to summarize the selected search result. e.g. 5 of 10 results.
editor.searchResultsMessage=%d of #1 result;%d of #1 results

You need to use the plural form code to:

  • Identify the right substring to use based on #1 (PluralForm.get()), then replace #1 with the actual number of results.
  • Format the resulting string, replacing %d with the number.
Flags: needinfo?(francesco.lodolo)
You need to log in before you can comment on or make changes to this bug.