Fix bug 1265151 - Missing translation of some strings#3878
Fix bug 1265151 - Missing translation of some strings#3878jwhitlock merged 13 commits intomdn:masterfrom
Conversation
I added localization for strings 'Thanks for your feedback!' and "We won't bug you again."
Added for string "Open in "
Added gettext in places of call because it doesn't work in other way
| $('#helpful-yes').on('click', function(e) { | ||
| e.preventDefault(); | ||
| confirm('Thanks for your feedback!', 'success', 'Yes'); | ||
| confirm(gettext('Thanks for your feedback!'), 'success', 'Yes'); |
There was a problem hiding this comment.
The confirm function is currently trying to translate these strings, and will need to be modified so that double-translation is not attempted.
There was a problem hiding this comment.
Yeah. Get text should be here and not in the confirm function.
kuma/static/js/wiki-samples.js
Outdated
| var $icon = $('<i />', { 'class': 'icon-' + sampleCodeHost, 'aria-hidden': 'true' }); | ||
| // create text | ||
| var $text = 'Open in ' + this + ' '; | ||
| var $text = gettext('Open in ') + this + ' '; |
There was a problem hiding this comment.
This should instead use ngettext, like var $text = ngettext('Open in %(site)s ', this);, so that languages where the words come in a different order will be supported.
|
@bychek-ru done with my read-through, and it looks like you are also changing the code. Mention me when you're done, and I'll get you back in the code review line. |
|
I've done and fixed all problems. |
Current coverage is 85.79%@@ master #3878 diff @@
==========================================
Files 143 144 +1
Lines 8544 8557 +13
Methods 0 0
Messages 0 0
Branches 1135 1134 -1
==========================================
+ Hits 7326 7341 +15
+ Misses 980 979 -1
+ Partials 238 237 -1
|
kuma/static/js/wiki-samples.js
Outdated
| var $icon = $('<i />', { 'class': 'icon-' + sampleCodeHost, 'aria-hidden': 'true' }); | ||
| // create text | ||
| var $text = 'Open in ' + this + ' '; | ||
| var $text = ngettext('Open in %(site)s ', this); |
There was a problem hiding this comment.
I'm sorry, I'm new to the JS translation functions, and gave you bad advice. ngettext is for picking between a singular and a plural text (like ngettext('View the record', 'View the records', record_count)), but interpolate is used for populating a format string. I think this will work:
var $text = interpolate(gettext('Open in %(site)s '), {site: this});
|
@bychek-ru - one more change, to fix my |
kuma/static/js/wiki-samples.js
Outdated
| var $icon = $('<i />', { 'class': 'icon-' + sampleCodeHost, 'aria-hidden': 'true' }); | ||
| // create text | ||
| var $text = ngettext('Open in %(site)s ', this); | ||
| var $text = interpolate(gettext('Open in %(site)s '), {site: this}); |
There was a problem hiding this comment.
Please replace the tabs with 4 spaces
|
Good work, @bychek-ru 👍 |
I added localization for strings 'Thanks for your feedback!' and "We
won't bug you again."