changeset 1433:246a8b1019d4

add i18n to global index javascript; Requires following cs to move index_action.js from /static/js/ to /templates/
author Roger Haase <crosseyedpenguin@yahoo.com>
date Mon, 16 Jul 2012 08:23:17 -0700
parents 33466da28757
children 5b83b088da6e
files MoinMoin/static/js/index_action.js MoinMoin/templates/index.html
diffstat 2 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/static/js/index_action.js	Sun Jul 15 23:51:17 2012 +0200
+++ b/MoinMoin/static/js/index_action.js	Mon Jul 16 08:23:17 2012 -0700
@@ -15,8 +15,10 @@
         IFRAME_CREATE_DELAY = 200, // delay between start of multiple downloads
         IFRAME_REMOVE_DELAY = 3000, // life expectancy of iframe used for file downloads
         MESSAGE_VIEW_TIME = 4000, // life expectancy of delete/destroy status messages
-        ACTION_LOADING = {"delete": "Deleting..", "destroy": "Destroying.."}, // process started messages
-        ACTION_DONE = {"delete": "deleted", "destroy": "destroyed"}; // process completed messages
+        // delete and destroy process started and completed messages
+        {{ "ACTION_LOADING = {'delete': '%s', 'destroy': '%s'}," % (_("Deleting.."), _("Destroying..")) }}
+        {{ "ACTION_DONE = {'delete': '%s', 'destroy': '%s'}," % (_("Items deleted: "), _("Items destroyed: ")) }}
+        {{ "ACTION_FAILED = {'delete': '%s', 'destroy': '%s'};" % (_(", Items not deleted: "), _(", Items not destroyed: ")) }}
 
     // called by click handlers New Item, Delete item, and Destroy item within Actions dropdown menu
     function showpop(action) {
@@ -105,9 +107,9 @@
                 }
             });
             // show a message summarizing delete/destroy results for 4 seconds
-            message = "Items " + ACTION_DONE[action] + ": " + success_item;
+            message = ACTION_DONE[action] + success_item;
             if (left_item) {
-                message += ", Items not " + ACTION_DONE[action] + ": " + left_item + ".";
+                message += ACTION_FAILED[action] + left_item + ".";
             }
             $(".moin-index-message span").text(message);
             setTimeout(function () {
@@ -181,7 +183,7 @@
     $("#moin-download-trigger").click(function () {
         if (!($("div.selected-item").length)) {
             // no items selected, show message for 4 seconds
-            $(".moin-index-message span").text("Nothing was selected.");
+            {{ "$('.moin-index-message span').text('%s');" % _("Nothing was selected.") }}
             $(".moin-index-message").fadeIn();
             setTimeout(function () {
                 $(".moin-index-message").fadeOut();
@@ -202,7 +204,7 @@
     $(".moin-action-tab").click(function () {
         // Show error msg if nothing selected, else show comment popup. Hide actions dropdown.
         if (!($("div.selected-item").length)) {
-            $(".moin-index-message span").text("Nothing was selected.");
+            {{ "$('.moin-index-message span').text('%s');" % _("Nothing was selected.") }}
             $(".moin-index-message").fadeIn();
             setTimeout(function () {
                 $(".moin-index-message").fadeOut();
--- a/MoinMoin/templates/index.html	Sun Jul 15 23:51:17 2012 +0200
+++ b/MoinMoin/templates/index.html	Mon Jul 16 08:23:17 2012 -0700
@@ -9,7 +9,7 @@
 
 {% block head_scripts %}
 {{ super() }}
-    <script src="{{ url_for('static', filename='js/index_action.js') }}"></script>
+    <script src="{{ url_for('frontend.template', filename='index_action.js') }}"></script>
 {% endblock %}
 
 {% block content %}