[icinga-checkins] icinga.org: icinga-web/cdoebler/default: * added base for i18n

Christian Doebler christian.doebler at netways.de
Thu Oct 1 14:28:36 CEST 2009


Module: icinga-web
Branch: cdoebler/default
Commit: 6c466e98f1d9736038e93d77b959251798dc92fd
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=6c466e98f1d9736038e93d77b959251798dc92fd

Author: Christian Doebler <christian.doebler at netways.de>
Date:   Thu Oct  1 13:50:14 2009 +0200

* added base for i18n
* modified host popup to display tables

---

 app/config/translation.xml                         |    4 +-
 .../System/ViewProc/js/IcingaColumnRenderer.js     |    2 +-
 ...cingaApiSimpleDataProviderSuccessView.class.php |   17 +++--
 data/i18n/en.po                                    |   14 ----
 lib/appkit/js/SimpleDataProvider.js                |   13 ++++-
 lib/appkit/js/ext/FilterHandler.js                 |    2 +-
 res/i18n/mo/de.mo                                  |  Bin 0 -> 286 bytes
 res/i18n/mo/en.mo                                  |  Bin 0 -> 1279 bytes
 {data/i18n => res/i18n/po}/de.po                   |    0 
 res/i18n/po/en.po                                  |   68 ++++++++++++++++++++
 res/i18n/updatepo.sh                               |   19 ++++++
 11 files changed, 114 insertions(+), 25 deletions(-)

diff --git a/app/config/translation.xml b/app/config/translation.xml
index 73cd765..24f93a9 100755
--- a/app/config/translation.xml
+++ b/app/config/translation.xml
@@ -2,7 +2,7 @@
 <ae:configurations xmlns:ae="http://agavi.org/agavi/config/global/envelope/1.0" xmlns="http://agavi.org/agavi/config/parts/translation/1.0">
 	<ae:configuration>
 		
-		<available_locales default_locale="de_DE" default_timezone="Europe/London">
+		<available_locales default_locale="en_US" default_timezone="GMT">
 			<!-- German, Germany -->
 			<available_locale identifier="de_DE">
 				<ae:parameter name="description">Deutsch</ae:parameter>
@@ -45,7 +45,7 @@
 			<translator domain="icinga">
 				<message_translator class="AgaviGettextTranslator">
 					<ae:parameter name="text_domains">
-						<ae:parameter name="icinga">%core.app_dir%/data/i18n</ae:parameter>
+						<ae:parameter name="icinga">%core.root_dir%/res/i18n/mo</ae:parameter>
 					</ae:parameter>
 				</message_translator>
 				
diff --git a/app/modules/Cronks/templates/System/ViewProc/js/IcingaColumnRenderer.js b/app/modules/Cronks/templates/System/ViewProc/js/IcingaColumnRenderer.js
index 408b852..4ca1fc6 100644
--- a/app/modules/Cronks/templates/System/ViewProc/js/IcingaColumnRenderer.js
+++ b/app/modules/Cronks/templates/System/ViewProc/js/IcingaColumnRenderer.js
@@ -49,7 +49,7 @@ AppKit.Ext.grid.IcingaColumnRenderer = {
 				var sdp = new SimpleDataProvider({
 					targetXY: [e.getPageX(), e.getPageY() - 50],
 					srcId: cfg.src_id,
-					width: 200,
+					width: 400,
 					delay: 15000,
 					filter: cfg.processedFilterData
 				});
diff --git a/app/modules/Web/views/IcingaApiSimpleDataProviderSuccessView.class.php b/app/modules/Web/views/IcingaApiSimpleDataProviderSuccessView.class.php
index a0570a5..a857ce0 100644
--- a/app/modules/Web/views/IcingaApiSimpleDataProviderSuccessView.class.php
+++ b/app/modules/Web/views/IcingaApiSimpleDataProviderSuccessView.class.php
@@ -27,19 +27,24 @@ class Web_IcingaApiSimpleDataProviderSuccessView extends ICINGAWebBaseView
 
 		$result = $model->setSourceId($srcId)->setFilter($filter)->fetch();
 
+		$tm = $this->getContext()->getTranslationManager();
+
 		foreach ($result as $row) {
-			$dataTmp = array();
 			foreach ($result->getRow() as $key => $value) {
-				$dataTmp[$key] = $value;
+				$dataTmp = array (
+					'key'	=> $tm->_($key),
+					'value'	=> $value,
+				);
+				array_push($jsonData['result']['data'], $dataTmp);
 			}
-			array_push($jsonData['result']['data'], $dataTmp);
 		}
 
-		// store final count
+		// store final count and convert
 		$jsonData['result']['count'] = count($jsonData['result']['data']);
-		//var_dump($jsonData);
+		$jsonDataEnc = json_encode($jsonData);
+		//var_dump(array($jsonData, $jsonDataEnc));
 
-		return json_encode($jsonData);
+		return $jsonDataEnc;
 
 	}
 
diff --git a/data/i18n/en.po b/data/i18n/en.po
deleted file mode 100644
index 9cf43fd..0000000
--- a/data/i18n/en.po
+++ /dev/null
@@ -1,14 +0,0 @@
-# Orginal translation
-
-msgid ""
-msgstr ""
-
-"Project-Id-Version: net_dbdata\n" 
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: \n"
-"PO-Revision-Date: \n"
-"Last-Translator: Marius Hein\n"
-"Language-Team: \n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
diff --git a/lib/appkit/js/SimpleDataProvider.js b/lib/appkit/js/SimpleDataProvider.js
index 350636b..c98303a 100644
--- a/lib/appkit/js/SimpleDataProvider.js
+++ b/lib/appkit/js/SimpleDataProvider.js
@@ -81,7 +81,18 @@ function SimpleDataProvider (config) {
 		};
 
 		this.outputTable = function (el, success, response, options) {
-			//console.log(response.responseText);
+			var responseObj = Ext.util.JSON.decode(response.responseText);
+			var tpl = new Ext.XTemplate(
+				'<table cellpadding="0" cellspacing="0" border="0">',
+				'<tpl for="data">',
+					'<tr>',
+						'<td>{key}</td>',
+						'<td>{value}</td>',
+					'</tr>',
+				'</tpl>',
+				'</table>'
+			);
+			tpl.overwrite(el, responseObj.result);
 		};
 
 		this.reset();
diff --git a/lib/appkit/js/ext/FilterHandler.js b/lib/appkit/js/ext/FilterHandler.js
index 1198233..15065b7 100644
--- a/lib/appkit/js/ext/FilterHandler.js
+++ b/lib/appkit/js/ext/FilterHandler.js
@@ -151,7 +151,7 @@ AppKit.Ext.FilterHandler = Ext.extend(Ext.util.Observable, {
 			triggerAction : 'all',
 			forceSelection : true,
 					
-			fieldLabel : '<?php echo $tm->_("Operator"); ?>',
+			fieldLabel : "Operator",
 			
 			valueField : 'id',
 			displayField : 'label',
diff --git a/res/i18n/mo/de.mo b/res/i18n/mo/de.mo
new file mode 100644
index 0000000..5b9bb31
Binary files /dev/null and b/res/i18n/mo/de.mo differ
diff --git a/res/i18n/mo/en.mo b/res/i18n/mo/en.mo
new file mode 100644
index 0000000..59cdd18
Binary files /dev/null and b/res/i18n/mo/en.mo differ
diff --git a/data/i18n/de.po b/res/i18n/po/de.po
similarity index 100%
rename from data/i18n/de.po
rename to res/i18n/po/de.po
diff --git a/res/i18n/po/en.po b/res/i18n/po/en.po
new file mode 100644
index 0000000..cb12e0f
--- /dev/null
+++ b/res/i18n/po/en.po
@@ -0,0 +1,68 @@
+# Orginal translation
+
+msgid ""
+msgstr ""
+
+"Project-Id-Version: Icinga-Web\n" 
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: \n"
+"PO-Revision-Date: \n"
+"Last-Translator: Christian Doebler\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+msgid "host_address"
+msgstr "Address"
+
+msgid "host_alias"
+msgstr "Alias"
+
+msgid "host_display_name"
+msgstr "Display name"
+
+msgid "host_current_state"
+msgstr "Current state"
+
+msgid "host_output"
+msgstr "Output"
+
+msgid "host_perfdata"
+msgstr "Performance data"
+
+msgid "host_current_check_attempt"
+msgstr "Current check attempt"
+
+msgid "host_max_check_attempts"
+msgstr "Max check attempts"
+
+msgid "host_last_check"
+msgstr "Last check"
+
+msgid "host_check_type"
+msgstr "Check type"
+
+msgid "host_latency"
+msgstr "Latency"
+
+msgid "host_execution_time"
+msgstr "Execution time"
+
+msgid "host_next_check"
+msgstr "Next check"
+
+msgid "host_last_hard_state_change"
+msgstr "Hard state change"
+
+msgid "host_last_notification"
+msgstr "Last notification"
+
+msgid "host_is_flapping"
+msgstr "Is flapping"
+
+msgid "host_scheduled_downtime_depth"
+msgstr "Scheduled downtime depth"
+
+msgid "host_status_update_time"
+msgstr "Status update time"
diff --git a/res/i18n/updatepo.sh b/res/i18n/updatepo.sh
new file mode 100644
index 0000000..022a1f8
--- /dev/null
+++ b/res/i18n/updatepo.sh
@@ -0,0 +1,19 @@
+#/bin/bash
+
+#
+# updatepo.sh - generates all language files
+#
+# created 2008 by Marius Hein <marius.hein at netways.de>
+# modified for Icinga-Web 2009 by Christian Doebler <christian.doebler at netways.de>
+#
+
+TEXTDOMAIN=icinga
+INDIR=po
+OUTDIR=mo
+BIN=$(which msgfmt)
+
+for IT in $INDIR/*.po; do
+	NEWFILE=$(basename $IT '.po').mo
+	echo -n "$IT -> $OUTDIR/$NEWFILE: "
+	$BIN $IT -v -o $OUTDIR/$NEWFILE
+done





More information about the icinga-checkins mailing list