Add translation support

Add translation support by adding the language dir
with bare PO files.
All translations are changed to use their plugin domain.
This commit is contained in:
Jelle van der Waa 2016-06-09 11:13:23 +02:00
parent ecaa6e3a35
commit ec102f9c03
9 changed files with 312 additions and 33 deletions

View File

@ -44,7 +44,7 @@ Zarafa.plugins.mdm.MDM = Ext.extend(Zarafa.core.Plugin, {
Zarafa.onReady(function() { Zarafa.onReady(function() {
container.registerPlugin(new Zarafa.core.PluginMetaData({ container.registerPlugin(new Zarafa.core.PluginMetaData({
name : 'mdm', name : 'mdm',
displayName : _('Mobile device management'), displayName : _('Mobile device management', 'plugin_mdm'),
pluginConstructor : Zarafa.plugins.mdm.MDM pluginConstructor : Zarafa.plugins.mdm.MDM
})); }));
}); });

View File

@ -53,9 +53,9 @@ Zarafa.plugins.mdm.data.MDMResponseHandler = Ext.extend(Zarafa.core.data.Abstrac
*/ */
doWipe : function(response) { doWipe : function(response) {
if (response.wipe === true) { if (response.wipe === true) {
container.getNotifier().notify('info.mdm', _('Mobile Device Manager'), _('Wiping device')); container.getNotifier().notify('info.mdm', _('Mobile Device Manager'), _('Wiping device', 'plugin_mdm'));
} else { } else {
container.getNotifier().notify('info.mdm', _('Mobile Device Manager'), _('Password incorrect')); container.getNotifier().notify('info.mdm', _('Mobile Device Manager'), _('Password incorrect', 'plugin_mdm'));
} }
}, },
@ -65,7 +65,7 @@ Zarafa.plugins.mdm.data.MDMResponseHandler = Ext.extend(Zarafa.core.data.Abstrac
*/ */
doResync : function(response) { doResync : function(response) {
if (response.resync === true) { if (response.resync === true) {
container.getNotifier().notify('info.mdm', _('Mobile Device Manager'), _('Full resync in progress')); container.getNotifier().notify('info.mdm', _('Mobile Device Manager'), _('Full resync in progress', 'plugin_mdm'));
} }
} }

View File

@ -51,15 +51,15 @@ Zarafa.plugins.mdm.data.ProvisioningStatus = Zarafa.core.Enum.create({
{ {
switch (provisioningStatus) { switch (provisioningStatus) {
case Zarafa.plugins.mdm.data.ProvisioningStatus.NOT_APPLICABLE: case Zarafa.plugins.mdm.data.ProvisioningStatus.NOT_APPLICABLE:
return _('Not Applicable'); return _('Not Applicable', 'plugin_mdm');
case Zarafa.plugins.mdm.data.ProvisioningStatus.OK: case Zarafa.plugins.mdm.data.ProvisioningStatus.OK:
return _('Ok'); return _('Ok', 'plugin_mdm');
case Zarafa.plugins.mdm.data.ProvisioningStatus.WIPE_PENDING: case Zarafa.plugins.mdm.data.ProvisioningStatus.WIPE_PENDING:
return _('Wipe Pending'); return _('Wipe Pending', 'plugin_mdm');
case Zarafa.plugins.mdm.data.ProvisioningStatus.WIPE_REQUESTED: case Zarafa.plugins.mdm.data.ProvisioningStatus.WIPE_REQUESTED:
return _('Wipe Requested'); return _('Wipe Requested', 'plugin_mdm');
case Zarafa.plugins.mdm.data.ProvisioningStatus.WIPE_EXECUTED: case Zarafa.plugins.mdm.data.ProvisioningStatus.WIPE_EXECUTED:
return _('Wipe Executed'); return _('Wipe Executed', 'plugin_mdm');
} }
return ''; return '';
} }

View File

@ -21,7 +21,7 @@ Zarafa.plugins.mdm.settings.MDMSettingsCategory = Ext.extend(Zarafa.settings.ui.
config = config || {}; config = config || {};
Ext.applyIf(config, { Ext.applyIf(config, {
title : _('MDM'), title : _('MDM', 'plugin_mdm'),
iconCls : 'icon_mdm_settings', iconCls : 'icon_mdm_settings',
items : [{ items : [{
xtype : 'Zarafa.plugins.mdm.mdmsettingswidget' xtype : 'Zarafa.plugins.mdm.mdmsettingswidget'

View File

@ -16,74 +16,74 @@ Zarafa.plugins.mdm.settings.MDMSettingsWidget = Ext.extend(Zarafa.settings.ui.Se
var store = new Zarafa.plugins.mdm.data.MDMDeviceStore(); var store = new Zarafa.plugins.mdm.data.MDMDeviceStore();
Ext.applyIf(config, { Ext.applyIf(config, {
title : _('Mobile Devices'), title : _('Mobile Devices', 'plugin_mdm'),
items : [{ items : [{
xtype : 'container', xtype : 'container',
layout : 'column', layout : 'column',
items : [{ items : [{
xtype : 'grid', xtype : 'grid',
name : _('Devices'), name : _('Devices', 'plugin_mdm'),
ref : '../deviceGrid', ref : '../deviceGrid',
height : 400, height : 400,
store : store, store : store,
viewConfig : { viewConfig : {
forceFit : true, forceFit : true,
deferEmptyText: false, deferEmptyText: false,
emptyText: '<div class="emptytext">' + _('No devices connected to your account') + '</div>' emptyText: '<div class="emptytext">' + _('No devices connected to your account', 'plugin_mdm') + '</div>'
}, },
columns : [{ columns : [{
dataIndex : 'devicetype', dataIndex : 'devicetype',
header : _('Device'), header : _('Device', 'plugin_mdm'),
renderer : Ext.util.Format.htmlEncode renderer : Ext.util.Format.htmlEncode
},{ },{
dataIndex : 'useragent', dataIndex : 'useragent',
header : _('User Agent'), header : _('User Agent', 'plugin_mdm'),
renderer : Ext.util.Format.htmlEncode renderer : Ext.util.Format.htmlEncode
},{ },{
dataIndex : 'wipestatus', dataIndex : 'wipestatus',
header : _('Provisioning Status'), header : _('Provisioning Status', 'plugin_mdm'),
renderer : Zarafa.plugins.mdm.ui.Renderers.provisioningStatus renderer : Zarafa.plugins.mdm.ui.Renderers.provisioningStatus
},{ },{
dataIndex : 'lastupdatetime', dataIndex : 'lastupdatetime',
header : _('Last Update'), header : _('Last Update', 'plugin_mdm'),
renderer : Ext.util.Format.htmlEncode renderer : Ext.util.Format.htmlEncode
},{ },{
dataIndex : 'entryid', dataIndex : 'entryid',
header : _('Device ID'), header : _('Device ID', 'plugin_mdm'),
renderer : Ext.util.Format.htmlEncode renderer : Ext.util.Format.htmlEncode
},{ },{
dataIndex : 'deviceos', dataIndex : 'deviceos',
header : _('Device OS'), header : _('Device OS', 'plugin_mdm'),
hidden : true, hidden : true,
renderer : Ext.util.Format.htmlEncode renderer : Ext.util.Format.htmlEncode
},{ },{
dataIndex : 'devicefriendlyname', dataIndex : 'devicefriendlyname',
header : _('Device Info'), header : _('Device Info', 'plugin_mdm'),
hidden : true, hidden : true,
renderer : Ext.util.Format.htmlEncode renderer : Ext.util.Format.htmlEncode
},{ },{
dataIndex : 'firstsynctime', dataIndex : 'firstsynctime',
header : _('First Sync time'), header : _('First Sync time', 'plugin_mdm'),
hidden : true, hidden : true,
renderer : Ext.util.Format.htmlEncode renderer : Ext.util.Format.htmlEncode
}], }],
buttons : [{ buttons : [{
text : _('Wipe Device'), text : _('Wipe Device', 'plugin_mdm'),
ref : '../../../wipeBtn', ref : '../../../wipeBtn',
handler : this.onWipeBtn, handler : this.onWipeBtn,
scope : this scope : this
},{ },{
text : _('Full resync'), text : _('Full resync', 'plugin_mdm'),
ref : '../../../resyncBtn', ref : '../../../resyncBtn',
handler : this.onFullResync, handler : this.onFullResync,
scope : this scope : this
},{ },{
text : _('Remove device'), text : _('Remove device', 'plugin_mdm'),
ref : '../../../removeBtn', ref : '../../../removeBtn',
handler : this.onRemoveDevice, handler : this.onRemoveDevice,
scope : this scope : this
},{ },{
text : _('Refresh'), text : _('Refresh', 'plugin_mdm'),
ref : '../../../refresh', ref : '../../../refresh',
handler : this.onRefresh, handler : this.onRefresh,
scope : this scope : this
@ -102,8 +102,8 @@ Zarafa.plugins.mdm.settings.MDMSettingsWidget = Ext.extend(Zarafa.settings.ui.Se
onWipeBtn : function() onWipeBtn : function()
{ {
var msgbox = Ext.MessageBox.show({ var msgbox = Ext.MessageBox.show({
title: _('Kopano WebApp'), title: _('Kopano WebApp', 'plugin_mdm'),
msg: _('Do you really want to wipe your device?\n Enter your password to confirm.'), msg: _('Do you really want to wipe your device?\n Enter your password to confirm.', 'plugin_mdm'),
inputType :'password', inputType :'password',
icon: Ext.MessageBox.WARNING, icon: Ext.MessageBox.WARNING,
buttons: Ext.MessageBox.YESNO, buttons: Ext.MessageBox.YESNO,

View File

@ -0,0 +1,138 @@
#: js/data/MDMResponseHandler.js:56 js/data/MDMResponseHandler.js:58
#: js/data/MDMResponseHandler.js:68
msgid "Mobile Device Manager"
msgstr ""
#: js/data/MDMResponseHandler.js:56
msgid "Wiping device"
msgstr ""
#: js/data/MDMResponseHandler.js:58
msgid "Password incorrect"
msgstr ""
#: js/data/MDMResponseHandler.js:68
msgid "Full resync in progress"
msgstr ""
#: js/data/ProvisioningStatus.js:54
msgid "Not Applicable"
msgstr ""
#: js/data/ProvisioningStatus.js:56
msgid "Ok"
msgstr ""
#: js/data/ProvisioningStatus.js:58
msgid "Wipe Pending"
msgstr ""
#: js/data/ProvisioningStatus.js:60
msgid "Wipe Requested"
msgstr ""
#: js/data/ProvisioningStatus.js:62
msgid "Wipe Executed"
msgstr ""
#: js/MDM.js:47
msgid "Mobile device management"
msgstr ""
#: js/settings/MDMSettingsCategory.js:24
msgid "MDM"
msgstr ""
#: js/settings/MDMSettingsWidget.js:19
msgid "Mobile Devices"
msgstr ""
#: js/settings/MDMSettingsWidget.js:25
msgid "Devices"
msgstr ""
#: js/settings/MDMSettingsWidget.js:32
msgid "No devices connected to your account"
msgstr ""
#: js/settings/MDMSettingsWidget.js:36
msgid "Device"
msgstr ""
#: js/settings/MDMSettingsWidget.js:40
msgid "User Agent"
msgstr ""
#: js/settings/MDMSettingsWidget.js:44
msgid "Provisioning Status"
msgstr ""
#: js/settings/MDMSettingsWidget.js:48
msgid "Last Update"
msgstr ""
#: js/settings/MDMSettingsWidget.js:52
msgid "Device ID"
msgstr ""
#: js/settings/MDMSettingsWidget.js:56
msgid "Device OS"
msgstr ""
#: js/settings/MDMSettingsWidget.js:61
msgid "Device Info"
msgstr ""
#: js/settings/MDMSettingsWidget.js:66
msgid "First Sync time"
msgstr ""
#: js/settings/MDMSettingsWidget.js:71
msgid "Wipe Device"
msgstr ""
#: js/settings/MDMSettingsWidget.js:76
msgid "Full resync"
msgstr ""
#: js/settings/MDMSettingsWidget.js:81
msgid "Remove device"
msgstr ""
#: js/settings/MDMSettingsWidget.js:86
msgid "Refresh"
msgstr ""
#: js/settings/MDMSettingsWidget.js:105
msgid "Kopano WebApp"
msgstr ""
#: js/settings/MDMSettingsWidget.js:106
msgid ""
"Do you really want to wipe your device?\n"
" Enter your password to confirm."
msgstr ""
#: php/class.pluginmdmmodule.php:184
msgid "Something went wrong."
msgstr ""
#: php/class.pluginmdmmodule.php:187
msgid "Unable to connect to Z-Push Server. Unauthorized."
msgstr ""
#: php/class.pluginmdmmodule.php:190
msgid "Unable to connect to Z-Push Server. Could not connect to host."
msgstr ""
#: php/class.pluginmdmmodule.php:193
msgid "Unable to connect to Z-Push Server. Not found."
msgstr ""
#: php/class.pluginmdmmodule.php:196
msgid "Device ID could not be found"
msgstr ""
#: php/class.pluginmdmmodule.php:201
msgid "Something went wrong"
msgstr ""

View File

@ -0,0 +1,138 @@
#: js/data/MDMResponseHandler.js:56 js/data/MDMResponseHandler.js:58
#: js/data/MDMResponseHandler.js:68
msgid "Mobile Device Manager"
msgstr ""
#: js/data/MDMResponseHandler.js:56
msgid "Wiping device"
msgstr ""
#: js/data/MDMResponseHandler.js:58
msgid "Password incorrect"
msgstr ""
#: js/data/MDMResponseHandler.js:68
msgid "Full resync in progress"
msgstr ""
#: js/data/ProvisioningStatus.js:54
msgid "Not Applicable"
msgstr ""
#: js/data/ProvisioningStatus.js:56
msgid "Ok"
msgstr ""
#: js/data/ProvisioningStatus.js:58
msgid "Wipe Pending"
msgstr ""
#: js/data/ProvisioningStatus.js:60
msgid "Wipe Requested"
msgstr ""
#: js/data/ProvisioningStatus.js:62
msgid "Wipe Executed"
msgstr ""
#: js/MDM.js:47
msgid "Mobile device management"
msgstr ""
#: js/settings/MDMSettingsCategory.js:24
msgid "MDM"
msgstr ""
#: js/settings/MDMSettingsWidget.js:19
msgid "Mobile Devices"
msgstr ""
#: js/settings/MDMSettingsWidget.js:25
msgid "Devices"
msgstr ""
#: js/settings/MDMSettingsWidget.js:32
msgid "No devices connected to your account"
msgstr ""
#: js/settings/MDMSettingsWidget.js:36
msgid "Device"
msgstr ""
#: js/settings/MDMSettingsWidget.js:40
msgid "User Agent"
msgstr ""
#: js/settings/MDMSettingsWidget.js:44
msgid "Provisioning Status"
msgstr ""
#: js/settings/MDMSettingsWidget.js:48
msgid "Last Update"
msgstr ""
#: js/settings/MDMSettingsWidget.js:52
msgid "Device ID"
msgstr ""
#: js/settings/MDMSettingsWidget.js:56
msgid "Device OS"
msgstr ""
#: js/settings/MDMSettingsWidget.js:61
msgid "Device Info"
msgstr ""
#: js/settings/MDMSettingsWidget.js:66
msgid "First Sync time"
msgstr ""
#: js/settings/MDMSettingsWidget.js:71
msgid "Wipe Device"
msgstr ""
#: js/settings/MDMSettingsWidget.js:76
msgid "Full resync"
msgstr ""
#: js/settings/MDMSettingsWidget.js:81
msgid "Remove device"
msgstr ""
#: js/settings/MDMSettingsWidget.js:86
msgid "Refresh"
msgstr ""
#: js/settings/MDMSettingsWidget.js:105
msgid "Kopano WebApp"
msgstr ""
#: js/settings/MDMSettingsWidget.js:106
msgid ""
"Do you really want to wipe your device?\n"
" Enter your password to confirm."
msgstr ""
#: php/class.pluginmdmmodule.php:184
msgid "Something went wrong."
msgstr ""
#: php/class.pluginmdmmodule.php:187
msgid "Unable to connect to Z-Push Server. Unauthorized."
msgstr ""
#: php/class.pluginmdmmodule.php:190
msgid "Unable to connect to Z-Push Server. Could not connect to host."
msgstr ""
#: php/class.pluginmdmmodule.php:193
msgid "Unable to connect to Z-Push Server. Not found."
msgstr ""
#: php/class.pluginmdmmodule.php:196
msgid "Device ID could not be found"
msgstr ""
#: php/class.pluginmdmmodule.php:201
msgid "Something went wrong"
msgstr ""

View File

@ -12,6 +12,9 @@
<config> <config>
<configfile>config.php</configfile> <configfile>config.php</configfile>
</config> </config>
<translations>
<translationsdir>language</translationsdir>
</translations>
<components> <components>
<component> <component>
<files> <files>

View File

@ -181,24 +181,24 @@ class PluginMDMModule extends Module
$this->handleUnknownActionType($actionType); $this->handleUnknownActionType($actionType);
} }
} catch (SoapFault $fault) { } catch (SoapFault $fault) {
$display_message = _('Something went wrong.'); $display_message = _('Something went wrong.', 'plugin_mdm');
if ($fault->faultcode === 'HTTP') { if ($fault->faultcode === 'HTTP') {
if ($fault->getMessage() === "Unauthorized") { if ($fault->getMessage() === "Unauthorized") {
$display_message = _('Unable to connect to Z-Push Server. Unauthorized.'); $display_message = _('Unable to connect to Z-Push Server. Unauthorized.', 'plugin_mdm');
} }
if ($fault->getMessage() === "Could not connect to host") { if ($fault->getMessage() === "Could not connect to host") {
$display_message = _('Unable to connect to Z-Push Server. Could not connect to host.'); $display_message = _('Unable to connect to Z-Push Server. Could not connect to host.', 'plugin_mdm');
} }
if ($fault->getMessage() === "Not Found") { if ($fault->getMessage() === "Not Found") {
$display_message = _('Unable to connect to Z-Push Server. Not found.'); $display_message = _('Unable to connect to Z-Push Server. Not found.', 'plugin_mdm');
} }
} else if ($fault->faultcode === "ERROR") { } else if ($fault->faultcode === "ERROR") {
$display_message = _('Device ID could not be found'); $display_message = _('Device ID could not be found', 'plugin_mdm');
} }
$this->sendFeedback(false, array("type" => ERROR_GENERAL, "info" => array('display_message' => $display_message))); $this->sendFeedback(false, array("type" => ERROR_GENERAL, "info" => array('display_message' => $display_message)));
} }
catch (Exception $e) { catch (Exception $e) {
$this->sendFeedback(true, array("type" => ERROR_GENERAL, "info" => array('display_message' => _('Something went wrong')))); $this->sendFeedback(true, array("type" => ERROR_GENERAL, "info" => array('display_message' => _('Something went wrong', 'plugin_mdm'))));
} }
} }
} }