Closed jrrdev closed 6 years ago
Commit for retrieve default_locale from manifest.json
task have been pushed, see https://github.com/RequestPolicyContinued/requestpolicy/pull/881/commits/fc16fae71f86e1f85750d00030d3cd9285f10aa5
Thank you! I will look into your changes after my vacations. Until then, I will comment on some of your changes. Keep up the great work! 👍👍
I added few commits to improve make check-locales
command and to make some related fixes.
I won't commit anything else beside review corrections to this branch.
Hi @jrrdev
so far I've made some minor corrections on https://github.com/myrdd/requestpolicy/commits/feature/we-i18n
These are a few notes: (I'm not finished with the review yet, sorry for the delay)
yourpolicy.js
and overlay.js
const $str = browser.i18n.getMessage.bind(browser.i18n);
and then e.g. $str("redirectNotification")
to make the code shorterAdd locale message for some hard-coded text (e.g old_rules.html, experimental.html)
Experimental features do not need to be localized IMHO. The old_rules
page can be considered to be localized; however, for Firefox 57+ users that page is obsolete. The "old rules" refer to v0.5.x rules, which cannot be accessed by a WE.
I'm going to complete the review now.
Hi @jrrdev
so far I've made some minor corrections on https://github.com/myrdd/requestpolicy/commits/feature/we-i18n
These are a few notes: (I'm not finished with the review yet, sorry for the delay)
- license headers in new GPL files
- put your name there instead of mine.
- put there only one year (2017)
yourpolicy.js
andoverlay.js
- please use
const $str = browser.i18n.getMessage.bind(browser.i18n);
and then e.g.$str("redirectNotification")
to make the code shorter
@myrdd: I merged your corrections in this PR and made the requested changes :wink:
Hi @jrrdev, I've fixed some issues, made some refactorings and codings style changes, rebased onto and merged into develop
. The merge commit is https://github.com/RequestPolicyContinued/requestpolicy/commit/3b2c656dae08da780e96b11c30dd88c637830184. Note that I also changed the directory structure a bit, the api is now at src/conditional/legacy/content/bootstrap/content/models/api/
Changelog
Based on myrdd/feature/we-i18n branch Fixes Issue #873:
*.properties
tomessage.json
filesinstall.rdf
to the WE i18n json filesgulpfile.js
to create theINSTALL_RDF_I18N
string for install.rdf by parsing the i18n json files.browser.i18n.getMessage()
functionStringUtils.$str()
bybrowser.i18n.getMessage()
*.properties
filesdefault_locale
frommanifest.json
Notes
fr_CA
(Canadian french) orzh_cmn_Hans_CN
(Chinese, Mandarin, Simplified script, as used in China) should work if the corresponding directory exists in_locales/
. Thus, I made the FakeAPI to support any valid BCP 47 tag as well.messages.json
(likerp.menu.foo
) because they weren't i18n compliant. The message key format is described hereFor the moment, default_locale is hard coded toen_US
. I will try to retrieve it frommanifest.json
later (should be easy with existing manifest.js)chrome-files.js
andlocale-data.js
are released under MPL-2.0 because it use some code from Mozillal10n.js
is released under MIT License (from https://github.com/piroor/webextensions-lib-l10n)LocaleManager
serves the same purpose as some code from Mozilla'sExtension.jsm
(locales loading) but logics and implementation are completely different.Future enhancements proposals
Some proposals to consider when we will have some spare time (I guess after WE transition):
old_rules.html
,experimental.html
)Enhancemake check-locales
to give informations about missing translated keys for each language in comparison to default locale (for instance, I noticed some missing keys infr/messages.json
)Are they relevant ? What do you think about it ?
Tests
make lint
=> OKmake mocha
=> OKI performed manual tests on
Firefox ESR 52.5.1 Nightly
andFirefox 56.0b12 Developer Edition
. OS Language wasfr_FR
(Ubuntu 16.04 32 bits):<page> asked redirect to <target>
yellow text