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
Model-View-Controller
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...
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.