Skip to content
This repository has been archived by the owner on Mar 30, 2021. It is now read-only.

Comment in JS code to indicate non-translatable text? #31

Open
vincent-zurczak opened this issue Jun 20, 2017 · 0 comments
Open

Comment in JS code to indicate non-translatable text? #31

vincent-zurczak opened this issue Jun 20, 2017 · 0 comments
Labels

Comments

@vincent-zurczak
Copy link
Contributor

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 $non-nls-1$.
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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant