refactor(mailer): Increase comprehensibility of device description #227
Conversation
|
Hi @RPraneetha, thanks for the contribution! There's one tricky part of this bug that we should have said more words about over in #193 - localization. The current device description string is not localized because it doesn't contain any additional words. Now that we're saying "X on Y", we need to connect this to the translation machinery so that it can be localized into all supported locales. Take a look at the The logic for
The call to There is also a suite of tests that will need to be updated to match the new logic, at [1]. The strings that @ryanfeeley provided in [2] might make good additional test cases, if they're not covered by the ones already there. [1] https://github.com/mozilla/fxa-auth-mailer/blob/master/test/local/mailer_tests.js#L481 |
|
(By the way, there's no need to close this PR and open a fresh you, you can just make additional commits to your git branch and push them, and they'll show up as modifications to this PR) |
|
Okay! I'll get working on that! |
|
@rfk Something like this? |
| var uaOSVersion = message.uaOSVersion | ||
|
|
||
| if (uaBrowser && uaOS) { | ||
| return translator.format(translator.gettext('%(uaBrowser)s on %(uaOS)%(uaOSVersion)'), { uaBrowser: uaBrowser, uaOS: uaOS, uaOSVersion: uaOSVersion }) |
vladikoff
Oct 21, 2016
Contributor
line 143 seems really long, i suggest adding a line break right after on %(uaOS)%(uaOSVersion)'),
line 143 seems really long, i suggest adding a line break right after on %(uaOS)%(uaOSVersion)'),
vladikoff
Oct 21, 2016
Contributor
hm interesting that there is no space between %(uaOS)%(uaOSVersion) but tests still have a space between OS and Version
hm interesting that there is no space between %(uaOS)%(uaOSVersion) but tests still have a space between OS and Version
| var os = message.uaOS | ||
| if (message.uaOSVersion) { | ||
| os += ' ' + message.uaOSVersion | ||
| else{ |
vladikoff
Oct 21, 2016
Contributor
need a space between else and {
need a space between else and {
| if (message.uaOSVersion) { | ||
| os += ' ' + message.uaOSVersion | ||
| else{ | ||
| if (uaBrowser){ |
vladikoff
Oct 21, 2016
Contributor
need a space before {
need a space before {
|
| if (uaBrowser){ | ||
| return uaBrowser | ||
| } | ||
| else if (uaOS) { |
vladikoff
Oct 21, 2016
Contributor
bring else if to the same line as 148 so it is: } else if (uaOS) {
bring else if to the same line as 148 so it is: } else if (uaOS) {
|
@RPraneetha seems like there are test failures: You can check that locally by using |
|
Sorry, committed by accident! Was previewing changes but clicked on commit by mistake. |
No worries! |
|
Thanks for fixing up the tests, going to review this now in detail! |
|
@RPraneetha thank you! |
fix #193