These translations were done by Google translate, and have not been reviewed by people who speak the languages.
Only the user search page has been translated

http://admiyo.fedorapeople.org/ipa/static/index.xhtml
http://admiyo.fedorapeople.org/ipa/static/index.xhtml#lang=es
http://admiyo.fedorapeople.org/ipa/static/index.xhtml#lang=he
http://admiyo.fedorapeople.org/ipa/static/index.xhtml#lang=id
http://admiyo.fedorapeople.org/ipa/static/index.xhtml#lang=ru


You might need to his ctrl-shift-r to see the different languages.
>From 8369985f1a48358862f846fcb1bc54f498455134 Mon Sep 17 00:00:00 2001
From: Adam Young <ayo...@redhat.com>
Date: Fri, 3 Sep 2010 21:40:03 -0400
Subject: [PATCH] gettext

Proof of concept that gettext works
---
 install/static/index.xhtml             |   22 +++++-
 install/static/jquery.gettext.js       |  140 ++++++++++++++++++++++++++++++++
 install/static/navigation.js           |    6 +-
 install/static/search.js               |    5 +-
 install/static/translations/blank.json |   25 ++++++
 install/static/translations/cz.json    |   25 ++++++
 install/static/translations/en.json    |   23 +++++
 install/static/translations/es.json    |   25 ++++++
 install/static/translations/he.json    |   25 ++++++
 install/static/translations/id.json    |   25 ++++++
 install/static/translations/ru.json    |   25 ++++++
 install/static/user.js                 |    2 +-
 12 files changed, 341 insertions(+), 7 deletions(-)
 create mode 100644 install/static/jquery.gettext.js
 create mode 100644 install/static/translations/blank.json
 create mode 100644 install/static/translations/cz.json
 create mode 100644 install/static/translations/en.json
 create mode 100644 install/static/translations/es.json
 create mode 100644 install/static/translations/he.json
 create mode 100644 install/static/translations/id.json
 create mode 100644 install/static/translations/ru.json

diff --git a/install/static/index.xhtml b/install/static/index.xhtml
index 8e231f4..9f9fedc 100644
--- a/install/static/index.xhtml
+++ b/install/static/index.xhtml
@@ -7,6 +7,15 @@
 
     <script type="text/javascript" src="jquery.js"></script>
     <script type="text/javascript" src="jquery.cookie.js"></script>
+    <script type="text/javascript" src="jquery.gettext.js"></script>
+    <link href="translations/cz.json" lang="cz" rel="gettext"/>
+    <link href="translations/en.json" lang="en" rel="gettext"/>
+    <link href="translations/es.json" lang="es" rel="gettext"/>
+    <link href="translations/he.json" lang="he" rel="gettext"/>
+    <link href="translations/id.json" lang="id" rel="gettext"/>
+    <link href="translations/ru.json" lang="ru" rel="gettext"/>
+
+
     <script type="text/javascript" src="ipa.js"></script>
     <script type="text/javascript" src="navigation.js"></script>
     <script type="text/javascript" src="search.js"></script>
@@ -20,9 +29,17 @@
     <script type="text/javascript" src="hostgroup.js"></script>
     <script type="text/javascript" src="netgroup.js"></script>
 
-    <script type="text/javascript">
 
+
+    <script type="text/javascript">
       $(document).ready(function(){
+
+      qs = ipa_parse_qs();
+      var lang = qs['lang'];
+      if (lang){
+       $.gt.lang =lang;
+      }
+
       if (useSampleData)
         ipa_init("sampledata/metadata.json", buildNavigation);
       else
@@ -30,6 +47,8 @@
       });
 
     </script>
+
+
   </head>
   <body>
     <div class="header" >
@@ -37,7 +56,6 @@
 	<a href="#"><img src="ipalogo.png" /></a>
       </span>
       <span class="LoggedInAs" id="loggedinas">
-	  Logged in as <strong>hardco...@freeip.org</strong>
       </span>
     </div>
 
diff --git a/install/static/jquery.gettext.js b/install/static/jquery.gettext.js
new file mode 100644
index 0000000..87f33c0
--- /dev/null
+++ b/install/static/jquery.gettext.js
@@ -0,0 +1,140 @@
+/**
+ * gettext for jQuery
+ * 
+ * Copyright (c) 2008 Sabin Iacob (m0n5t3r) <iac...@m0n5t3r.info>
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details. 
+ *
+ * @license http://www.gnu.org/licenses/gpl.html 
+ * @project jquery.gettext
+ *
+ * Usage:
+ * 
+ * This plugin expects its input data to be a JSON object like 
+ * {"": header, "string": "translation", ...} 
+ *
+ * After getting the server side set up (either as a static file - my choice - or 
+ * as a web service), the client side is simple:
+ *  * add to the head section of the page something like 
+ *    <link href="path/to/translation.json" lang="ro" rel="gettext"/>
+ *  * in your script, use $.gt.gettext(string) or _(string); for plural forms, use
+ *    $.gt.ngettext(sg, pl1[, pl2, ...], count) or n_(sg, pl1[, pl2, ...], count)
+ *  * to extract strings to a .po file, you can use standard gettext utilities like
+ *    xgettext and msgfmt; to generate the JSON, one could use the following Python 
+ *    snippet, assuming a domain.mo file exists under path/lang/LC_MESSAGES:
+ *
+ *    import simplejson as enc
+ * 
+ *    def gettext_json(domain, path, lang = [], indent = False):
+ *        try:
+ *            tr = gettext.translation(domain, path, lang)
+ *            return enc.dumps(tr._catalog, ensure_ascii = False, indent = indent)
+ *        except IOError:
+ *            return None
+ *
+ *    why go through the additional hassle of gettext? well, it's a matter of 
+ *    preference, the main advantags I see are:
+ *     * well known editing tools like KBabel, poEdit, gtranslator, Emacs PO mode, 
+ *       etc.
+ *     * translation memory, fuzzy matches and other features that get really 
+ *       helpful when your application is big and you have hundreds of strings
+ */
+(function($) {
+	$.gt = $.gt || {};
+
+	$.extend($.gt, {
+		messages: {},
+		lang: 'C',
+		setLang: function(code) { $.gt.lang = typeof code == 'string' && code != ' ' ? code : 'C'; },
+		pl_re: /^Plural-Forms:\s*nplurals\s*=\s*(\d+);\s*plural\s*=\s*([^a-zA-Z0-9\$]*([a-zA-Z0-9\$]+).+)$/m,
+		plural: function(n) {return n != 1;},
+		load: function() {
+			$('link[rel=gettext]').each(function(){
+				var lang = this.lang;
+				$.get(this.href, function(data){
+					$.gt.messages[lang] = $.gt.messages[lang] || {};
+					try {
+						var messages = eval('(' + data + ')');
+                                            $.extend($.gt.messages[lang], messages);
+
+					} catch(e) {
+						return;
+					}
+
+
+					var pl = $.gt.pl_re.exec($.gt.messages[lang]['']);
+					if(pl){
+						var expr = pl[2];
+						var np = pl[1];
+						var v = pl[3];
+						try {
+							var fn = eval('(function(' + v + ') {return ' + expr + ';})');
+						} catch(e) {
+							return;
+						}
+						$.gt.plural = fn;
+					}
+				});
+			});
+			$.gt.setLang($('html').attr('lang'));
+		},
+		gettext: function(msgstr) {
+			var lang = $.gt.lang;
+			
+			if(lang == 'C' || typeof $.gt.messages[lang] == 'undefined') {
+				return msgstr;
+			}
+
+			var trans = $.gt.messages[lang][msgstr];
+
+			if(typeof trans == 'string') { // regular action
+				return trans;
+			} else if(typeof trans == 'object' && trans.constructor == Array) { // the translation contains plural(s), yet gettext was called
+				return trans[0];
+			}
+			return msgstr;
+		},
+		ngettext: function() {
+			var lang = $.gt.lang;
+			var argv = Array.apply(null, arguments);
+			var cnt = argv[argv.length - 1];
+			var sg = argv[0];
+			var pls = argv.slice(0, -1);
+			
+			var trans = pls;
+
+			if(lang != 'C' && typeof $.gt.messages[lang] != 'undefined') {
+				trans = $.gt.messages[lang][sg];
+			}
+
+			if(typeof trans == 'string') { // called ngettext, but no plural forms available :-?
+				return trans;
+			} else if(typeof trans == 'object' && trans.constructor == Array) {
+				var pl = $.gt.plural(cnt);
+				if(typeof pl == 'boolean' && pls.length == 2) {
+					pl = pl ? 1 : 0;
+				}
+				if(typeof pl == 'number' && pl < trans.length) {
+					return trans[pl];
+				}
+			}
+			return sg;
+		}
+	});
+
+	$('document').ready($.gt.load);
+})(jQuery);
+
+if(typeof _ == 'undefined') {
+	var _ = jQuery.gt.gettext;
+}
+if(typeof n_ == 'undefined') {
+	var n_ = jQuery.gt.ngettext;
+}
diff --git a/install/static/navigation.js b/install/static/navigation.js
index ff21fdf..d1b6bde 100644
--- a/install/static/navigation.js
+++ b/install/static/navigation.js
@@ -1,5 +1,5 @@
 function setLoggedInText(principal){
-    $("#loggedinas").html( "Logged in as  " + principal);
+    $("#loggedinas").html($.gt.gettext("header.loggedin") + ":" + principal);
 }
 
 function whoamiSuccess(response){
@@ -83,7 +83,7 @@ function buildNavigation(){
     $("<a/>",{
         "id": "tab-"+current.tab,
         href:  "#tab="+current.tab,
-        text: current.name,
+        text: $.gt.gettext("tab."+current.tab),
     }).appendTo(span);
 
     span.appendTo("#main-nav")
@@ -108,7 +108,7 @@ function buildNavigation(){
         $("<a/>",{
         "id": "subtab-"+currentSub.tab,
         href:  "#tab="+currentSub.tab,
-        text: currentSub.name,
+            text: $.gt.gettext("tab."+currentSub.tab),
         //click: setActiveSubtab,
         }).appendTo(span);
 
diff --git a/install/static/search.js b/install/static/search.js
index 95ac482..272ea26 100644
--- a/install/static/search.js
+++ b/install/static/search.js
@@ -48,7 +48,7 @@ function SearchForm(obj, method, cols, searchSampleData){
     var columnHeaders  = document.createElement("tr");
     for (var i =0 ; i != this.columns.length ;i++){
         var th = document.createElement("th");
-        th.innerHTML = this.columns[i].title;
+        th.innerHTML = $.gt.gettext(obj+"."+this.columns[i].column);
         columnHeaders.appendChild(th);
     }
     $('#searchResultsTable thead:last').append(columnHeaders);
@@ -108,6 +108,9 @@ function SearchForm(obj, method, cols, searchSampleData){
         location.hash="tab="+obj+"&facet=add";
     });
 
+        $("#new").attr('value', $.gt.gettext("button.new"));
+        $("#query").attr('value',  $.gt.gettext("button.query"));
+
     $("#query").click(executeSearch);
 
     this.buildColumnHeaders();
diff --git a/install/static/translations/blank.json b/install/static/translations/blank.json
new file mode 100644
index 0000000..5eaae4e
--- /dev/null
+++ b/install/static/translations/blank.json
@@ -0,0 +1,25 @@
+{
+  "": "header",
+ "header.loggedin": "",
+
+ "tab.user"     : ""        ,
+ "tab.group"    : ""       ,
+ "tab.host"     : ""          ,
+ "tab.hostgroup": "" ,
+ "tab.netgroup" : "",
+ "tab.identity" : ""      ,
+ "tab.policy"   : ""  ,
+ "tab.config"   : ""    ,
+
+ "button.query": "",
+ "button.new"  : "",
+
+
+ "user.cn"              : "",
+ "user.uid"             : "",
+ "user.uidnumber"       : "",
+ "user.mail"            : "",
+ "user.telephonenumber" : "",
+ "user.title"           : "",
+ "user.links"           : ""
+}
\ No newline at end of file
diff --git a/install/static/translations/cz.json b/install/static/translations/cz.json
new file mode 100644
index 0000000..5ba036d
--- /dev/null
+++ b/install/static/translations/cz.json
@@ -0,0 +1,25 @@
+{
+  "": "header",
+ "header.loggedin": "作为记录",
+
+ "tab.user"     : "用户"        ,
+ "tab.group"    : "组"       ,
+ "tab.host"     : "主办"          ,
+ "tab.hostgroup": "主机组" ,
+ "tab.netgroup" : "净组",
+ "tab.identity" : "身分"      ,
+ "tab.policy"   : "政策"  ,
+ "tab.config"   : "组态"    ,
+
+ "button.query": "查询",
+ "button.new"  : "新",
+
+
+ "user.cn"              : "名称",
+ "user.uid"             : "识别码",
+ "user.uidnumber"       : "身份证号码",
+ "user.mail"            : "电子邮件",
+ "user.telephonenumber" : "电话号码",
+ "user.title"           : "标题",
+ "user.links"           : "链接"
+}
\ No newline at end of file
diff --git a/install/static/translations/en.json b/install/static/translations/en.json
new file mode 100644
index 0000000..fbc769d
--- /dev/null
+++ b/install/static/translations/en.json
@@ -0,0 +1,23 @@
+{"": "header",
+ "string": "translation",
+ "header.loggedin": " Logged in as",
+
+ "tab.identity": "Identity",
+ "tab.user": "Users",
+ "tab.group": "Groups",
+ "tab.host": "Hosts",
+ "tab.hostgroup": "Host Groups",
+ "tab.netgroup": "Net Groups",
+ "tab.policy": "Policy",
+ "tab.config": "Configuration",
+ "button.query": "find",
+ "button.new": "new",
+
+ "user.cn"              : "Name",
+ "user.uid"             : "User ID",
+ "user.uidnumber"       : "ID Number",
+ "user.mail"            : "email",
+ "user.telephonenumber" : "Phone",
+ "user.title"           : "Title",
+ "user.links"           : "Quick Links"
+}
\ No newline at end of file
diff --git a/install/static/translations/es.json b/install/static/translations/es.json
new file mode 100644
index 0000000..8d9d033
--- /dev/null
+++ b/install/static/translations/es.json
@@ -0,0 +1,25 @@
+{"": "header",
+ "header.loggedin": "Conectado como",
+
+ "tab.user"     : "Usuarios",
+ "tab.group"    : "Groupos",
+ "tab.host"     : "Hostias",
+ "tab.hostgroup": "Groupos de Hostias",
+ "tab.netgroup" : "Groups de Red",
+ "tab.identity" : "Identidad",
+ "tab.policy"   : "Política",
+ "tab.config"   : "Configuración",
+
+ "button.query": "busque",
+ "button.new"  : "nuevo",
+
+
+ "user.cn"              : "Nobre",
+ "user.uid"             : "Id Usuario",
+ "user.uidnumber"       : "Numero de Id",
+ "user.mail"            : "correo electrónico",
+ "user.telephonenumber" : "Numero Telephonica",
+ "user.title"           : "Titulo",
+ "user.links"           : "Enlaces rápidos"
+
+}
\ No newline at end of file
diff --git a/install/static/translations/he.json b/install/static/translations/he.json
new file mode 100644
index 0000000..5e1a51d
--- /dev/null
+++ b/install/static/translations/he.json
@@ -0,0 +1,25 @@
+{"": "header",
+ "string"         : "translation",
+ "header.loggedin": "מחובר כ",
+ "tab.user"       : "משתמשים",
+ "tab.group"      : "קבוצות",
+ "tab.host"       : "המארחים",
+ "tab.hostgroup"  : "המארח קבוצות",
+ "tab.netgroup"   : "רשת הקבוצות",
+ "tab.identity"   : "זהות",
+ "tab.policy"     : "מדיניות",
+ "tab.config"     : "תצורה",
+
+ "button.query"   : "שאילתה",
+ "button.new"     : "חדש",
+
+
+ "user.cn"              : "שם",
+ "user.uid"             : "הזדהות",
+ "user.uidnumber"       : "מספר זיהוי",
+ "user.mail"            : "דוא''ל"    ,
+ "user.telephonenumber" : "מספר טלפון",
+ "user.title"           : "כותרת" ,
+ "user.links"           : "קישורים",
+
+}
\ No newline at end of file
diff --git a/install/static/translations/id.json b/install/static/translations/id.json
new file mode 100644
index 0000000..24dd8f8
--- /dev/null
+++ b/install/static/translations/id.json
@@ -0,0 +1,25 @@
+{
+  "": "header",
+ "header.loggedin": "Login Sebagai",
+
+ "tab.user"     : "Pemakai"        ,
+ "tab.group"    : "Kelompok"       ,
+ "tab.host"     : "Hosti"          ,
+ "tab.hostgroup": "Hosti Kelompok" ,
+ "tab.netgroup" : "Bersih Kelompok",
+ "tab.identity" : "Identitas"      ,
+ "tab.policy"   : "Kebijaksanaan"  ,
+ "tab.config"   : "Konfigurasi"    ,
+
+ "button.query": "pertanyaan",
+ "button.new"  : "baru",
+
+
+ "user.cn"              : "Nama",
+ "user.uid"             : "Identifikasi",
+ "user.uidnumber"       : "Identifikasi Nomor",
+ "user.mail"            : "Surat",
+ "user.telephonenumber" : "Nomor Telepon",
+ "user.title"           : "Judul",
+ "user.links"           : "Hubungan"
+}
\ No newline at end of file
diff --git a/install/static/translations/ru.json b/install/static/translations/ru.json
new file mode 100644
index 0000000..61b86c7
--- /dev/null
+++ b/install/static/translations/ru.json
@@ -0,0 +1,25 @@
+{
+  "": "header",
+ "header.loggedin": "Вы вошли как",
+
+ "tab.user"     : "Пользователь"        ,
+ "tab.group"    : "Группа"       ,
+ "tab.host"     : "Хозяин"          ,
+ "tab.hostgroup": "Принимающая группы" ,
+ "tab.netgroup" : "чистая группы",
+ "tab.identity" : "личность"      ,
+ "tab.policy"   : "политика"  ,
+ "tab.config"   : "конфигурация"    ,
+
+ "button.query": "запрос",
+ "button.new"  : "новый",
+
+
+ "user.cn"              : "имя",
+ "user.uid"             : "идентификатор",
+ "user.uidnumber"       : "идентификационный номер",
+ "user.mail"            : "электронной почты",
+ "user.telephonenumber" : "номер телефона",
+ "user.title"           : "название",
+ "user.links"           : "связи"
+}
\ No newline at end of file
diff --git a/install/static/user.js b/install/static/user.js
index 71bf3e5..67127e3 100644
--- a/install/static/user.js
+++ b/install/static/user.js
@@ -185,7 +185,7 @@ var userSearchColumns  = [
     {title:"EMAIL",    column:"mail",           render: renderSimpleColumn},
     {title:"Phone",    column:"telephonenumber",render: renderSimpleColumn},
     {title:"Job Title",column:"title",          render: renderSimpleColumn},
-    {title:"Actions",  column:"none",           render: renderUserLinks}
+    {title:"Actions",  column:"links",           render: renderUserLinks}
 ];
 
 var userSearchForm = new SearchForm("user", "find", userSearchColumns,  "sampledata/userlist.json");
-- 
1.7.1

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to