Forgot your password?
typodupeerror
Communications Databases PHP Programming Software

How Are You Accomplishing Your i18n? 117

Posted by Cliff
from the eighteen-letters-between-the-i-and-the-n dept.
cobrabyte asks: "My team has recently been given the task of implementing internationalization (i18n) in our MySQL databases (PHP-interfaced). Essentially, for every article X, we need it presented in any number of languages (once translated). As we were working on gathering the necessary procedures, we were very surprised to find that there's not much organized information regarding i18n using MySQL and PHP. Is the topic of i18n too new to garner any usable info?"
This discussion has been archived. No new comments can be posted.

How Are You Accomplishing Your i18n?

Comments Filter:
  • I'm not sure what the question is. Is it, how do we allow users to select a language? Is it, how to implement i18n in PHP based code? Is it, how to manage multiligual databases?

    I'm not sure what the question(s) is.
    • I thought my question was clear ... but let me elaborate...

      We are familiar with UTF and have done extensive research on the subject. However, outside the realm of standards, there is not a clear path for bringing all of the various pieces (MySQL, PHP, Apache, etc.) together to form a cohesive, multi-language-compatible unit.

      There are articles here and there about various aspects of internationalization. However, I get a sense, after reading these articles, that the authors are just experimenting. I d
      • Sorry, I still don't understand -- could you explain in more detail (to the degree that you can) what you're making and which parts need to be internationalized? And whether you're supporting two languages or twenty?
        • You create a website or web application.
          How do you translate it into other languages?
          -without using some crappy 'BabelFish' layer
          -without having to write a complete localized version for each language.

          • You ask $DEITY for a miracle?
          • by plcurechax (247883) on Thursday June 23, 2005 @03:53PM (#12893170) Homepage
            -without using some crappy 'BabelFish' layer

            Ask any government that supports multiple official languages (Canada, Switzerland, ...). You translate into the other language(s) using professional translators. Period. You can give them the most powerful automatic translation tools available, and multiple language dictionarys (e.g. English-French) but in the end you need a human professional translator to make translations worth reading.

            -without having to write a complete localized version for each language.

            You need to make the content management system (CMS) language aware, and you need to localize all your templates. Then you need to add a key to your article database for language, so the user can retrieve article 101 in either english or french. (think a long the lines of http://localhost/cms/display.php?article=101&lang= en [localhost] ).

            I know nothing about PHP programming, so I cannot comment on that, or MySQL (main gotcha I expect is datatype, UTF-8, iso8859-1, vs. windowspage1574). Two articles I found useful in general about internationalization are

            UTF-8 and Unicode FAQ for Unix/Linux by Markus Kahn
            How do I have to modify my software?
            http://www.cl.cam.ac.uk/~mgk25/unicode.html#mod [cam.ac.uk]

            The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)
            http://www.joelonsoftware.com/articles/Unicode.htm l [joelonsoftware.com]

            • Not only do you need to translate strings (and as you say, use real live translators to do it, at least for anything you care about), but you also need to deal with formatting order (especially in printf-like statements).

              In many languages, you have strings like this:
              "You, %s, owe us %s dollars."
              that are used with formatted print statements such as printf() that make assumptions based on ordering: printf(get_locale_string(you_owe_us_string),name, l ocal_money_string(amount)).

              In another language, the orderi
            • I found Joel's "Absolute Minimum" really, really minimal and did a presentation for the rest of the developers at the workplace: Zipped Powerpoint [vankuik.nl]. Be sure to check the notes below each sheet.
          • Create table Locales (PK LocaleID int LocaleName int)
            Create table LocalizableFields (PK FieldID int)
            Create table LocalizedValues (FieldID, LocaleID, LocalizedValue)

            Then, instead of creating table products with:
            ProductID int, ProductName nvarchar, ProductDescription nvarchar

            You use:
            ProductID int, ProductName int, ProductDescription int

            When you want to fetch stuff back out, you do a join like this:

            SELECT lpn.LocalizedValue AS ProductName,
            lpd.LocalizedValue AS ProductDescription
            FROM
    • Some answers (Score:5, Informative)

      by JavaRob (28971) on Thursday June 23, 2005 @08:01PM (#12895952) Homepage Journal
      I18n/localization is one of those tasks that has *lots* of questions that will need to be resolved... often you won't even know about all of the issues to resolve until you start digging into it.

      I sorted out the i18n design for a project recently, so I can share some insights on the process. My project used Java/JSP, but the problems are mostly the same. One of the most important points to be made is that you *need* to sit down and design it all the way through -- this is not a "feature" that can be easily added in when you need it later (and extreme programming teams can get hosed on this one pretty easily).

      Things to consider (in the sequence of a request for simplicity's sake):
      1) How will you know what language a user wants (first time, and on subsequent pages)? The user should be able to select/change their preference (though you could use their browser-reported locale as a guess), and they should be able to *bookmark* the homepage in their language. You could use a cookie, and redirect from the basic homepage based on that. Personally I avoid depending on cookies where possible, I didn't want to have duplicated directory structures, and I didn't want an added param on every request, so I used multiple *subdomains*, one per supported locale. They all mapped to the same IP, same application -- but in the web application I could check the requested URL and set the locale (and build the page) correctly using that. There were links on the top of the homepage to switch languages -- which would just flip to the proper subdomain. (Important note -- this complicates getting a cert for SSL, since that's tied to the domain... keep that in mind).

      Once you know what language you're using, build the page... this will probably involve getting data out of the database and displaying some of it.

      First, make sure your tables support whatever character set the languages will need. Then make your data design carefully. You need to make sure that any data in the database that will show up onscreen: product descriptions, category names, and ALSO prices (you probably have to give prices in various currencies, right?).

      Building the page -- you'll need more PHP-specific advice here, but the idea is that you need to get text and possibly images that are language-specific for each page. The general choices are:
      * Use a single PHP file for the content (e.g., a form for registration info), and get the text displayed from locale-specific files (so for the "name" label over that field, you'd grab the proper translation).
      * Maintain a separate PHP file for the content in each language, plug the proper one into the template.

      The first option is better if your content is mostly short bits of text -- but if there are larger chunks of text it gets hard to read (and if the whole page is text -- like a privacy policy page, etc. -- the second option may make more sense). Personally, I supported both options.

      What else? Don't forget that formatting of currency, numbers, dates, and times will vary by locale. Don't forget to review any Flash animations, dropdown menus, popup calendars, etc.. these will need to support changes based on locale. Organize your resources carefully, so that a simple substitution in the path will get you the right image, content file, etc. (e.g., images/fr_CA/whatever.gif).

      HTH.
      • One more thing (Score:3, Interesting)

        by JavaRob (28971)
        Forgot to mention... remember you are always balancing ease of development and ease of maintenance.

        Something that helps one does NOT always help the other -- for example, building the site in English, then making complete copies and translating all text into other languages is easy to develop, but quickly becomes a nightmare in maintenance... the customer wants a minor change and you have to update 10 files.

        Just walk through quick scenarios for each option: I would do X to create and integrate this page,
        • remember you are always balancing ease of development and ease of maintenance.

          and

          quickly becomes a nightmare in maintenance...

          These are very good points -- When you have a minor change in text, you've got to worry about getting it translated in to every language you support. Who's going to do the translations? Maybe I'm missing something obvious by not working at a huge corporation (like "we just send it to our Bejing and Madrid offices and they do the translations in to their local languages"), bu

      • How will you know what language a user wants (first time, and on subsequent pages)? The user should be able to select/change their preference (though you could use their browser-reported locale as a guess) [...]

        Pet peeve: the locales reported by a browser isn't just a guess; it's the standard way for a user to tell what languages she prefers to read. I realize that web developers mostly ignore this, but IMHO not using it (in the absence of other information, of course) is a bug.

        • I did mention it... but as a developer, I have to still treat it as a "best guess". It's certainly not a guarantee of the preferred language. I've done a decent amount of traveling, and when I'm in an internet cafe and websites show me content in the local language (without the option to change!), I'm screwed if it's a language I don't read. That's a more serious bug than showing a non-preferred language (but allowing them to click a link for their preferred lang).

          Of course, travellers are not the major
  • It is just me? (Score:2, Insightful)

    by stinerman (812158)
    I can't stand that abbreviation, i18n. I mean who thought that would be a good abbreviation? It bears no resemblence to the original word. I think we can do better.
    • by Anonymous Coward
      Perhaps you meant...

      "I can't stand that a10n, i18n. I mean who thought that would be a good a10n? It bears no r9e to the o6l word. I think we can do b4r."
    • by reidbold (55120)
      i18n is an abbreviation? They really should have chosen something more explicit..
    • It is just you (Score:4, Insightful)

      by bluGill (862) on Thursday June 23, 2005 @04:27PM (#12893531)

      The problem is you speak English. There is a good chance that you speak no other language. Since nearly everything is written in English first these days, you don't care about these issues.

      Many of those who care about i18n do not speak English at all! To these people even spelling the word out gives no help. In fact it is less helpful because they have to learn this large symbol. (There is no reason to assume they even know the Latin alphabit, so they will not think to learn each letter separately)

      Of those who speak English, many do not speak it fluently. Often they speak English as a first year student ("hello, my name is"), and they know how to look words up in their English-whatever dictionary.

      Of course English is the dominate second language in the world. There are plenty of people who speak English fluently as a second language. They often have trouble with the creative spelling English came up with. Words with 20 letters are hard for anyone to spell, so it would be no surprise if they have trouble spelling it.

      The goal is one symbol that is easy for everyone to recognize. No matter what language the page is written in, if you see "i18n", you know you are in a location where people are interested in translation. This is often enough for some educated clicking to find the same information in your language.

      i18n may not be a good abbreviation. However can you come up with a way to represent the concept to all 6+billion people on earth?

      • Write it in esperanto!

        I do speak a bit of French (not fluent by any standards). But you are right, I had never thought of the fact that others simply didn't understand what "internationalization" is. Seems I've been pretty humbled.
        • I had never thought of the fact that others simply didn't understand what "internationalization" is.

          In English, that would be internationalisation.

          • I propose we use the locale-neutral word "internationali1ation".

          • You may want to check your dictionary. Webster's Seventh New Collegiate Dictionary (American edition, which might be more prone to using -isation) only knows about "internationalization". Yes, I know it's old. Oh, and a Google fight says internationalization [google.es] sweeps the floor with internationalisation [google.es].
            • Webster's Seventh New Collegiate Dictionary (American edition

              Hardly an authority on the native language of England then, is it?

              • Preface: Oh, I guess American English is not "English enough". Silly me. And I would love to see the face of any English philology scholar at reading that Webster somehow is "not an authority" on English. Well, let's get to the answer.

                I thought "internationalisation" was a term more commonly used in the USA than in the UK. But The Cambridge Dictionary [cambridge.org] states the term is "internationalization", with "internationalisation" being a UK localism. The Oxford Engl [oed.com]

        • Write it in esperanto!

          Unfortunately, "internaciigo" isn't necessarily an improvement.

          Admittedly, it's shorter. However, the word is pronounced something like in-tehr-na-tsee-EE-go. Many people find the "ts" followed by two separately pronounced "i"'s, with overall word emphasis on the second, a bit hard to pronounce. And it sounds a bit like there's the word "nazi" in the middle, which means the thread is over.

      • i18n may not be a good abbreviation. However can you come up with a way to represent the concept to all 6+billion people on earth?

        The grandparent poster complains about 'i18n' being a lousy abbreviation, and you give the world a six paragraph rant about cultural imperialism. This is rather like going off on communism because someone commented on the color of an object.

        Seriously, it has numbers in it. Numbers!

        (at this point, I start wanting to scream 'Those aren't even WORDS!!!! ED! ED! ED IS THE ST

        • Thank you. This needed to be said, and I was about to do it.

          Please mod this parent up to at least the level of the rant to which it applies.
        • I believe you missed the point a bit. More people in the world recognize Arabic numerals than Latin characters. i18n is just suposed to be a symbol that anyone in the word could recognize easily.

          The L33t spelling is just a bonus.....
          • i18n is just suposed to be a symbol that anyone in the word could recognize easily.

            That unpronouncable symbol Prince changed his name to was easily recognizable too, but that doesn't mean it served well as a name.

            • Actually if you wanted to write internationalization in a short easy to pronounce way you would write \u56fd\u969b\u5316\u3011 . Since that is the kanji for internationalism in both Chinese and Japanese. I think that makes it much easier for the majority of the population to pronounce*.

              There is a very sound reason to put Arabic numerals in the word, it's easy to pick out no matter what language(s) you read. This isn't anything like Prince's name where he just made up a totally new symbol to get out of
              • Ooops, that made a mess of the unicode. But I guess Slashdot posters/reader can just use U+22269 U+38469 U+21270.
              • There is a very sound reason to put Arabic numerals in the word, it's easy to pick out no matter what language(s) you read. This isn't anything like Prince's name where he just made up a totally new symbol to get out of contract obligations.

                Except for the whole unpronouncable symbol thing.

      • Re:It is just you (Score:4, Interesting)

        by pla (258480) on Friday June 24, 2005 @09:14AM (#12899691) Journal
        Of course English is the dominate second language in the world.

        In IT, English holds the majority by far. And Spanish doesn't even come in second - You have Japanese and German as distant seconds, with Hebrew and French as dark-horse thirds.

        Attempts at internationalization simply hinder the adoption of English as the next ubiquitous academic language. Much like Greek and Latin during the Roman empire - The rabble may all speak Spanish, but those who want to appear educated speak English. Of course, Latin later went on to hold the same place, so perhaps some day Spanish will function as the language of the academic elite.

        Personally, I don't have great hope of us not blowing up the planet before then. So I code with English as my target language. Speak it, or don't use my programs, doesn't much matter to me


        Many of those who care about i18n do not speak English at all!

        I don't think that needs an exclamation mark - It doesn't come as a particular surprise to anyone. If you speak English, you don't have the least interest in "internationalization", which basically means "Make it accessible to people who don't speak English".


        And I don't write this as a xenophobic rant... I regularly use programs written by Japanese coders, and a few in German. And do I sit around complaining about how those coders, who already have given me something I find useful, should do extra work unrelated to the purpose of the program to make those programs more friendly to me? No. I recognized my inability to read the menus and such as a shortcoming in myself, and made the effort to learn enough Japanese and German (albeit very little) to navigate those programs.

        Or to put that another way - If Bill Gates only spoke Italian, a LOT more people would have learned at least a basic proficiency in it by now.
        • >>So I code with English as my target language. Speak it, or don't use my programs, doesn't much matter to me

          I agree that a system needs to have a 'base' language. The business case, requirements, design docs, and code/comments are usually better off being written 1 language.

          However, if you are dealing with clients in multiple regions footing the bill for your project, it's also a good idea to think in terms of having the application support multiple languages in some type of modular way, so that th
      • live in belgium and you'll know how to make multi-language sites. jesus, the number of times we have demos of CMS systems and the first question i ask is 'how do you implement a multilanguage site?' and they always say 'it'll be in the next edition'. funnily enough they're quite happy to have the admin module in multiply languages but actually having the *site* use multiple languages is always a big no-no.

        ciao

    • I can't stand that abbreviation, i18n. I mean who thought that would be a good abbreviation? It bears no resemblence to the original word. I think we can do better.

      Not just you. I actually followed the link to wiki to figure out where that damned thing started.

      I've always assumed it was somehow l337 and supposed to match phonetically --- the fact that 18 is the number of omitted letters (according to wiki) makes me hate it as an abbreviation even more.
    • It's actually quite clever. Feel free to come up with something even remotely that short that conveys it any better. The abbreviation is meaningless outside the group of people who care about it, but so is most geek speak and a great deal of the body of scientific language-- regardless of the language of origin.
    • I can't stand that abbreviation, i18n. I mean who thought that would be a good abbreviation?

      I thought this was common knowledge, but no-one seems to have posted it yet while many people seem to be asking, so: it's a pun.

      The word is written either "internationalisation" or "internationalization", depending on which English-speaking country you're in at the time, but both versions have 18 letters between the 'i' and the 'n'. As well as being shorter, "i18n" therefore works without adjustment in all En

  • by pyrrhonist (701154) on Thursday June 23, 2005 @02:42PM (#12892446)
    How Are You Accomplishing Your i18n?

    By p09g.

  • by 33degrees (683256) <33degrees@NOSpaM.gmail.com> on Thursday June 23, 2005 @02:50PM (#12892542)
    I haven't tried any of them, but PEAR has a number of packages [php.net] for dealing with internationalization. You might want to try looking there for insight.
  • Easy way, using SQL (Score:3, Informative)

    by jd (1658) <imipak&yahoo,com> on Thursday June 23, 2005 @02:52PM (#12892563) Homepage Journal
    Simply define a strings table with two key fields. The first key defines the string ID, the second defines the language ID. The sole attribute would then be the string itself.


    Adding a new language then just becomes a case of adding a new language ID to the system, and adding a new string becomes adding a string ID.


    Any place that you want to generate an output string, simply insert a token which represents the string ID. Your translation code scans for the tokens, gets the current language from the environment, and then searches your strings table for the substitution string.


    (For those who remember the Commodore PET computer, this is very similar to how it worked. The Print command, for example, was stored internally as a "?" token. It substituted when displaying.)


    You do not need a table for the string IDs, an enumerated type would be sufficient to track what IDs are in use and what for. You WOULD want a table for the language, with the language ID as the key field (preferably as an enumerated type) and the font ID as the attribute. If you are not using fonts (eg: plain-text output) then again you can just use the enumerated type.


    Because you would NOT be encoding font data into the string (NEVER, EVER do that, by the way, as you're just padding the data with redundant information, and introducing extra complexity), you can replace the font at will, provided it conforms to the mapping standards for international character sets.

    • The way you've mentioned works fine if you are only going to display static strings, but if you wish to display dynamic strings you will need a different approach.

      Languages like English are SVO while other languages are SOV. Throw in a few extra grammar rules and a simple string substitution scheme becomes impossible because printf("%s %s %s", S, V, O); will simply not create correct strings for any language that uses a different ordering.
      • That's true, I hadn't considered that aspect. What you would need to do, in that case, is to store the ordering in the language table, then use that ordering to generate the SQL needed to pull the strings. Then you would be able to handle flexible ordering.

        Character direction is another problem, if you're going truly international, as some languages alternate between left-to-right and right-to-left on different lines. This is a problem, because you can't now just store a direction somewhere and use that t

        • Forget that. Just use a a substition with labels instead of sprintf-ing everything. Then you can have "Hello my name is $name." and "Guten Tag, Ich heisse $name." (Ok, ok in this instance it's the same order, but I'm having trouble of thinking of better examples and I am lazy and you get the idea and it makes way more sense than %s.) Just name the substitution arguments.
  • Is the topic of i18n too new to garner any usable info?

    Uh, its been around for a decade at least. Maybe a google search would help you.
  • i18nHTML (Score:3, Informative)

    by Mind Booster Noori (772408) on Thursday June 23, 2005 @03:00PM (#12892653) Homepage
    Well, I think you're looking for this [gnunet.org].
  • by truedfx (802492) on Thursday June 23, 2005 @03:02PM (#12892664)
    My team has recently been given the task of implementing internationalization (i18n [wikipedia.org]) in our MySQL databases (PHP-interfaced). Essentially, for every article X, we need it presented in any number of languages (once translated).
    Let's check that link, shall we?
    The distinction between internationalization and localization is subtle but important. Internationalization is the adaptation of products for potential use virtually everywhere, while localization is the addition of special features for use in a specific locale. Subjects unique to localization include:

    * Language translation,
  • Simple (Score:3, Funny)

    by metamatic (202216) on Thursday June 23, 2005 @03:02PM (#12892673) Homepage Journal
    I shout loudly and tell the users to learn English.

    (I keed, I keeed...)
  • Surpise! (Score:3, Interesting)

    by fm6 (162816) on Thursday June 23, 2005 @03:16PM (#12892794) Homepage Journal
    ...we were very surprised to find that there's not much organized information...
    You shouldn't be. Internationalization (I'm a good typist, so I can dispense with that mysterious "18") only applies to human-readable stuff. In other words, documentation. (Yes, captions on forms are documentation too!) Is there anything software people are less motivated to deal with than documentation?
    • Localization applies to documentation and other human readable stuff, because it involves adapting the program and it's documentation for a particular locale.

      Internationalization is the process of adapting your program so that it can easily be made to work in any locale. Not hardcoding strings in english, not assuming 1 byte == 1 char, that kind of thing. A good i18n architecture makes localization much easier.
    • 18 characters are removed from Internationalization to make I18n. 10 characters are removed from Localization to get L10n.

      -Robert
  • UTF! (Score:3, Insightful)

    by EvilIdler (21087) on Thursday June 23, 2005 @03:32PM (#12892965)
    Definitely use UTF-8 for all your strings and XHTML documents.
    Make sure your preferred editors really are saving UTF-8.
  • The i18l wiki [wikipedia.org] scope section calls out profanity and morality. This really caught my attention. There is no explanation of their inclusion in the wiki. Why are they listed separate from language translation? Could anyone explain if/how/why they are incorporating profanity and morality into their i18n plans?
    • by bluGill (862)

      Because these issues will trip you up.

      Particularly when using automatic translation (which is a bad idea anyway), something that is acceptable in your language may come out as something unacceptable in a different one. No matter how cheap you are trying to get by, you still need a someone to check profanity in your output. This is less a problem with human translators who will avoid the issue, but even still you should check because some translators will apply them thinking you won't know.

      Morality i

  • by Anonymous Coward
    I found the following Rails article quite helpful:

    http://manuals.rubyonrails.com/read/chapter/82 [rubyonrails.com]

    In particular it links to the following:

    http://www.quepublishing.com/articles/printerfrien dly.asp?p=328641&rl=1 [quepublishing.com]

    Which is a very good discussion of characters sets in MySQL. I didn't realize it was so thorough. For instance you can have different character sets on tables, connections, and the server itself. Finally, it seems MySQL got something right. :-)
  • I created a multilingual user interface for a moderately complicated web application with a small number of users like this:

    create an include directory 'lang' with language files for every language needed. In my case, two 'en.inc.php' for English and 'nl.inc.php' for Dutch. These files contain the strings for the interface in an associative array. Example:

    'nl.inc.php' contains:

    $l10n['ja'] = 'ja';

    'en.inc.php' contains:

    $l10n['ja'] = 'yes';

    I use a session to store the desired language:

    if (isset($

    • I found that translating some concepts gave strings of very different lengths. For example, some technical stuff became much longer strings in Spanish (maybe it was my translators). What do you do about the problem of the web forms getting messed up in different languages? My site is small enough to just test and adjust where necessary, but for a bigger site, this could be a problem.
      • There's not a perfect rule, but the oft-repeated rul-of-thumb is that you should leave 35% spare 'space' if you write in English. The way I understand the rule is that if your text in English takes up 65% of the space that you could use for text then you probably have enough room to place the translated text in that location for any other language.

        Of course this only makes sense for horizontal text and maybe even only left-to-right at that. It's also bound to be wildly off in some cases. The reasoning I h
        • There's not a perfect rule, but the oft-repeated rul-of-thumb is that you should leave 35% spare 'space' if you write in English. The way I understand the rule is that if your text in English takes up 65% of the space that you could use for text then you probably have enough room to place the translated text in that location for any other language.

          Some southeast Asian languages (e.g., Burmese and Khmer) stack letters vertically in certain cases, so they end up taking a lot more space. What I mean is

      • I found that translating some concepts gave strings of very different lengths. For example, some technical stuff became much longer strings in Spanish (maybe it was my translators). What do you do about the problem of the web forms getting messed up in different languages? My site is small enough to just test and adjust where necessary, but for a bigger site, this could be a problem.

        In my case the number of different page templates (about 50) and languages (two, English and Dutch) was also small enough t

  • It's a proportionality thing.. Often, the difficulty of programming i18n is less dramatic than the problem of actually generating all the different language sets.. Often such management means an advanced GUI (maybe not advanced, but certainly more than just raw field entries for a DB-backed widget).

    i18n is generally token language-set in a 1:n relationship.. Which maps nicely to table layouts, thus I don't see any need to create i18n support in the DB itself.

    If you want some degree of abstraction, java p
  • by DamienMcKenna (181101) <damien@NoSpaM.mc-kenna.com> on Thursday June 23, 2005 @04:23PM (#12893470)
    I did this in 2003 for a CMS+ecommerse system I did for a company. You had Smarty [php.net] templates which had things like {productstr1} in them. The text strings were referenced by language and string ID, and if the string didn't have a specific version for your language it defaulted to English. This string was loaded from the database in a preparse plugin and was cached in a per-language directory. It worked ok, a bit kludgy but sufficient to get the job done.

    Damien
  • From a database perspective, there's two basic ways to do this. Assuming you need to present an I18N version of a Widget table, you can:

    1. Define Widget and WidgetText, with all the I18N material moved to WidgetText. WidgetText is keyed on the Id from Widget and a Culture identifier. Every time you need a Widget, you JOIN to WidgetText based on the Id from Widget and the Culture identifier of the requesting user.

    2. Add a Culture identifier column to your Widget table, and use that in your WHERE clause
  • by floop (11798) *
    ./configure --without-nls
  • Regarding PHP, http://www.joelonsoftware.com/items/2003/10/10.htm l [joelonsoftware.com] is instructive. Yes, I did confirm from the PHP website that things aren't too different now.

    MySQL? The less said, the better.
  • by Ruis (21357)
    If you want to use gettext with php, I wrote a very simple howto on the subject. http://ruistech.com/gettext/ [ruistech.com]
  • You may need to start by converting your iso-8859-1 or other European ASCII to UTF-8 or another sensible Unicode charset. Some of our MySQL data was in the dreaded windows-1252 encoding, and I had to convert it to UTF. I downloaded the Convert Charset class (found via http://phpclasses.org/ [phpclasses.org] from Mikoaj Jdrzejak [republika.pl], and with that I discovered I could basically convert anything I wanted from whatever charset to whichever charset I like. Wrote a couple scripts, and that was that.
  • Why? (Score:1, Troll)

    by nurb432 (527695)
    Those stupid langauge dont count, so why support them?

    If you cant speak/read English, then screw you.

    Hell, if you arent an American, screw you. Even better.

    Ya, mod me down. I dont care. Ill be the one laughing when your job is outsourced. You people cant hide from the truth forever.

  • by xluap (652530)
    The open source forum phpBB uses I18n. You can study it's source as an example how this can be done in php.

    www.phpbb.com
  • by Bitsy Boffin (110334) on Thursday June 23, 2005 @10:31PM (#12896950) Homepage
    Use gettext for general string i18n & l10n. Gettext is the defacto standard, it works, it's reasonably efficient, and there are many tools to support "unskilled" localisers to do the translating for you.

    For large or potentially dynamic text l10n (eg entire content of pages, descriptions of products in a database, etc etc..) then you need to have 1 version for each language you are supporting (you COULD do it through gettext but it would be rather tedious). How you do that is of course 100% dependant on your application.

  • might I suggest you browse various PHP OSS projects. Most of the biggest most popular packages have language selections. You're bound to find some good examples on how to handle i18n.
  • As a number of people have mentioned, Internationalization and localization can be an incredibly complex process.

    Since you are working with an existing system, you don't have the option of designing in I18N support from the very beginning.

    Get a good book.

    I recommend "XML Internationalization and Localization" by Yves Savourel, and "Beyond Borders web globalization strategies" by John Yunker. Both the authors have been in the I18N business a long time. They know what they are talking about.

    Choose

  • First of all read this article. Yes, it's from perl not php but it's an awesome introduction to some of the problems you might have

    http://perl.active-venture.com/lib/Locale/Maketext /TPJ13.html [active-venture.com]

Never make anything simple and efficient when a way can be found to make it complex and wonderful.

Working...