473,503 Members | 3,715 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

i18n - how best to provide multilingual content

I have a small, embedded app that uses a webserver to serve up pages
showing status, etc.

Right now all the pages are hard-coded in English. We need to provide
multi-lingual support.

All of the pages are PHP generated. Ideally, I'd like for the PHP
backend to serve up the language based a) the user's locale, and if that
is not set, its own locale.

The PHP backend creates the pages on the fly from XML templates, so it
wouldn't be that hard for us to change the language.

But... I don't know the best way to do that. What is the current 'state
of the art' for language on demand in web content?

Thanks....
Jan 20 '07 #1
8 3189
CptDondo wrote:
But... I don't know the best way to do that. What is the current 'state
of the art' for language on demand in web content?
Do you mean automatic translation; or do you mean serving up the best
choice of human-written translations?

Automatic translations are rubbish -- they are laughably bad, and will
present an entirely unprofessional image. Do not even consider using them,
except on a site that's indented to be ridiculed.

That's not to say that their completely useless -- tools like Babelfish
are useful for the *visitor* if they find a foreign site that they would
like to read -- you can usually get the gist of it. But for the author,
they are rubbish.

For human-written translations, assuming you have got good translators,
the situation is much better. Catering for a visitor in their own language
shows that you're willing to make the extra effort to do business with
them.

Many companies will offer entirely different sites for each language. If
you have the resources to manage such a layout, it is often the best
choice because:

1. It allows URLs to be tailored to the language. e.g.
/en/information/garden/lawn-mower
/fr/renseignement/jardin/fauchage
which should help with multi-lingual search engine optimisation.

2. It allows for a different information focus in each language.
For example, I was once told by a translator that translating
technical manuals between cultures involves so much more than
word-for-word translation. People of different cultures expect
to find different things in their documentation. Americans expect
the manual to be a tour-de-force of the product's unique features,
virtually an advertisement for the product; Western Europeans
expect a fairly dry step-by-step explanation of how to use the
product to accomplish different aims; Eastern Europeans expect
information on how to repair the product when it breaks, as in
their experience, these things inevitably do.

3. It allows you to take baby-steps. Say, you've decided you want
to expand into the German market, but you're not sure how much
business you'll do there, so don't want to invest a lot of money
having your entire site translated into German. You may want to
just create a single page site in German, with basic information
about your company, explain that the site's German translation is
still pending, that there is more information on the English
version of the site, and provide the telephone extension for Gunther,
who works in your New York office, but was born and raised in Munich.
As your German sales take off, you then plough back some of the money
into improving the German site. Perhaps one day, the German market
will be so important to you that you open an office in Berlin, and
allow them to maintain the German site directly.

The other approach with human-written translations is to have a single
site available in multiple languages. For example, you ask/detect a user's
preferred language, and then when they go to:

/information/garden/lawn-mower

a PHP script serves up the information in the correct language. If a
translation is not available for that particular page (say, it's a new
product, so the translators haven't finished with it yet), then you just
serve up the English page. This is a reasonably good method, but it
doesn't have advantages #1 and #2 above. It kind of has #3, but your
baby-steps look a little silly because they end up as a mixture of, in the
above example, German and English. This method can ease maintenance though.

Always be careful not to let the translated versions of the site fall too
far behind the English version in updatedness.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Jan 20 '07 #2
CptDondo wrote:
Right now all the pages are hard-coded in English. We need to provide
multi-lingual support.
For serious non-XSLT work, consider JSP instead of PHP. The i18n tools
are vastly better. Read the O'Relliy Java internationalization book,
just for a guide to web i18n.
backend to serve up the language based a) the user's locale, and if that
is not set, its own locale.
Make the selection completely user-selectable, with cookie persistence,
with the methods you describe setting the default. It works just the
same by default, but it's more flexible for casual users finding
themselves using other people's computers' It's a real nuisance
otherwise!
The PHP backend creates the pages on the fly from XML templates, so it
wouldn't be that hard for us to change the language.
XML or XSLT ? If you structure the data model reasonably well, it's
not hard to extract text strings stored in groups for each function,
one for each language. It's easier to manage the translation and
deployment though if the text are grouped by language into separate
files and identified by a short identifier. The XSLT document()
function is especially handy.

Jan 20 '07 #3
Rik
Andy Dingley wrote:
>backend to serve up the language based a) the user's locale, and if
that is not set, its own locale.

Make the selection completely user-selectable, with cookie
persistence, with the methods you describe setting the default. It
works just the
same by default, but it's more flexible for casual users finding
themselves using other people's computers' It's a real nuisance
otherwise!
Check, the order in which I determine language:
- Explicitly set (by a GET variable, or pseudo one like /en/ or /de/ etc.
taken into a rewrite)
- Cookie
- HTTP-Accept-Language in the header
- Geo-IP info (there are free databases available, which are mostly
accurate enough to determine the coutry most of the time)
- System default

After determining the language the cookie will be sent/overwritten with the
current choice.

Grtz,
--
Rik Wasmus
Jan 20 '07 #4
Andy Dingley wrote:
XML or XSLT ? If you structure the data model reasonably well, it's
not hard to extract text strings stored in groups for each function,
one for each language. It's easier to manage the translation and
deployment though if the text are grouped by language into separate
files and identified by a short identifier. The XSLT document()
function is especially handy.
Seen such files in the Gnome2 application desktop icons, they only have one
short line in each language, the application description, but those files are
big, think how large files will become if you have 20-30 languages and you
have to replace the big file each time a language is updated or added, it's
easier IMHO to handle files that has only one language and on the server side
script it's easy select the right language file and use a backup if a
translation would be missing.

--

//Aho
Jan 20 '07 #5
V Sat, 20 Jan 2007 14:27:37 +0100, Rik napsal(a):
Andy Dingley wrote:
>>backend to serve up the language based a) the user's locale, and if
that is not set, its own locale.

Make the selection completely user-selectable, with cookie
persistence, with the methods you describe setting the default. It
works just the
same by default, but it's more flexible for casual users finding
themselves using other people's computers' It's a real nuisance
otherwise!

Check, the order in which I determine language:
- Explicitly set (by a GET variable, or pseudo one like /en/ or /de/ etc.
taken into a rewrite)
- Cookie
- HTTP-Accept-Language in the header
- Geo-IP info (there are free databases available, which are mostly
accurate enough to determine the coutry most of the time)
- System default

After determining the language the cookie will be sent/overwritten with the
current choice.
Thanks. I'll probably do something like that - I've thought about
using the 'HTTP-Accept-Language' var from the header. I just don't know
how many people actually set those correctly.

I guess I didn't phrase my question accurately enough; it has been a long
week.

I have XML templates that define item labels in a form. The XML has
various tags that provide nav info and so on. This is on an embedded
system, with only a small number of phrases that would need translation; I
probably have less than 200 phrases, mostly one and two words.

I have XML templates of the following form:

<item id="myname" value="" index="5" type="text">My Name</item>

The PHP backend reads that line, and creates a form entry for myname, with
the label "My Name". What I want to do is to replace the english "My
Name" with the appropriate words in the user's language.

I'm thinking of a mechanism similar to the .po files, where the PHP
backend look up the text in a translation file. Or even something like
this:

<item id="myname" value="" index="5" type="text" text="My Name"/>

and the PHP backend would look up the text value for "My Name" in a lookup
table for the user's language.

(Aside: I guess I failed to use Google correctly yesterday.... PHP has
support for gettext! <http://us3.php.net/gettextSo that's how I think I
will go...)

--Yan
Jan 20 '07 #6
Rik
Captain Dondo wrote:
V Sat, 20 Jan 2007 14:27:37 +0100, Rik napsal(a):
>Andy Dingley wrote:
>>>backend to serve up the language based a) the user's locale, and if
that is not set, its own locale.

Make the selection completely user-selectable, with cookie
persistence, with the methods you describe setting the default. It
works just the
same by default, but it's more flexible for casual users finding
themselves using other people's computers' It's a real nuisance
otherwise!

Check, the order in which I determine language:
- Explicitly set (by a GET variable, or pseudo one like /en/ or /de/
etc. taken into a rewrite)
- Cookie
- HTTP-Accept-Language in the header
- Geo-IP info (there are free databases available, which are mostly
accurate enough to determine the coutry most of the time)
- System default

After determining the language the cookie will be sent/overwritten
with the current choice.

Thanks. I'll probably do something like that - I've thought about
using the 'HTTP-Accept-Language' var from the header. I just don't
know
how many people actually set those correctly.
Not that many set it themselves, however, most browsers will set during
installation to the most probable language (based in install-languages
choice or for instance OS locale).
This is on an embedded
system, with only a small number of phrases that would need
translation; I probably have less than 200 phrases, mostly one and
two words.
I'm thinking of a mechanism similar to the .po files, where the PHP
backend look up the text in a translation file. Or even something
like this:

<item id="myname" value="" index="5" type="text" text="My Name"/>

and the PHP backend would look up the text value for "My Name" in a
lookup table for the user's language.

(Aside: I guess I failed to use Google correctly yesterday.... PHP
has support for gettext! <http://us3.php.net/gettextSo that's how
I think I will go...)
Check, with a limited amount of frases that would be my choice. A lot
harder to maintain in translating entire pages/documents though.
--
Rik Wasmus
Jan 20 '07 #7
aa

"CptDondo" <ya*@NsOeSiPnAeMr.comwrote in message
news:12*************@corp.supernews.com...
Right now all the pages are hard-coded in English. We need to provide
multi-lingual support.

All of the pages are PHP generated. Ideally, I'd like for the PHP
backend to serve up the language based a) the user's locale, and if that
is not set, its own locale.

The PHP backend creates the pages on the fly from XML templates, so it
wouldn't be that hard for us to change the language.

But... I don't know the best way to do that. What is the current 'state
of the art' for language on demand in web content?

Thanks....
If by XML templates you mean structired contents in in defferent languages,
then all you need is just a presentatinal template in Unicode.
The problem usually arises with non-european languages which probably would
not fit into a european page layout.
As to language selection, you might want to consider an explicit selection
of a language in the menu for the language detected automatically, is not
always what a visitor wants.
Jan 21 '07 #8
CptDondo <ya*@NsOeSiPnAeMr.comwrites:
I have a small, embedded app that uses a webserver to serve up pages
showing status, etc.

Right now all the pages are hard-coded in English. We need to provide
multi-lingual support.

All of the pages are PHP generated. Ideally, I'd like for the PHP
backend to serve up the language based a) the user's locale, and if
that is not set, its own locale.

The PHP backend creates the pages on the fly from XML templates, so it
wouldn't be that hard for us to change the language.

But... I don't know the best way to do that. What is the current
'state of the art' for language on demand in web content?

Thanks....
Like you said, go with gettext(). We just finished a
fairly large app that was to be multilingual. We used gettext
for the small stuff like "Login here". In cases where there
were larger blocks of text we would set a variable $defLang
based on the language the user was using, and in the code,

include(TEXT_DIR."/$defLang/this-usage.txt");

whenever we needed it. There was a root TEXT_DIR, with sub
dirs for each locale. File names were the same and it made
it easy for the end users to update each file for each language.

For graphic buttons it was a similar approach:

<img src=<?=BUTTON_DIR."/$defLang/login.gif"?......>

It worked easy for us. Probably the biggest thing we
did for the end user was create a simple PHP page that would
scan all the source files for gettext and put up a tabular
display of each phrase and the translation, if any, in each
of the target languages, and they could enter the translations
right there. They did not have to deal with the raw message
files.

Hope this helps.
--
John
__________________________________________________ _________________
John Murtari Software Workshop Inc.
jmurtari@following domain 315.635-1968(x-211) "TheBook.Com" (TM)
http://thebook.com/
Jan 24 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
2955
by: Albretch | last post by:
.. Can you define the Character Set for particular tables instead of databases? . Which DBMSs would let you do that? . How do you store in a DBMS i18n'ed users' from input, coming over the web...
0
1242
by: Laszlo Zsolt Nagy | last post by:
Hello, I wonder if there is a standard for making i18n in Python projects. I have several Python projects that are internationalized. I also have Python packages with i18n. But it is still not...
52
4534
by: Andy Dingley | last post by:
I'm using this at present: <p title="Publication date" ></p> Works fine on screen, but Fangs/Jaws just reads it as "left bracket twenty-eight slash zero slash two thousand five fifteen colon...
7
4376
by: J?rg Keller | last post by:
Hi all I have to localize an Access 2002 application: The application using several form, tables etc. is currently only in English. Now the frontend has to be bilingual, so the user can choose...
0
1322
by: JoanneC | last post by:
When developing dynamic web content for the global market place using ASP.NET, VB.NET and MS-Access, why should one install MS-Windows 2000 Server (mulitlanguage/multilingual), and is it necessary...
8
1664
by: Alan J. Flavell | last post by:
OK, I guess I'm about ready to expose this page for public discussion: http://ppewww.ph.gla.ac.uk/~flavell/charset/i18n-weft.html Please concentrate on the content. I'm well aware that my old...
2
2483
by: | last post by:
Best practices and recommendations for asp.net 2 multilingual web sites? Thanks
4
1400
by: P Pulkkinen | last post by:
Hi all, I am in a php development project and I would like to hear your opinions on language file practises. 1) One huge or many small? ==================================== Currently we have...
2
3288
by: Norman Diamond | last post by:
My C# code is I18N'ed by appropriately naming and editing .resx files. At execution time, it works. My C++ code is somewhat I18N'ed. When I put UI code in C++ I use .rc files. When I link to a...
0
7261
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7315
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6974
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7445
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5559
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3158
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3147
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
369
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.