Yoot Yoot - 10 months ago 51
PHP Question

Multi-language website and .js files

My website is multi-language. I'm using php files to define my words / sentences in several languages.

My problem is that my website contains .js files, in which i can't write php code.

What I am suppose to do when I need to make an alert containing some sentence or some word in my .js file ?


Answer Source

You COULD have your js utilize a json obj or an array of strings...

PHP could then create these and write the json or array in the head section on page load..