I have a php Web Application Multilingual, I have a php variable which can tell the current language of the Web Application,
I need to validate user inputs in client side, and error messages are shown with JavaScript alerts
for example if the php language variable is "french", I need the alert as "bonjour" if the php language variable is "english", I need the alert as "hello"
any ideas
Use your own namespace
en.js
MyApp.lang = {
greeting: "Hello",
warning: "Attention"
};
de.js
MyApp.lang = {
greeting: "Hallo",
warning: "Achtung"
};
Use it like alert(MyApp.lang.greeting) then depending on your php variable include the right .js file in the header
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With