How can I create a window in jquery having multilingual contents?
eg. for Spanish language close window should be comes like ‘maximizar la ventana’.
How can I create a window in jquery having multilingual contents? eg. for Spanish
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could have a set of files named
en.php,sp.phpetc on your server.In each file, all messages text could be stored.
Like in
sp.php,$text["close_window"] = "maximizar la ventana";$text["thank_you"] = "Gracias";and in
en.php,$text["close_window"] = "Close this window";$text["thank_you"] = "Gracias";In your main file(
index.foo), you could useecho $text["close_window"];orecho $text["thank_you"]where you want this text to be displayed.Then based on User String, or some other data, you could conditionally include english.lang or spanish.lang in the server side, according to user’s language.
Files Structure:
index.php //main file
lang //language-files Folder
lang/en.php //english language file
lang/sp.php //spanish language file
Example Code:
en.php:sp.php:index.php:Assumptions:
Langfolder.Here is a Live Snippet at Codepad.viper-7.com
The Live Snippet & In-Answer code has a small difference. Here, my code uses include to get external language files, whereas in Viper-7’s codepad, I use in-script functions.
Reason: Because I can’t put/write files to codepad’s system.