0

I am translating this webpage however I the translation will only work when I add the parameter after .php (e.g. http://localhost/fr/about.php?lang=fr_FR)

How can i make it work like (e.g. http://localhost/fr/about.php/?lang=fr_FR)

<?php

 /*
 * Template Name: Test */ 

$url = $_SERVER["REQUEST_URI"];
$locale_lang = "en_EN";
if (substr($url,0,3) == "/fr/") { $locale_lang = "fr_FR"; }
if (substr($url,0,3) == "/en/") { $locale_lang = "en_US"; }  
$lang = substr($locale_lang,0,2);
require_once("languages/lib/streams.php");
require_once("languages/lib/gettext.php");

$locale_file = new FileReader("languages/lib/$locale_lang/fr_FR.mo");
$locale_fetch = new gettext_reader($locale_file);

function _loc($text) {
    global $locale_fetch;
    return $locale_fetch->translate($text);
}

?>

<title><?php echo ("Title"); ?></title>
<h1><?php echo _loc("English Version"); ?></h1>
Felipe Elia
  • 1,398
  • 2
  • 12
  • 24
mruss24
  • 367
  • 2
  • 6
  • 14

0 Answers0