I have read that the string parameter passed to t() function should be literal, which excludes:
- variables, even the parameters of a function:
t($description)
- a concatenation of strings:
t('If you want to add a link, click on' . '<a href="http://example.com">this link</a>.')
- the value returned from a function:
t(get_menu_description())
- a constant:
t(MYMODULE_MY_WIDGET_TITLE)
,t(MyClass::WIDGET_TITLE)
as mentioned here Is it always bad to pass a variable through t()?.
So, does Drupal.t() inside JS file has the same restrictions? as I have find a string inside some module that is passed as a variable
$(this).addClass('open').text(Drupal.t(settings.linkText));
This string settings.linkText
can't be located at the translation interface and I tried to change it to
$(this).addClass('open').text(Drupal.t('@txt',{@txt:settings.linkText}));
but still couldn't find it. Any Ideas?