Commit b81d74c7 authored by Yuri Konotopov's avatar Yuri Konotopov

i18n: mark translatable strings in mustache templates with x-gettext tag.

parent c7ef7136
......@@ -8,7 +8,7 @@
(at your option) any later version.
*/
define(['mustache'], function(Mustache) {
define(['jquery', 'mustache'], function($, Mustache) {
return {
load: (templateFile, parentRequire, onload, config) => {
parentRequire(['text!templates/' + templateFile + '.mst'], (loadedTemplate) => {
......@@ -17,10 +17,15 @@ define(['mustache'], function(Mustache) {
return templateFile;
},
render: (model, partials) => {
return Mustache.render(loadedTemplate, model, partials);
let html = $(Mustache.render(loadedTemplate, model, partials));
// TODO: better/faster way to preparse templates?
html.find('x-gettext').replaceWith(function() {
return gettext($(this).text());
});
return html;
},
template: () => {
return loadedTemplate
return loadedTemplate;
}
});
});
......
{{#comments}}
<div class="comment">
{{#is_extension_creator}}
<div class="extension-creator-badge">Author</div>
<div class="extension-creator-badge"><x-gettext>Author</x-gettext></div>
{{/is_extension_creator}}
<img src="{{gravatar}}" class="gravatar">
<div class="rating-author">
......@@ -16,9 +16,9 @@
<hr>
{{/comments}}
{{^show_all}}
<p class="show-all">Show more reviews</p>
<p class="show-all"><x-gettext>Show more reviews</x-gettext></p>
{{/show_all}}
{{^comments}}
<p>There are no comments. Be the first!</p>
<p><x-gettext>There are no comments. Be the first!</x-gettext></p>
{{/comments}}
What's wrong?
<x-gettext>What's wrong?</x-gettext>
What have you tried?
<x-gettext>What have you tried?</x-gettext>
Automatically detected errors:
<x-gettext>Automatically detected errors</x-gettext>:
{{#errors}}
{{.}}
......@@ -14,10 +14,10 @@ Automatically detected errors:
================
{{/errors}}
{{^errors}}
GNOME Shell Extensions did not detect any errors with this extension.
<x-gettext>GNOME Shell Extensions did not detect any errors with this extension.</x-gettext>
{{/errors}}
Version information:
<x-gettext>Version information</x-gettext>:
Shell version: {{sv}}
Extension version: {{#ev}}{{ev}}{{/ev}}{{^ev}}Unknown{{/ev}}
<x-gettext>Shell version</x-gettext>: {{sv}}
<x-gettext>Extension version</x-gettext>: {{#ev}}{{ev}}{{/ev}}{{^ev}}<x-gettext>Unknown</x-gettext>{{/ev}}
......@@ -18,5 +18,5 @@
</div>
</div>
<div style="clear: both"></div>
<div class='system-extension' title='System extension should be uninstalled using package manager. See «About» page for more details.'>System extension</div>
<div class='system-extension' title='System extension should be uninstalled using package manager. See «About» page for more details.'><x-gettext>System extension</x-gettext></div>
<p class="description">{{first_line_of_description}}</p>
You uninstalled <b>{{name}}</b>.
<x-gettext>You uninstalled</x-gettext> <b>{{name}}</b>.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment