Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8337265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:15:16+00:00 2026-06-09T04:15:16+00:00

How can I create a window in jquery having multilingual contents? eg. for Spanish

  • 0

How can I create a window in jquery having multilingual contents?
eg. for Spanish language close window should be comes like ‘maximizar la ventana’.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T04:15:17+00:00Added an answer on June 9, 2026 at 4:15 am

    You could have a set of files named en.php, sp.php etc 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 use echo $text["close_window"]; or
    echo $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:

    <?php
    $text["close_window"] = "Close this window";
    $text["thank_you"] = "Thank you";
    $text["welcome"] = "Welcome";
    $text["home"] = "Home";
    $text["about_us"] = "About Us";
    $text["company_history"] = "Company History";
    $text["company_profile"] = "Company Profile";
    $text["contact_us"] = "Contact Us";
    $text["greetings"] = "You have selected English";
    ?>
    

    sp.php:

    <?php
    $text["close_window"] = "maximizar la ventana";
    $text["thank_you"] = "Gracias";
    $text["welcome"] = "Bienvenida";
    $text["home"] = "Casa";
    $text["about_us"] = "Sobre Nosotros";
    $text["company_history"] = "Historia de la Empresa";
    $text["company_profile"] = "Perfil de la Empresa";
    $text["contact_us"] = "Contact Us";
    $text["greetings"] = "Usted ha seleccionado Español";
    ?>
    

    index.php:

     //Check if browser sent the User Language code
    if(isset($_SERVER["HTTP_ACCEPT_LANGUAGE"])      // if browser sent
        //AND is NOT empty
        && ($_SERVER["HTTP_ACCEPT_LANGUAGE"] != "")
        ){ //if conditions END
        // get first two letters from it
        $user_lang = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0, 2);
    }
    if(isset($_POST["lang"]) //if user selected it
      //and is in our desired format
      && (strlen($_POST["lang"]) == 2)
    ){
        $user_lang = $_POST["lang"];
    }
    //if User requested to change language, ask him
    if(isset($_POST["lang_change"])
      && ($_POST["lang_change"])) // is true ?
    {
        ask_lang();
        exit(); // exit the script now..
    }
    if(!isset($user_lang)){ //if we dont have $user_lang yet, ask
        ask_lang();
        exit();
    }
    //Main index file contents
    include("lang/".$user_lang."php");
    ?>
    <html>
        <head>
            <title><?php echo $text["welcome"]; ?> | Example.com</title>
        <head>
        <body>
        <?php echo $text["welcome"]; ?>, <?php echo $text["greetings"]; ?>!<br />
        <a href="index.php" title="<?php echo $text["home"]; ?>" >
            <?php echo $text["home"]; ?></a> |
        <a href="about_us.php" title="<?php echo $text["about_us"]; ?>" >
            <?php echo $text["about_us"]; ?></a> |
        <a href="history.php" title="<?php echo $text["company_history"]; ?>" >
            <?php echo $text["company_history"]; ?></a> |
        <a href="profile.php" title="<?php echo $text["company_profile"]; ?>" >
            <?php echo $text["company_profile"]; ?></a> |
        <a href="contact_us.php" title="<?php echo $text["contact_us"]; ?>" >
            <?php echo $text["contact_us"]; ?></a>
        <p>
            <form method="POST" action="">
                <input type="hidden" name="lang_change" value="true" />
                <input type="submit" value="<?php echo $text["change_language"]; ?>" name="change_language" />
            </form>
        </p>
        </body>
    </html>
    
    <?php
    //Main index file contents ENDS
    function ask_lang(){
    ?>
    <html>
        <head>
            <title>Please Select Language</title>
        <head>
        <body>
            <form method="POST" action="">
                <fieldset>
                    <legend>Please select language:</legend>
                    <input type="radio" value="en" name="lang" />English<img src="en.png"><br />
                    <input type="radio" value="sp" name="lang" />Spanish<img src="sp.png"><br />
                    <input type="submit" value="OK" name="sumbit" />
                </fieldset>
            </form>
        </body>
    </html>
    <?php
    } //function ask_lang() ENDS
    

    Assumptions:

    • All type of possible translation files are in the Lang folder.
    • User input is sanitized.
    • Google translated all these Phrases correctly context-wise.

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For Android GUI: I would like to create a window that I can pull
I have a console application from which I create a window. I can render
I'm using CreateWindowEx() function to create an EDIT window, i.e. where a user can
how can create a windows move maker like application in vb.net.... if we want
I wonder if anyone can help with a jQuery problem I am having. I
I am using jquery-ui to create a dialog window. the div to be shown
I'm trying to create a jquery function that can be called both on ready
I am trying to create a JQuery dialog that resizes with the window, I
I'm trying to create a dialog window using JQuery. I'm making progress so far,
I used Jquery to create a dropdown list, and some reason I can see

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.