Jump to content

How to use language strings in external JS files?


Recommended Posts

I'm making a plugin, main logic of which is in the Javascript controller (dev/js/myscript.js). Is there any easy way to use language strings in this external Javascript file?

Now I have to manually assign needed strings to Javascript variables in the template like this:

var today = {lang="today"};

But I need a lot of language strings, and it's becoming too hard to use this approach.

The same question with the other template plugins like {setting="$settingKey"}.

Link to comment
Share on other sites


You can reference any language string - ultimately javascript language strings are all set in the same manner and are globally accessible.

That is correct about setSetting/getSetting.  Not all ACP settings are passed to javascript inherently, you will need to manually pass any that you want to access.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...