Comment in JS code to indicate non-translatable text? #31
Description
Hi!
I have been reviewing the code of an Angular-JS application and I found some text I had hard-coded in my controller. Something like...
rClient.updateApplicationBindings($routeParams.appName, prefix, appNames).then(function() {
$scope.status.push({
ok: true,
msg: 'Bindings for prefix "' + prefix + '" were successfully saved.'
});
}, function(response) {
$scope.status.push({
ok: false,
msg: 'An error occurred while saving the bindings for prefix "' + prefix + '".'
});
});
What was correct before I use Angular-Translate now leads to incomplete internationalization. I thought we could use Angular-Translate-Quality to detect such an oversight. However, how to not throw warnings for all the strings (such as module names)?
We could use what was used in Java: add comments with
Example:
(function() {
'use strict'; // $non-nls-1$
angular
.module('roboconf.application-bindings') // $non-nls-1$
.controller('ApplicationBindingsController', applicationBindingsController); // $non-nls-1$
Such comments can be removed automatically by tools when compacting the code. The real issue would be with linters that limit the size of a line. Or we could decide to not detect these cases and expect people to review their code. Indeed, these comments make the code ugly (or uglier than usual).
What do you think?