Jump to content

Language Packs - Full site conversion


envexlabs

Recommended Posts

Hey,

 

I have a client who wants to run his store site in many different languages.

 

Is there a way to install language packs that the end user can choose? Kind of like facebook's language app, where the whole site is affected, not just chunks of text if wrapped in a function?!

 

thanks,

 

envex

Link to comment
Share on other sites

Many ways to implement multi-languages. One way is to store all the static text for the site in language files within constants i.e.

 

en.php

======

define(WELCOME_TEXT,'Hello');

 

es.php

======

define(WELCOME_TEXT,'Hola');

 

de.php

======

define(WELCOME_TEXT,'Hallo');

 

You could then use a cookie to determine which language file to use for the website.

In your website templates you just print out the constants.

// welcome.php
print WELCOME_TEXT;

 

If you also store text in your database you must include fields for each language used. This may require branching the text fields into new tables with a language Id.

 

Link to comment
Share on other sites

I prefer to use arrays. I have a language file:

 

$lang[0] = "Welcome Guest!";
$lang[1] = "Main Menu";

 

Or you can use a associative array:

 

$lang['welcome_guest'] = "Welcome Guest!";
$lang['menu'] = "Main Menu";

 

These sorts of things are easier to implement during the coding stage, not after it is completed. :)

Link to comment
Share on other sites

The only thing is with the arrays and defining, is it could be any word that i need changed.

 

The site/cart and run dynamically, so if the client adds a new word that isn't in the array, it'll still be in english.

 

I was hoping to have a function or something that just found words and converted them.

 

The pirate language function on facebook is a good example.

 

yar mateys :P

Link to comment
Share on other sites

The pirate language function on facebook is a good example

Forgive my ignorance but not everyone uses Facebook. What is this?

 

NO problem.

 

Basically, you have the content on the site:

 

ie. login, your friend has posted a picture, etc.

 

When you turn on the language app, it converts it.

 

So when you're on pirate language it all changes to:

 

ie: login = abandon ship, your friend = your matey, etc.

Link to comment
Share on other sites

OK this is a simple string mapping function. Easy if you want your ecommerce website in pirate language. As for a multilingual website this is impossible as you aren't going to store the entire dictionary of each language and map to english words!

Also think about sentence structure in different languages. Replacing each word individually will not produce the correct translation. Even Googles translation tools struggle to do this accuratly!

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.