While I can understand the impulse that leads to an
attempted quick and dirty solution, keeping different
versions of the text near where they are used will lead
to an unhealthy intertwining of internationalization and
everything else in your program. So adding a new language
means auditing the whole thing each time. Instead the
people that I know have tackled internationalization are
uniform in their belief that what you really want to do
is create a separation of presentation and content.
The pattern that I have most often seen mentioned for
doing this is called
or MVC for short. You have a different view for each
language you support.
Does this take more work and thought up front to implement?
Yes. But as with any programming problem, unless you
have factored out what needs to change, changing it will
be a very hard task. And if you are going to create an
international application, you won't just be asked to do
it in English and French. Rather you will need to go do
it in a lot of languages, and many of those will be added by
people chosen more for their knowledge of those languages
than for programming skill...
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link or
or How to display code and escape characters
are good places to start.