mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-10 07:01:21 +00:00
GUAC-1160: Generate localized field headers and option values within "form" module.
This commit is contained in:
@@ -266,9 +266,41 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
|
||||
$scope.parameters = {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the translation string namespace for the protocol having the
|
||||
* given name. The namespace will be of the form:
|
||||
*
|
||||
* <code>PROTOCOL_NAME</code>
|
||||
*
|
||||
* where <code>NAME</code> is the protocol name transformed via
|
||||
* translationStringService.canonicalize().
|
||||
*
|
||||
* @param {String} protocolName
|
||||
* The name of the protocol.
|
||||
*
|
||||
* @returns {String}
|
||||
* The translation namespace for the protocol specified, or null if no
|
||||
* namespace could be generated.
|
||||
*/
|
||||
$scope.getNamespace = function getNamespace(protocolName) {
|
||||
|
||||
// Do not generate a namespace if no protocol is selected
|
||||
if (!protocolName)
|
||||
return null;
|
||||
|
||||
return 'PROTOCOL_' + translationStringService.canonicalize(protocolName);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Given the internal name of a protocol, produces the translation string
|
||||
* for the localized version of that protocol's name.
|
||||
* for the localized version of that protocol's name. The translation
|
||||
* string will be of the form:
|
||||
*
|
||||
* <code>NAMESPACE.NAME<code>
|
||||
*
|
||||
* where <code>NAMESPACE</code> is the namespace generated from
|
||||
* $scope.getNamespace().
|
||||
*
|
||||
* @param {String} protocolName
|
||||
* The name of the protocol.
|
||||
@@ -278,7 +310,7 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
|
||||
* protocol specified.
|
||||
*/
|
||||
$scope.getProtocolName = function getProtocolName(protocolName) {
|
||||
return 'PROTOCOL_' + translationStringService.canonicalize(protocolName) + '.NAME';
|
||||
return $scope.getNamespace(protocolName) + '.NAME';
|
||||
};
|
||||
|
||||
/**
|
||||
|
@@ -60,7 +60,9 @@ THE SOFTWARE.
|
||||
<!-- Connection parameters -->
|
||||
<h2 class="header">{{'MANAGE_CONNECTION.SECTION_HEADER_PARAMETERS' | translate}}</h2>
|
||||
<div class="section connection-parameters" ng-class="{loading: !parameters}">
|
||||
<guac-form fields="protocols[connection.protocol].parameters" model="parameters"></guac-form>
|
||||
<guac-form namespace="getNamespace(connection.protocol)"
|
||||
fields="protocols[connection.protocol].parameters"
|
||||
model="parameters"></guac-form>
|
||||
</div>
|
||||
|
||||
<!-- Form action buttons -->
|
||||
|
Reference in New Issue
Block a user