Jump to content

[Confused] Translations


PF2G

Recommended Posts

Hi,

 

I'm working on a website where i have to translate the pages and the way i have to do is a little confused. Here it goes:

 

I have to create 2 files lang_pt.php and lang_en.php where i have common arrays where i do the translation.

 

lang_pt.php:

<?PHP
$lang['Family Office']="Family Office";
$lang['Multi Family Office']="Multi Family Office";
$lang['Foco']="Foco";
$lang['Serviços']="Serviços";
$lang['Valores']="Valores";
$lang['Seminários']="Seminários";
$lang['Contactos']="Contactos";
$lang['Português']="Português";
$lang['Inglês']="Inglês";
?>

 

lang_en.php:

<?PHP
$lang['Family Office']="Family Office";
$lang['Multi Family Office']="Multi Family Office";
$lang['Foco']="Foco";
$lang['Serviços']="Services";
$lang['Valores']="Values";
$lang['Seminários']="Seminars";
$lang['Contactos']="Contacts";
$lang['Português']="Portuguese";
$lang['Inglês']="English";
?>

 

Then i have to include this 2 files in another, common.php. An it's here where i get confused....I have to include the files in this common.php and then i have to do a switch for the languages (i'm not sure if it's correct):

<?PHP
$lang=$_GET['lang'];
include 'lang_pt.php';
include 'lang_en.php';

echo $lang['Family Office'];
echo $lang['Family Office'];
echo $lang['Multi Family Office'];
echo $lang['Foco'];
echo $lang['Serviços'];
echo $lang['Valores'];
echo $lang['Seminários'];
echo $lang['Contactos'];
echo $lang['Português'];
echo $lang['Inglês'];

switch ($lang) 
{
	case "lang_pt.php":
		header ('Location: index.php?lang=pt');
		die();
		break;
	case "lang_en.php":
		header ('Location: index.php?lang=en');
		die();
		break;
	default:
		header ('Location: index.php?lang=pt');
		die();
		break;
}
?>

 

Then include the common.php in all other files so it can do the translation.

 

I think this is the most clear i can be. If someone can help me, i appreciate.

 

I'll try to explain better if you want to.

 

Thank You,

PF2G

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.