jmuehlner commented on PR #668: URL: https://github.com/apache/guacamole-client/pull/668#issuecomment-1125362533
Hey Nick! I really like the direction this is going. It looks a lot better already. On the topic of the `ARGS` and `User undefined has joined the connection` - this seems to be a limitation on the way that `angular-translate` parses the translation strings - see https://github.com/angular-translate/angular-translate/blob/d727abb0cae045c1f645bb7a92f06f8240875987/src/directive/translate.js#L162 - the translation service would be literally looking for a key called `ARGS[0]` in the `translate-values` array. I played around with your code and got it working by doing exactly that - the following changes get it working: ``` diff --git a/guacamole/src/main/frontend/src/app/client/directives/guacClientMessage.js b/guacamole/src/main/frontend/src/app/client/directives/guacClientMessage.js index 019d434e6..ba5ff3339 100644 --- a/guacamole/src/main/frontend/src/app/client/directives/guacClientMessage.js +++ b/guacamole/src/main/frontend/src/app/client/directives/guacClientMessage.js @@ -43,6 +43,17 @@ angular.module('client').directive('guacClientMessage', [function guacClientMess const $log = $injector.get('$log'); const ManagedClientMessage = $injector.get('ManagedClientMessage'); + + $scope.giveMeTheArgs = function giveMeTheArgs() { + return $scope.message.args.reduce( + function(acc, value, index) { + acc[`ARGS[${index}]`] = value; + return acc; + }, + {} + ); + }; + /** * Uses the msgcode to retrieve the correct translation key for diff --git a/guacamole/src/main/frontend/src/app/client/templates/guacClientMessage.html b/guacamole/src/main/frontend/src/app/client/templates/guacClientMessage.html index a6fc9f25c..310f9aa3b 100644 --- a/guacamole/src/main/frontend/src/app/client/templates/guacClientMessage.html +++ b/guacamole/src/main/frontend/src/app/client/templates/guacClientMessage.html @@ -3,6 +3,6 @@ <!-- Message text --> <p class="client-message-text" translate="{{ getClientMessage() }}" - translate-values="{ ARGS: message.args }"></p> + translate-values="{{ giveMeTheArgs() }}"></p> </div> ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
