Repository: incubator-guacamole-client Updated Branches: refs/heads/master f891f6982 -> 403c578da
GUACAMOLE-36: Migrate guacLogin and guacNotification to TranslatableMessage. Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/986ea4b2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/986ea4b2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/986ea4b2 Branch: refs/heads/master Commit: 986ea4b206ef6322cad629cecb4ec86dc7642d8a Parents: 0671f18 Author: Michael Jumper <[email protected]> Authored: Tue Aug 16 21:47:26 2016 -0700 Committer: Michael Jumper <[email protected]> Committed: Tue Jan 3 19:42:24 2017 -0800 ---------------------------------------------------------------------- .../app/client/controllers/clientController.js | 16 ++++++++++++---- .../webapp/app/index/controllers/indexController.js | 4 ++-- .../src/main/webapp/app/login/directives/login.js | 10 ++++++---- .../src/main/webapp/app/login/templates/login.html | 6 ++++-- .../controllers/manageConnectionController.js | 8 +++++--- .../controllers/manageConnectionGroupController.js | 8 +++++--- .../controllers/manageSharingProfileController.js | 8 +++++--- .../app/manage/controllers/manageUserController.js | 15 ++++++++++----- .../app/notification/services/guacNotification.js | 4 +++- .../notification/templates/guacNotification.html | 4 +++- .../webapp/app/notification/types/Notification.js | 2 +- .../settings/directives/guacSettingsPreferences.js | 14 ++++++++++---- .../app/settings/directives/guacSettingsSessions.js | 6 ++++-- 13 files changed, 70 insertions(+), 35 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/986ea4b2/guacamole/src/main/webapp/app/client/controllers/clientController.js ---------------------------------------------------------------------- diff --git a/guacamole/src/main/webapp/app/client/controllers/clientController.js b/guacamole/src/main/webapp/app/client/controllers/clientController.js index b522568..9827de1 100644 --- a/guacamole/src/main/webapp/app/client/controllers/clientController.js +++ b/guacamole/src/main/webapp/app/client/controllers/clientController.js @@ -578,7 +578,9 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams || connectionState === ManagedClientState.ConnectionState.WAITING) { guacNotification.showStatus({ title: "CLIENT.DIALOG_HEADER_CONNECTING", - text: "CLIENT.TEXT_CLIENT_STATUS_" + connectionState.toUpperCase() + text: { + key : "CLIENT.TEXT_CLIENT_STATUS_" + connectionState.toUpperCase() + } }); } @@ -595,7 +597,9 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams notifyConnectionClosed({ className : "error", title : "CLIENT.DIALOG_HEADER_CONNECTION_ERROR", - text : "CLIENT.ERROR_CLIENT_" + errorName, + text : { + key : "CLIENT.ERROR_CLIENT_" + errorName + }, countdown : countdown, actions : actions }); @@ -615,7 +619,9 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams notifyConnectionClosed({ className : "error", title : "CLIENT.DIALOG_HEADER_CONNECTION_ERROR", - text : "CLIENT.ERROR_TUNNEL_" + errorName, + text : { + key : "CLIENT.ERROR_TUNNEL_" + errorName + }, countdown : countdown, actions : actions }); @@ -626,7 +632,9 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams else if (connectionState === ManagedClientState.ConnectionState.DISCONNECTED) { notifyConnectionClosed({ title : "CLIENT.DIALOG_HEADER_DISCONNECTED", - text : "CLIENT.TEXT_CLIENT_STATUS_" + connectionState.toUpperCase(), + text : { + key : "CLIENT.TEXT_CLIENT_STATUS_" + connectionState.toUpperCase() + }, actions : actions }); } http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/986ea4b2/guacamole/src/main/webapp/app/index/controllers/indexController.js ---------------------------------------------------------------------- diff --git a/guacamole/src/main/webapp/app/index/controllers/indexController.js b/guacamole/src/main/webapp/app/index/controllers/indexController.js index 25e6b61..e17ecee 100644 --- a/guacamole/src/main/webapp/app/index/controllers/indexController.js +++ b/guacamole/src/main/webapp/app/index/controllers/indexController.js @@ -38,7 +38,7 @@ angular.module('index').controller('indexController', ['$scope', '$injector', * The message to display to the user as instructions for the login * process. * - * @type String + * @type TranslatableMessage */ $scope.loginHelpText = null; @@ -160,7 +160,7 @@ angular.module('index').controller('indexController', ['$scope', '$injector', $scope.$on('guacInsufficientCredentials', function loginInsufficient(event, parameters, error) { $scope.page.title = 'APP.NAME'; $scope.page.bodyClassName = ''; - $scope.loginHelpText = error.message; + $scope.loginHelpText = error.translatableMessage; $scope.acceptedCredentials = parameters; $scope.expectedCredentials = error.expected; }); http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/986ea4b2/guacamole/src/main/webapp/app/login/directives/login.js ---------------------------------------------------------------------- diff --git a/guacamole/src/main/webapp/app/login/directives/login.js b/guacamole/src/main/webapp/app/login/directives/login.js index aa03af2..cc820b8 100644 --- a/guacamole/src/main/webapp/app/login/directives/login.js +++ b/guacamole/src/main/webapp/app/login/directives/login.js @@ -36,7 +36,7 @@ angular.module('login').directive('guacLogin', [function guacLogin() { * An optional instructional message to display within the login * dialog. * - * @type String + * @type TranslatableMessage */ helpText : '=', @@ -72,7 +72,7 @@ angular.module('login').directive('guacLogin', [function guacLogin() { /** * A description of the error that occurred during login, if any. * - * @type String + * @type TranslatableMessage */ $scope.loginError = null; @@ -160,11 +160,13 @@ angular.module('login').directive('guacLogin', [function guacLogin() { // Flag generic error for invalid login if (error.type === Error.Type.INVALID_CREDENTIALS) - $scope.loginError = 'LOGIN.ERROR_INVALID_LOGIN'; + $scope.loginError = { + 'key' : 'LOGIN.ERROR_INVALID_LOGIN' + }; // Display error if anything else goes wrong else - $scope.loginError = error.message; + $scope.loginError = error.translatableMessage; // Clear all visible password fields angular.forEach($scope.remainingFields, function clearEnteredValueIfPassword(field) { http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/986ea4b2/guacamole/src/main/webapp/app/login/templates/login.html ---------------------------------------------------------------------- diff --git a/guacamole/src/main/webapp/app/login/templates/login.html b/guacamole/src/main/webapp/app/login/templates/login.html index b9d9335..26a3f18 100644 --- a/guacamole/src/main/webapp/app/login/templates/login.html +++ b/guacamole/src/main/webapp/app/login/templates/login.html @@ -1,7 +1,8 @@ <div class="login-ui" ng-class="{error: loginError, continuation: isContinuation(), initial: !isContinuation()}" > <!-- Login error message --> - <p class="login-error">{{loginError | translate}}</p> + <p class="login-error" translate="{{loginError.key}}" + translate-values="{{loginError.variables}}"></p> <div class="login-dialog-middle"> @@ -17,7 +18,8 @@ </div> <!-- Login message/instructions --> - <p ng-show="helpText">{{helpText | translate}}</p> + <p ng-show="helpText" translate="{{helpText.key}}" + translate-values="{{helpText.variables}}"></p> <!-- Login fields --> <div class="login-fields"> http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/986ea4b2/guacamole/src/main/webapp/app/manage/controllers/manageConnectionController.js ---------------------------------------------------------------------- diff --git a/guacamole/src/main/webapp/app/manage/controllers/manageConnectionController.js b/guacamole/src/main/webapp/app/manage/controllers/manageConnectionController.js index a911ab2..868842e 100644 --- a/guacamole/src/main/webapp/app/manage/controllers/manageConnectionController.js +++ b/guacamole/src/main/webapp/app/manage/controllers/manageConnectionController.js @@ -380,7 +380,7 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i guacNotification.showStatus({ 'className' : 'error', 'title' : 'MANAGE_CONNECTION.DIALOG_HEADER_ERROR', - 'text' : error.message, + 'text' : error.translatableMessage, 'actions' : [ ACKNOWLEDGE_ACTION ] }); }); @@ -430,7 +430,7 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i guacNotification.showStatus({ 'className' : 'error', 'title' : 'MANAGE_CONNECTION.DIALOG_HEADER_ERROR', - 'text' : error.message, + 'text' : error.translatableMessage, 'actions' : [ ACKNOWLEDGE_ACTION ] }); }); @@ -446,7 +446,9 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i // Confirm deletion request guacNotification.showStatus({ 'title' : 'MANAGE_CONNECTION.DIALOG_HEADER_CONFIRM_DELETE', - 'text' : 'MANAGE_CONNECTION.TEXT_CONFIRM_DELETE', + 'text' : { + key : 'MANAGE_CONNECTION.TEXT_CONFIRM_DELETE' + }, 'actions' : [ DELETE_ACTION, CANCEL_ACTION] }); http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/986ea4b2/guacamole/src/main/webapp/app/manage/controllers/manageConnectionGroupController.js ---------------------------------------------------------------------- diff --git a/guacamole/src/main/webapp/app/manage/controllers/manageConnectionGroupController.js b/guacamole/src/main/webapp/app/manage/controllers/manageConnectionGroupController.js index 0d0af59..e4c6115 100644 --- a/guacamole/src/main/webapp/app/manage/controllers/manageConnectionGroupController.js +++ b/guacamole/src/main/webapp/app/manage/controllers/manageConnectionGroupController.js @@ -220,7 +220,7 @@ angular.module('manage').controller('manageConnectionGroupController', ['$scope' guacNotification.showStatus({ 'className' : 'error', 'title' : 'MANAGE_CONNECTION_GROUP.DIALOG_HEADER_ERROR', - 'text' : error.message, + 'text' : error.translatableMessage, 'actions' : [ ACKNOWLEDGE_ACTION ] }); }); @@ -270,7 +270,7 @@ angular.module('manage').controller('manageConnectionGroupController', ['$scope' guacNotification.showStatus({ 'className' : 'error', 'title' : 'MANAGE_CONNECTION_GROUP.DIALOG_HEADER_ERROR', - 'text' : error.message, + 'text' : error.translatableMessage, 'actions' : [ ACKNOWLEDGE_ACTION ] }); }); @@ -286,7 +286,9 @@ angular.module('manage').controller('manageConnectionGroupController', ['$scope' // Confirm deletion request guacNotification.showStatus({ 'title' : 'MANAGE_CONNECTION_GROUP.DIALOG_HEADER_CONFIRM_DELETE', - 'text' : 'MANAGE_CONNECTION_GROUP.TEXT_CONFIRM_DELETE', + 'text' : { + key : 'MANAGE_CONNECTION_GROUP.TEXT_CONFIRM_DELETE' + }, 'actions' : [ DELETE_ACTION, CANCEL_ACTION] }); http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/986ea4b2/guacamole/src/main/webapp/app/manage/controllers/manageSharingProfileController.js ---------------------------------------------------------------------- diff --git a/guacamole/src/main/webapp/app/manage/controllers/manageSharingProfileController.js b/guacamole/src/main/webapp/app/manage/controllers/manageSharingProfileController.js index 96657d1..ca7d11e 100644 --- a/guacamole/src/main/webapp/app/manage/controllers/manageSharingProfileController.js +++ b/guacamole/src/main/webapp/app/manage/controllers/manageSharingProfileController.js @@ -341,7 +341,7 @@ angular.module('manage').controller('manageSharingProfileController', ['$scope', guacNotification.showStatus({ 'className' : 'error', 'title' : 'MANAGE_SHARING_PROFILE.DIALOG_HEADER_ERROR', - 'text' : error.message, + 'text' : error.translatableMessage, 'actions' : [ ACKNOWLEDGE_ACTION ] }); }); @@ -379,7 +379,7 @@ angular.module('manage').controller('manageSharingProfileController', ['$scope', guacNotification.showStatus({ 'className' : 'error', 'title' : 'MANAGE_SHARING_PROFILE.DIALOG_HEADER_ERROR', - 'text' : error.message, + 'text' : error.translatableMessage, 'actions' : [ ACKNOWLEDGE_ACTION ] }); }); @@ -395,7 +395,9 @@ angular.module('manage').controller('manageSharingProfileController', ['$scope', // Confirm deletion request guacNotification.showStatus({ 'title' : 'MANAGE_SHARING_PROFILE.DIALOG_HEADER_CONFIRM_DELETE', - 'text' : 'MANAGE_SHARING_PROFILE.TEXT_CONFIRM_DELETE', + 'text' : { + 'key' : 'MANAGE_SHARING_PROFILE.TEXT_CONFIRM_DELETE' + }, 'actions' : [ DELETE_ACTION, CANCEL_ACTION] }); http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/986ea4b2/guacamole/src/main/webapp/app/manage/controllers/manageUserController.js ---------------------------------------------------------------------- diff --git a/guacamole/src/main/webapp/app/manage/controllers/manageUserController.js b/guacamole/src/main/webapp/app/manage/controllers/manageUserController.js index 7a4db92..5337caf 100644 --- a/guacamole/src/main/webapp/app/manage/controllers/manageUserController.js +++ b/guacamole/src/main/webapp/app/manage/controllers/manageUserController.js @@ -1012,7 +1012,9 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto guacNotification.showStatus({ 'className' : 'error', 'title' : 'MANAGE_USER.DIALOG_HEADER_ERROR', - 'text' : 'MANAGE_USER.ERROR_PASSWORD_MISMATCH', + 'text' : { + key : 'MANAGE_USER.ERROR_PASSWORD_MISMATCH' + }, 'actions' : [ ACKNOWLEDGE_ACTION ] }); return; @@ -1055,7 +1057,8 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto guacNotification.showStatus({ 'className' : 'error', 'title' : 'MANAGE_USER.DIALOG_HEADER_ERROR', - 'text' : error.message, + 'text' : error.translatableMessage, + 'values' : error.translationValues, 'actions' : [ ACKNOWLEDGE_ACTION ] }); }); @@ -1067,7 +1070,7 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto guacNotification.showStatus({ 'className' : 'error', 'title' : 'MANAGE_USER.DIALOG_HEADER_ERROR', - 'text' : error.message, + 'text' : error.translatableMessage, 'actions' : [ ACKNOWLEDGE_ACTION ] }); }); @@ -1117,7 +1120,7 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto guacNotification.showStatus({ 'className' : 'error', 'title' : 'MANAGE_USER.DIALOG_HEADER_ERROR', - 'text' : error.message, + 'text' : error.translatableMessage, 'actions' : [ ACKNOWLEDGE_ACTION ] }); }); @@ -1133,7 +1136,9 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto // Confirm deletion request guacNotification.showStatus({ 'title' : 'MANAGE_USER.DIALOG_HEADER_CONFIRM_DELETE', - 'text' : 'MANAGE_USER.TEXT_CONFIRM_DELETE', + 'text' : { + key : 'MANAGE_USER.TEXT_CONFIRM_DELETE' + }, 'actions' : [ DELETE_ACTION, CANCEL_ACTION] }); http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/986ea4b2/guacamole/src/main/webapp/app/notification/services/guacNotification.js ---------------------------------------------------------------------- diff --git a/guacamole/src/main/webapp/app/notification/services/guacNotification.js b/guacamole/src/main/webapp/app/notification/services/guacNotification.js index 8273eb7..c3d4a2b 100644 --- a/guacamole/src/main/webapp/app/notification/services/guacNotification.js +++ b/guacamole/src/main/webapp/app/notification/services/guacNotification.js @@ -60,7 +60,9 @@ angular.module('notification').factory('guacNotification', ['$injector', * // To show a status message with actions * guacNotification.showStatus({ * 'title' : 'Disconnected', - * 'text' : 'You have been disconnected!', + * 'text' : { + * 'key' : 'NAMESPACE.SOME_TRANSLATION_KEY' + * }, * 'actions' : { * 'name' : 'reconnect', * 'callback' : function () { http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/986ea4b2/guacamole/src/main/webapp/app/notification/templates/guacNotification.html ---------------------------------------------------------------------- diff --git a/guacamole/src/main/webapp/app/notification/templates/guacNotification.html b/guacamole/src/main/webapp/app/notification/templates/guacNotification.html index db3360a..6c1cc00 100644 --- a/guacamole/src/main/webapp/app/notification/templates/guacNotification.html +++ b/guacamole/src/main/webapp/app/notification/templates/guacNotification.html @@ -8,7 +8,9 @@ <div class="body"> <!-- Notification text --> - <p ng-show="notification.text" class="text">{{notification.text | translate}}</p> + <p ng-show="notification.text" class="text" + translate="{{notification.text.key}}" + translate-values="{{notification.text.variables}}"></p> <!-- Current progress --> <div class="progress" ng-show="notification.progress"><div class="bar" ng-show="progressPercent" ng-style="{'width': progressPercent + '%'}"></div><div http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/986ea4b2/guacamole/src/main/webapp/app/notification/types/Notification.js ---------------------------------------------------------------------- diff --git a/guacamole/src/main/webapp/app/notification/types/Notification.js b/guacamole/src/main/webapp/app/notification/types/Notification.js index 3a28401..921fa40 100644 --- a/guacamole/src/main/webapp/app/notification/types/Notification.js +++ b/guacamole/src/main/webapp/app/notification/types/Notification.js @@ -53,7 +53,7 @@ angular.module('notification').factory('Notification', [function defineNotificat /** * The body text of the notification. * - * @type String + * @type TranslatableMessage */ this.text = template.text; http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/986ea4b2/guacamole/src/main/webapp/app/settings/directives/guacSettingsPreferences.js ---------------------------------------------------------------------- diff --git a/guacamole/src/main/webapp/app/settings/directives/guacSettingsPreferences.js b/guacamole/src/main/webapp/app/settings/directives/guacSettingsPreferences.js index 934056b..0a3ed6e 100644 --- a/guacamole/src/main/webapp/app/settings/directives/guacSettingsPreferences.js +++ b/guacamole/src/main/webapp/app/settings/directives/guacSettingsPreferences.js @@ -127,7 +127,9 @@ angular.module('settings').directive('guacSettingsPreferences', [function guacSe guacNotification.showStatus({ className : 'error', title : 'SETTINGS_PREFERENCES.DIALOG_HEADER_ERROR', - text : 'SETTINGS_PREFERENCES.ERROR_PASSWORD_MISMATCH', + text : { + key : 'SETTINGS_PREFERENCES.ERROR_PASSWORD_MISMATCH' + }, actions : [ ACKNOWLEDGE_ACTION ] }); return; @@ -138,7 +140,9 @@ angular.module('settings').directive('guacSettingsPreferences', [function guacSe guacNotification.showStatus({ className : 'error', title : 'SETTINGS_PREFERENCES.DIALOG_HEADER_ERROR', - text : 'SETTINGS_PREFERENCES.ERROR_PASSWORD_BLANK', + text : { + key : 'SETTINGS_PREFERENCES.ERROR_PASSWORD_BLANK' + }, actions : [ ACKNOWLEDGE_ACTION ] }); return; @@ -155,7 +159,9 @@ angular.module('settings').directive('guacSettingsPreferences', [function guacSe // Indicate that the password has been changed guacNotification.showStatus({ - text : 'SETTINGS_PREFERENCES.INFO_PASSWORD_CHANGED', + text : { + key : 'SETTINGS_PREFERENCES.INFO_PASSWORD_CHANGED' + }, actions : [ ACKNOWLEDGE_ACTION ] }); }) @@ -165,7 +171,7 @@ angular.module('settings').directive('guacSettingsPreferences', [function guacSe guacNotification.showStatus({ className : 'error', title : 'SETTINGS_PREFERENCES.DIALOG_HEADER_ERROR', - 'text' : error.message, + text : error.translatableMessage, actions : [ ACKNOWLEDGE_ACTION ] }); }); http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/986ea4b2/guacamole/src/main/webapp/app/settings/directives/guacSettingsSessions.js ---------------------------------------------------------------------- diff --git a/guacamole/src/main/webapp/app/settings/directives/guacSettingsSessions.js b/guacamole/src/main/webapp/app/settings/directives/guacSettingsSessions.js index 0b1d806..a8c13c4 100644 --- a/guacamole/src/main/webapp/app/settings/directives/guacSettingsSessions.js +++ b/guacamole/src/main/webapp/app/settings/directives/guacSettingsSessions.js @@ -334,7 +334,7 @@ angular.module('settings').directive('guacSettingsSessions', [function guacSetti guacNotification.showStatus({ 'className' : 'error', 'title' : 'SETTINGS_SESSIONS.DIALOG_HEADER_ERROR', - 'text' : error.message, + 'text' : error.translatableMessage, 'actions' : [ ACKNOWLEDGE_ACTION ] }); }); @@ -349,7 +349,9 @@ angular.module('settings').directive('guacSettingsSessions', [function guacSetti // Confirm deletion request guacNotification.showStatus({ 'title' : 'SETTINGS_SESSIONS.DIALOG_HEADER_CONFIRM_DELETE', - 'text' : 'SETTINGS_SESSIONS.TEXT_CONFIRM_DELETE', + 'text' : { + 'key' : 'SETTINGS_SESSIONS.TEXT_CONFIRM_DELETE' + }, 'actions' : [ DELETE_ACTION, CANCEL_ACTION] }); };
