Skip to content

Collect the l10n error/warning message lookup, in web/app.js, in a new helper method #12981

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

Merged
merged 3 commits into from
Feb 11, 2021

Conversation

Snuffleupagus
Copy link
Collaborator

Some of the localization strings (e.g. "loading_error") are repeated multiple times throughout the web/app.js file, which means that we need to duplicate the fallback strings as well. Furthermore, the signature of the IL10n.get method makes the call-sites quite verbose.

By adding a new helper method, in PDFViewerApplication, we're able to gather the localization fallback strings in one central spot in web/app.js and also make the lookup of the error/warning messages more compact.

This code is *very* old and it even predates the existence of arrow functions. Hence we can now reduce the overall verbosity by not having to explicitly spell out `PDFViewerApplication` everywhere.
…new helper method

Some of the localization strings (e.g. "loading_error") are repeated multiple times throughout the `web/app.js` file, which means that we need to duplicate the fallback strings as well. Furthermore, the signature of the `IL10n.get` method makes the call-sites quite verbose.

By adding a new helper method, in `PDFViewerApplication`, we're able to gather the localization fallback strings in one central spot in `web/app.js` and also make the lookup of the error/warning messages more compact.
@Snuffleupagus
Copy link
Collaborator Author

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.67.70.0:8877/f0851301ecf625c/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/f0851301ecf625c/output.txt

Total script time: 4.17 mins

Published

@timvandermeij timvandermeij merged commit d5cad9a into mozilla:master Feb 11, 2021
@timvandermeij
Copy link
Contributor

Looks much less verbose overall. Thanks!

@Snuffleupagus Snuffleupagus deleted the app-localizeMessage branch February 12, 2021 01:01
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.

3 participants