Sr. Web Developer
mediabistro.com
US-NY-New York

Justtechjobs.com Post A Job | Post A Resume

Native Language Support
Explicit links
Many multi-lingual websites present the content in various languages, and do so by placing a link on the document. There would be one link for each of the supported languages. This is a very simplistic approach and should only be used if you need to have multi-lingual content, but do not have the resources of a scripting language or dynamic content.
If a document is moved, or a new language is added or removed from the repertoire, then the webmaster would have to edit, add or remove links in each of the affected documents. This can be quite tedious.
Apache's content negotiation
The Apache web server can manage language-sensitive content delivery by using the information from the content negotiation headers. Then, the webmaster must provide the static pages for each language and name them properly. For example if the welcome page is available in Spanish and English, the webmaster would have these two files:
welcome.html.es
welcome.html.en
When the web server is well configured, it will deliver the appropriate web page based on the language code according to the priority list.
This works perfectly for static pages. However, if you have a dynamic website where a great deal of the pages is generated based on queries, then this approach will not work. Another disadvantage is that you need to know how to do it and you may or may not have access to the configuration files. My experience was that it was a bit tricky and it did not offer enough flexibility for my purposes.
An advantage of this method is that the negotiation is between the browser and the Apache server. You need only to provide the static content.
GNU Gettext with PHP
This internationalization tool has been around for some time for C programmers. There is also a variant used on other Un*x, such as HP. Both are very good and are easy to use.
This extension has been available in PHP since version 3.0.6 and also in 4.0. The Gettext extension is easy to use, and is good if you are generating your webpages dynamically. The only thing left here would be the PHP code that generates the content and a set of message catalogs. Supporting a new language is as easy as generating a new catalog with the translations and dropping the file in the appropriate directory. Therefore, assuming you have a PHP application named "myphp" and that the appropriate message catalogs exist and are installed, then the application would have something like this:

<?php

/* Initialization of GetText in myphp */
putenv("LANG=$language");
bindtextdomain("myphp","./locale");
textdomain("myphp");
/* Print some messages in the native language */
echo gettext("Hello new user");
echo
_("You have no new messages");
              
?>
My provider had recently upgraded from PHP 3.0RC5 to a PHP4.0 Beta 2 installation. While PHP4 does have support for the Gettext extension, my provider did not compile the PHP4 module with Gettext support. However, even if they had, moving to another provider without Gettext would become a major headache.
[ Next Page ]

[Page 1]  [Page 2]  


Comments:
Gettext isn't easyDavid01/05/08 19:18
You are right ofcourse... But...Freeflashonlinegames Com 12/09/04 07:58
Accessing MSAccess database from PHTMLPrasanna Phadke10/20/02 14:50
RE: NativeLanguageSupportx-eniac10/01/02 04:29
RE: multi-langual dynamic site,HOW?x-eniac10/01/02 04:24
installingIllona04/26/02 12:19
PHP problem with "Ñ" in databaseguarez04/14/02 23:36
real solutioncrimaniak04/08/02 09:48
RE: XML/XSLT solutionJoel Stobart03/04/02 06:53
basic Html code !!!gengosa, marcelo12/13/01 05:43
multi-langual dynamic site,HOW?MSsaint11/12/01 13:10
A simple methodAlok Sinha05/03/01 19:36
NativeLanguageSupportluc bredemus04/13/01 05:53
RE: Dynamic phrases...Ronan03/14/01 14:26
RE: Dynamic phrases...Abel Gonzalez Vidal03/07/01 20:28
RE: Dynamic phrases...Ronan03/06/01 05:44
RE: Download linkDidimo Grimaldo02/21/01 20:14
HoweverEdsko de Vries02/18/01 03:43
RE: XML/XSLT solutionEdsko de Vries02/18/01 03:41
StPhp is my choiceAbel González Vidal02/17/01 21:52
RE: XML/XSLT solutionSandro Zic02/17/01 10:10
RE: XML/XSLT solutionTomas V.V.Cox02/17/01 07:43
RE: XML/XSLT solutionEdsko de Vries02/16/01 02:55
RE: Dynamic phrases...David Garcia Watkins02/15/01 14:24
Sorry for the inconvenienceDidimo Grimaldo02/15/01 06:45
RE: XML/XSLT solutionDidimo Grimaldo02/15/01 06:43
RE: Download linkDidimo Grimaldo02/15/01 06:33
RE: phpLang does it and more !!!Didimo Grimaldo02/15/01 06:29
RE: Dynamic phrases...greggory02/15/01 00:38
Let the user regulate the content.Stephen VanDyke02/14/01 10:26
XML/XSLT solutionEdsko de Vries02/14/01 07:31
Dynamic phrases...Mike Norton02/14/01 07:12
phpLang does it and more !!!Nicolas Hoizey02/14/01 05:56
Missing textPaul K Egell-Johnsen02/14/01 05:29
And with dynamic lists ?Patrick Paysant02/14/01 03:18
Download linkPablo Costa02/14/01 02:54
PerformanceKirk Parker02/14/01 00:31
 

If you are looking for help, please post on the appropriate forum here. Your questions will be answered much more quickly.

Add A Comment:

Name:

Email:

Subject:

Message:

To reduce spam posts, messages are now manually approved

You are not [logged in]. That means your account will not get credit for this post.