Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Multilingual website

Featured Replies

Hi guys! How are you ? =D I wanna do something for my website could you help me please ?

I wanna make my website Multilangual, I mean I wanna make the index of my website as a page that the visitor chose in your langage ( between 3 languages) when he clicks on his language he's gonna enter the website..so how can I do it ?

Easiest way to do it would be to have the different files and put them in a lang/ directory in this example im going to use the folowing

lang.en.php - English 
lang.de.php - German
lang.es.php - Spanish

In these file have a setup like so, change the values for the language needed

$lang = array(); 

$lang['Nav_link_home'] = 'Home';
$lang['Nav_link_about'] = 'About';
$lang['Nav_link_contact'] = 'Contact';
$lang['Nav_link_Other'] = 'Other';

Somewhere on your page have a link to the diffrent languages

<a href="lang.php?lang=en">English</a> | <a href="lang.php?lang=de">German</a> |<a href="lang.php?lang=es">Spanish</a>

Now for the php to select the language, call this lang.php

<?php
    session_start();
    if ($_GET['lang']) {
        $lang = str_replace('.', '', $_GET['lang']);
        if (file_exists('lang/lang.'.$lang.'.php')) {
            $_SESSION['lang'] = $lang;
        }
    }
?>

Now for selecting the language in the browser, just place this code in the part of your website that needs to be multi lingual

<?php
    // Suppress the session_log if its already called
    @session_start();
    if ($_SESSION['lang']) {
        $lang = $_SESSION['lang'];
    } else {
        // Set default to english if they have not selected a language yet
        $_SESSION['lang'] = 'en';
        $lang = $_SESSION['lang'];
    }

    require_once('lang/lang.'.$lang.'.php');

?>

Now to print the text use sometthing like these

echo $lang['Nav_link_home'];
echo "<a href='#'>".$lang['Nav_link_home']."</a>";
<?php echo $lang['Nav_link_home']; ?> 

Edited by D4Y0

Hi Ismael!

 

There are some aspects which you should keep in mind while making your site multilingual. You can try to use Unicode – it provides a unique number for every character and works with all platforms, programs and languages. I will help you a lot to adapt your site to many languages. Also don't forget to adapt your content – work with localization and optimization.

 

Good luck!

  • Author

Hi Ismael!

 

There are some aspects which you should keep in mind while making your site multilingual. You can try to use Unicode – it provides a unique number for every character and works with all platforms, programs and languages. I will help you a lot to adapt your site to many languages. Also don't forget to adapt your content – work with localization and optimization.

 

Good luck!

Thank you brother :) but I can change the whole website to another language but this is not the problem.. the problem is that I wanna make my home page as a simple page that you chose in your language, when you chose it, the website gonna run with the same language that you selected ..

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.