Esempio n. 1
0
 tmp.find("[translatable=\"yes\"]").each(function(i, e) {
     var old = e.outerHTML;
     var translated = cockpit.gettext(e.getAttribute("context"), $(e).text());
     $(e).removeAttr("translatable")
             .text(translated);
     tmpl = tmpl.replace(old, e.outerHTML);
 });
Esempio n. 2
0
                $.each(manifest[section] || { }, function(prop, info) {
                    var item = {
                        section: section,
                        label: cockpit.gettext(info.label) || prop,
                        order: info.order === undefined ? 1000 : info.order,
                        icon: info.icon,
                        wants: info.wants
                    };
                    if (info.path)
                        item.path = info.path.replace(/\.html$/, "");
                    else
                        item.path = name + "/" + prop;

                    /* Split out any hash in the path */
                    var pos = item.path.indexOf("#");
                    if (pos !== -1) {
                        item.hash = item.path.substr(pos + 1);
                        item.path = item.path.substr(0, pos);
                    }

                    /* Fix component for compatibility and normalize it */
                    if (item.path.indexOf("/") === -1)
                        item.path = name + "/" + item.path;
                    if (item.path.slice(-6) == "/index")
                        item.path = item.path.slice(0, -6);
                    self.items[item.path] = item;
                });
Esempio n. 3
0
$(function () {
    cockpit.translate();

    var text = _("Empty");
    $("#underscore-empty").text(text);

    text = _("verb", "Empty");
    $("#underscore-context-empty").text(text);

    text = C_("verb", "Empty");
    $("#cunderscore-context-empty").text(text);

    text = cockpit.gettext("Control");
    $("#gettext-control").text(text);

    text = cockpit.gettext("key", "Control");
    $("#gettext-context-control").text(text);

    text = cockpit.ngettext("$0 disk is missing", "$0 disks are missing", 1);
    $("#ngettext-disks-1").text(text);

    text = cockpit.ngettext("$0 disk is missing", "$0 disks are missing", 2);
    $("#ngettext-disks-2").text(text);

    text = cockpit.ngettext("disk-non-rotational", "$0 disk is missing", "$0 disks are missing", 1);
    $("#ngettext-context-disks-1").text(text);

    text = cockpit.ngettext("disk-non-rotational", "$0 disk is missing", "$0 disks are missing", 2);
    $("#ngettext-context-disks-2").text(text);

    var template = $("#mustache-input").text();
    var output = mustache.render(template);
    $("#mustache-output").empty().append(output);

    var module = angular.module('playgroundTranslate', [ 'gettext' ]);

    module.run(["$rootScope", function($rootScope) {
        cockpit.transport.wait(function() {
            $rootScope.$digest();
            $("body").show();
        });
    }]);
    angular.bootstrap(document, ['playgroundTranslate']);

});
Esempio n. 4
0
 $.each(manifest[section] || { }, function(prop, info) {
     var item = {
         section: section,
         label: cockpit.gettext(info.label) || prop,
         order: info.order === undefined ? 1000 : info.order,
         wants: info.wants
     };
     if (info.path)
         item.path = info.path.replace(/\.html$/, "");
     else
         item.path = name + "/" + prop;
     if (item.path.indexOf("/") === -1)
         item.path = name + "/" + item.path;
     if (item.path.slice(-6) == "/index")
         item.path = item.path.slice(0, -6);
     self.items[item.path] = item;
 });
Esempio n. 5
0
 .fail(function(ex) {
     ex.message = cockpit.gettext(ex.message);
     dfd.reject(ex);
 })
Esempio n. 6
0
 .fail(function(ex) {
     ex.message = cockpit.gettext(ex.message);
     perm_failed = ex;
 })