Use dgettext which handles translation domains

The PHP code should use a translation function which can handle a textdomain as argument.

References: KMP-10
This commit is contained in:
Jelle van der Waa 2016-08-11 11:08:54 +02:00
parent a3c9ffaa73
commit b9548dec8d

View File

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