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 6348071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:20:54+00:00 2026-05-24T21:20:54+00:00

I am currently working on a website which will be international, so it needs

  • 0

I am currently working on a website which will be international, so it needs to come with different languages.

I have a folder named “lang” with files such as en.php, no.php, and so on.. The files consist of an array with different words.

My question is how i should use this. Should i save the language in the persons computer with cookies? Or should I save the ip adress and assign a language to it and save it in the database, or should i pass a &land=en parameter in the url all over the website?

Any ideas and thoughts about how one should handle multilanguage websites?

Best of regarsds,
Alexander

  • 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-05-24T21:20:55+00:00Added an answer on May 24, 2026 at 9:20 pm

    I think it is probably best to save the user’s language in a cookie, so you do not need to pass it around via a querystring parameter. You may also set it in $_SESSION However, you should accept a lang= parameter in each page, which would allow any user to change language easily and instantly. The new language should then overwrite the existing cookie.

    $valid_langs = array('en','fr','de','no');
    if (isset($_GET['lang'])) {
      // verify that it is a valid language choice before attempting to use it
      // you may store an array of possibilities.
    
      if (in_array($_GET['lang'], $valid_langs)) {
        $language = $_GET['lang'];
        setcookie('lang', $_GET['lang']);
      }
    }
    else if (isset($_COOKIE['lang'])) {
    
      // also be sure to check that the language is a valid choice in a cookie too.
      if (in_array($_GET['lang'], $valid_langs)) {
        $language = $_COOKIE['lang'];
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently working on a website that will have a high volume of
I'm currently working on an intracompany web site which will be viewed on cell
I am currently working on a website which lists the businesses as per either
I am currently working on my first website. I have no idea where to
I have a website,which is currently designed & tested to work only on firefox.If
I'm currently working a contract for a company which will be moving an access
I'm currently working to specify my company's new partner/public API, which will be a
I'm currently working on a website which main function is to search a relatively
I'm currently working on a large project which is expected to have a large
I am working on a website that has a menu which behaves correctly on

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.