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

Improve plural support for the matches counter #10078

Merged
merged 1 commit into from
Sep 16, 2018

Conversation

timvandermeij
Copy link
Contributor

@timvandermeij timvandermeij commented Sep 15, 2018

Fixes #10076.

@timvandermeij
Copy link
Contributor Author

/botio-windows preview

Copy link
Contributor

@flodolo flodolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no way to test this, but I believe it should work.

find_matches_count[other]={{current}} of {{total}} matches
# LOCALIZATION NOTE (find_matches_count_limit): The supported plural forms are
find_match_count={[ plural(n) ]}
find_match_count[zero]={{current}} of {{total}} matches
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This particular case should never happen, since when there's no matches the counter is hidden.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope; please note that total must be non-zero for the message to be displayed in the first place, see https://github.com/mozilla/pdf.js/blob/master/web/pdf_find_bar.js#L162 and https://searchfox.org/mozilla-central/source/toolkit/content/widgets/findbar.js#1131.

I'll admit that this was perhaps not as clear as it could have been, given that the line in pdf_find_bar.js probably should have been e.g. if (total > 0) { instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in the new commit.

find_matches_count[one]={{current}} of {{total}} match
find_matches_count[other]={{current}} of {{total}} matches
# LOCALIZATION NOTE (find_matches_count_limit): The supported plural forms are
find_match_count={[ plural(n) ]}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having looked at the Firefox findbar implementation again, see here, I'm no longer convinced that there's any attempt to format these numbers according to locale.
So it might be possible to simplify this by removing the toLocaleString() calls from the JS code, and change this to just {[ plural(total) ]} respectively {[ plural(limit) ]} for for the other string below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll also check in the browser and if it doesn't do the formatting either, I'll indeed remove it and use total/limit in the plural.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in the new commit. The browser find bar indeed also doesn't do any formatting according to locale, so I've removed that here too.

@timvandermeij
Copy link
Contributor Author

/botio-windows preview

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_preview from @timvandermeij received. Current queue size: 0

Live output at: http://54.215.176.217:8877/1781dcbe329b133/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://54.215.176.217:8877/1781dcbe329b133/output.txt

Total script time: 4.30 mins

Published

@timvandermeij timvandermeij merged commit 0e41eb1 into mozilla:master Sep 16, 2018
@timvandermeij timvandermeij deleted the l10n-fix branch September 16, 2018 13:25
@timvandermeij
Copy link
Contributor Author

@rvandermeulen Could you do a new upstream merge that contains these changes? This is necessary for a correct localization of these strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants