X
X
xmoonlight2014-10-03 02:27:37
JavaScript
xmoonlight, 2014-10-03 02:27:37

Multilanguage in JS scripts: how to do it right?

Friends,
Please advise the right approaches for creating JS scripts with support for several languages ​​in string parameters inside the script code (for creating a multilingual site).

Preferably, without reassigning the js file handler (AddHandler)...

Thanks in advance, everyone.
--------------
UPD1: A clear answer is here .

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Nikolaev, 2014-10-03
@Heian

You can create separate language files (.js or .ini), and depending on the condition, load the desired file. And in the script, use the constants \ variables defined in the file. For example:

var language = {
    'lang_header': 'Заголовок"
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question