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

[GENERIC viewer] Try to fixup "incomplete" language codes (issue 13689) #13696

Merged
merged 1 commit into from
Jul 9, 2021

Conversation

Snuffleupagus
Copy link
Collaborator

While I don't know if it's technically correct to even do this, it could provide a slightly better out-of-the-box behaviour in browsers that specify (from the PDF.js l10n-folder perspective) "incomplete" language codes.

Rather than immediately falling back to English, we'll use a white-list to try and re-write a "partial" language code to a (hopefully) suitable one that matches an existing l10n-folder. The disadvantage of this solution is that the list needs to be kept manually up-to-date with any changes in the l10n-folder, however new locales are added infrequently enough that this should be acceptable.

Fixes #13689 (assuming we actually want/care to do so, otherwise we should just WONTFIX the issue).

@Snuffleupagus Snuffleupagus force-pushed the issue-13689 branch 2 times, most recently from fb51880 to 7318783 Compare July 8, 2021 10:48
While I don't know if it's technically correct to even do this, it could provide a slightly better out-of-the-box behaviour in browsers that specify (from the PDF.js `l10n`-folder perspective) "incomplete" language codes.

Rather than immediately falling back to English, we'll use a white-list to try and re-write a "partial" language code to a (hopefully) suitable one that matches an existing `l10n`-folder. The disadvantage of this solution is that the list needs to be kept *manually* up-to-date with any changes in the `l10n`-folder, however new locales are added infrequently enough that this should be acceptable.

Fixes 13689 (assuming we actually want/care to do so, otherwise we should just WONTFIX the issue).
@Snuffleupagus
Copy link
Collaborator Author

/botio-linux preview

@pdfjsbot
Copy link

pdfjsbot commented Jul 8, 2021

From: Bot.io (Linux m4)


Received

Command cmd_preview from @Snuffleupagus received. Current queue size: 1

Live output at: http://54.67.70.0:8877/421cbf7d3595454/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Jul 8, 2021

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/421cbf7d3595454/output.txt

Total script time: 5.23 mins

Published

@timvandermeij timvandermeij merged commit 62b5dc9 into mozilla:master Jul 9, 2021
@timvandermeij
Copy link
Contributor

Thanks! I'm fine with this small change indeed if it improves the overall out-of-the-box behavior of the viewer.

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.

Localization does not work for sv (Swedish) in Edge (but does in Chrome that reports sv-SE).
3 participants