At the moment localization client does not show strings that are in Javascript. I did a bit of analysis and was able to pinpoint the issue to the values in location field of table locales_sources.

For strings in php code, location field contains the URI of the page string is found on, where as for strings in js location contains the path to actual JS file. e.g

| 4861 | Creating your login | /?q=registration/cfd 
| 4862 | I accept            | /?q=registration/cfd 
| 8493 | @number comments per page | modules/comment/comment-node-form.js 
| 8494 | Autocompletepopup | misc/autocomplete.js 
| 8495 | Searching for matches... | misc/autocomplete.js

As a result query SQL query

$result = db_query("SELECT s.source, t.translation, s.textgroup, s.context FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid AND t.language = :language WHERE s.location = :location", array(':language' => $language->language, ':location' => request_uri()));

Only returns stings transatlated with Drupal.t() from within JS

One way to solve the problem is to load all strings that have location value as *.js along with request_uri(), however this has a performance impact that each page will display even strings that are not being used on given page.

A more elegant solution could be for external modules to alter the strings that are returned by l10_client, this shall allow developers to add their own logic and if they wish to add any further strings that needs translated.

  317   }
    319   // Allow other moduels to alter strings available for translation
    320   drupal_alter('l10n_strings', $strings, $language);
    321   return $strings;


Let me know if this something that's acceptable and i am happy to roll out a patch.


Gábor Hojtsy’s picture

The module should use the cache from locale() as its primary means to include strings on the page and NOT the query that you are quoting. That query is used to augment the strings on the current page with strings that were previously on the current page, and is merely a convinience helper. The JS strings should be included with the strings displayedby the module already.

Ravi.J’s picture

For some reason, i don't see any of the strings that are in JS displayed in translation interface of localization client. Will take another look.