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

  • Home
  • SEARCH
  • 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 8062769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:47:03+00:00 2026-06-05T10:47:03+00:00

Help please organize bi-lingual website. So first there are two files eng.php, es.php and

  • 0

Help please organize bi-lingual website.

So first there are two files eng.php, es.php and they will be stored in translation site.

example:

$lang['hi'] = 'Hi';

How can I organize further language choice on the site and record information about the language in cookies?

  • 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-05T10:47:04+00:00Added an answer on June 5, 2026 at 10:47 am

    You can have two files like this.

    Source of en.php:

    $lang = array(
        'hi' => 'Hi'
    );
    

    Source of es.php:

    $lang = array(
        'hi' => 'Hello'
    );
    

    And for the main content file, the source should be this way:

    <?php
        session_start(); // Make sure you initialize cookies / session
        $allowedLangs = array('en', 'es'); // Array with allowed values
        if(isset($_SESSION['lang'])) { // If already user had stored language in session
            include $_SESSION['lang'] . ".php";
        } elseif(isset($_GET['lang']) && in_array($_GET['lang'], allowedLangs)) { // If user had requested like index.php?lang=en
            include $_GET['lang'] . ".php";
            $_SESSION['lang'] = $_GET['lang']; // Update the session with the language
        } else { // If user is visiting for the first time, then...
            include "en.php";
        }
    
        echo $lang['hi'];
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

help me please. There is a list of nodes. <list> <item>1</item> <item>2</item> <item>3</item> <item>4</item>
A little help please. I am designing a stateless server that will have the
Help please! my first program in objective c. Followed a tutorial word for word
I need some help please, I have a PHP page with a drop down
Please help, how can I organize the process-process data exchange (in Windows, if that
I am getting a little confused and need some help please. Take these two
Noob help please. I'm trying to write a script that will check if a
Need some help please with this error : TypeError : 'unicode' object does not
I am still a noob so i really need help please.Is it possible to
i am a noob in htaccess so i want some help please ! i

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.