-
Notifications
You must be signed in to change notification settings - Fork 54
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
i18n UI messages, and start showing explanations for rules from the old checker #160
Conversation
@deniak, assigning to you because at least you saw the beginning of this work weeks ago. I know I haven't done a good job at explaining the changes, so please ask me about this. And if you can think of simpler, safer ways to do this, let me know too! |
@tripu, that's a lot of commits up there. Did you mess something up on your local copy? You probably don't want to have all of them merged and squash some of them before merging. |
+1 to squash the commits |
5e2a2f8
to
53bc74c
Compare
Set locale in "lib/validator.js". Added Denis' JSON dump of all rules. Conflicts: lib/l10n-en_GB.js lib/l10n-es_ES.js lib/l10n.js lib/rules.json lib/validator.js
53bc74c
to
e6d47f4
Compare
Hum, the fact that an old commit of mine (aka already in master) appears in this PR is very likely (in my understanding) to ask to rewrite the history in master :-/ |
9672c17
to
21113b3
Compare
I'm a bit unclear: does this PR add any feature? Spanish support, even if poor, seems one. If so, maybe this should have triggered version That said... urgh to |
Having these two messages in Spanish serves mainly as a test to prove that the new i18n feature works. i18n is a byproduct of the refactoring I've done here. Actually translating the tool is not something I intend to do any time soon… The actual feature is that we can start showing detailed, formatted descriptions for rules (exactly the same texts you see in the old pubrules checker) by simply filling in all the selectors in Finally, those selectors are the reason I'm using |
Fix copy removed accidentally around PR #160
Changes, in a nutshell (a large nutshell):
l10n.js
are now duplicated in two languages:l10n-en_GB.js
andl10n-es_ES.js
.heuristic.group.candidate
andheuristic.group.not-found
, which are translated into Spanish (for testing purposes).lang
to the general configuration invalidator.js
(set toen_GB
).rules.json
so that now, instead of being a huge array, it's a huge object. And the IDs of profiles (WD
,REC
, etc) are the keys in that object.l10n-selectors.js
. This file associates each ID of a user message (the same we have inl10n-en_GB.js
) with the JS selector that will retrieve the user-friendly, verbose description of a rule. These selectors are applied torules.json
callingeval()
(yes,eval()
!). These user-friendly descriptions are the ones you see in the old pubrules checker.l10n-selectors.js
resolve correctly to strings inrules.json
. This is to make the whole thing a bit more robust — writing selectors like this, and passing them along toeval()
would be error-prone otherwise.Work that is pending, and improvements:
rules.json
ideally should produce this version (a large object, instead of a large array).validator.js
).eval()
; do it better.l10n-selectors.js
assumes that the profile isWD
. When we start supporting other types of docs in Echidna, we'll have to refactor this, so that the profile is a parameter.