LP#1708291: introduce egI18N
authorGalen Charlton <gmc@equinoxinitiative.org>
Thu, 29 Jun 2017 21:09:54 +0000 (17:09 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Fri, 4 Aug 2017 17:45:35 +0000 (13:45 -0400)
egI18N is a module that will serve as a grab-bag of functions
related to I18N and L10N. The initial function it provides
takes a acpl IDL object and returns a formatted name qualified
by the org unit, with the underlying template accessible
to the translation subsystem.

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/templates/staff/base_js.tt2
Open-ILS/web/js/ui/default/staff/Gruntfile.js
Open-ILS/web/js/ui/default/staff/services/coresvc.js
Open-ILS/web/js/ui/default/staff/services/i18n.js [new file with mode: 0644]
Open-ILS/web/js/ui/default/staff/test/karma.conf.js

index 82b662e..88f9d15 100644 (file)
@@ -43,6 +43,7 @@
 <script src="[% ctx.media_prefix %]/js/ui/default/staff/services/user.js"></script>
 <script src="[% ctx.media_prefix %]/js/ui/default/staff/services/navbar.js"></script>
 <script src="[% ctx.media_prefix %]/js/ui/default/staff/services/ui.js"></script>
+<script src="[% ctx.media_prefix %]/js/ui/default/staff/services/i18n.js"></script>
 <script src="[% ctx.media_prefix %]/js/ui/default/staff/services/date.js"></script>
 <script src="[% ctx.media_prefix %]/js/ui/default/staff/services/op_change.js"></script>
 
@@ -87,6 +88,7 @@
     s.OP_CHANGE_PERM_MESSAGE = "[% l('Another staff member with the above permission may authorize this specific action.  Please notify your library administrator if you need this permission.  If you feel you have received this exception in error, please inform your friendly Evergreen developers or helpdesk staff of the above permission.') %]";
     s.PERM_OP_CHANGE_SUCCESS = "[% l('Permission Override Login Succeeded') %]";
     s.PERM_OP_CHANGE_FAILURE = "[% l('Permission Override Login Failed') %]";
+    s.LOCATION_NAME_OU_QUALIFIED = "[% l('{{location_name}} ({{owning_lib_shortname}})') %]";
   }]);
 </script>
 
index e594196..502f74d 100644 (file)
@@ -168,6 +168,7 @@ module.exports = function(grunt) {
             'services/ui.js',
             'services/date.js',
             'services/op_change.js',
+            'services/i18n.js'
         ],
         dest: 'build/js/<%= pkg.name %>.<%= pkg.version %>.min.js'
       },
index f754770..c1218cc 100644 (file)
@@ -10,10 +10,10 @@ angular.module('egCoreMod')
 .factory('egCore', 
        ['egIDL','egNet','egEnv','egOrg','egPCRUD','egEvent','egAuth',
         'egPerm','egHatch','egPrint','egStartup','egStrings','egAudio',
-        'egDate',
+        'egDate','egI18N',
 function(egIDL , egNet , egEnv , egOrg , egPCRUD , egEvent , egAuth ,
          egPerm , egHatch , egPrint , egStartup , egStrings , egAudio , 
-         egDate) {
+         egDate , egI18N) {
 
     return {
         idl     : egIDL,
@@ -29,7 +29,8 @@ function(egIDL , egNet , egEnv , egOrg , egPCRUD , egEvent , egAuth ,
         startup : egStartup,
         strings : egStrings,
         audio   : egAudio,
-        date    : egDate
+        date    : egDate,
+        i18n    : egI18N
     };
 
 }]);
diff --git a/Open-ILS/web/js/ui/default/staff/services/i18n.js b/Open-ILS/web/js/ui/default/staff/services/i18n.js
new file mode 100644 (file)
index 0000000..2c521d0
--- /dev/null
@@ -0,0 +1,22 @@
+/**
+ * egI18N : service for I18N and L10N functions
+ *
+ * This is a grab-bag of stuff related to I18N.
+ *
+ */
+
+angular.module('egCoreMod')
+.factory('egI18N', ['egStrings',
+            function(egStrings) {
+    return {
+        ou_qualified_location_name : function(loc) {
+            return egStrings.$replace(
+                egStrings.LOCATION_NAME_OU_QUALIFIED,
+                {
+                    location_name : loc.name(),
+                    owning_lib_shortname : loc.owning_lib().shortname()
+                }
+            );
+        }        
+    }
+}]);
index 87d6731..900cb67 100644 (file)
@@ -45,6 +45,7 @@ module.exports = function(config){
       'services/grid.js',
       'services/op_change.js',
       'services/navbar.js', 'services/date.js',
+      'services/i18n.js',
       // load app scripts
       'app.js',
       'circ/**/*.js',