Yoot Yoot - 23 days ago 5
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 ?

Thanks

Answer

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..

Comments