We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4673
    • 577 Posts
    Yes, this does make sense.

    But why the use of gettext then?

    I use a set up of having a table just for languages (wordings) based on a variable (TEXT_NO == no). Along with this I have a language numbering system that I picked up from oscommerce that let's you assign the translation per language (number since that is what they chose). Then cache everything so that the performance hit isn't so bad.

    osccommerce had some plugins that allowed you to added the sql data and I'm pretty postnuke was similar.

    I do use one langauge file for things like dates and such but everything else is in the DB.

    hmmm definitely speed and ease of use is going to be key laugh
      Tangent-Warrior smiley
      • 34162
      • 1 Posts

      But why the use of gettext then?

      Because it handles currency, date, numeric, text orientation, encoding, symbols, and true localization.

      There is a HUGE difference between translation and localization. Translation by itself is pretty useless.

      Localization, on the otherhand, means the program has all needed information so that it can adapt itself to handle its input and output in a fashion which is correct for some native language and cultural habits.

      From the gettext docs: Very roughly said, when it comes to multi-lingual messages, internationalization is usually taken care of by programmers, and localization is usually taken care of by translators.

      What I am talking about is using gettext for the internationalization so we can do precisely that.

      By using gettext (or some similiar method) you handle all of this:

      CODESETS
      The codeset most commonly used through out the USA and most English speaking parts of the world is the ASCII codeset. However, there are many characters needed by various locales that are not found within this codeset. The 8-bit ISO 8859-1 code set has most of the special characters needed to handle the major European languages. However, in many cases, the ISO 8859-1 font is not adequate: it doesn't even handle the major European currency. Hence each locale will need to specify which codeset they need to use and will need to have the appropriate character handling routines to cope with the codeset.
      
      CURRENCY
      The symbols used vary from country to country as does the position used by the symbol. Software needs to be able to transparently display currency figures in the native mode for each locale.
      
      DATES
      The format of date varies between locales. For example, Christmas day in 1994 is written as 12/25/94 in the USA and as 25/12/94 in Australia. Other countries might use ISO 8061 dates, etc.
      
      Time of the day may be noted as hh:mm, hh.mm, or otherwise. Some locales require time to be specified in 24-hour mode rather than as AM or PM. Further, the nature and yearly extent of the Daylight Saving correction vary widely between countries.
      
      NUMBERS
      Numbers can be represented differently in different locales. For example, the following numbers are all written correctly for their respective locales:
      
           12,345.67      English
           12.345,67      German
            12345,67      French 
           1,2345.67      Asia
      
      Some programs could go further and use different unit systems, like English units or Metric units, or even take into account variants about how numbers are spelled in full.
      
      MESSAGES
      The most obvious area is the language support within a locale. This is where gettext provides the means for developers and users to easily change the language that the software uses to communicate to the user. 
      
      


      Using SQL and a lookup table only solves the "Messages" aspect of translation and nothing else. Sure you could build routines to account for differences in numbers, text encoding, dates, etc., but at that point why wouldn't you just use gettext?

      The only reason that this matters to me is that I work for a multinational company that needs to support about eight languages for their website. We already know that doing straight text translation does not work for us, as it doesn't meet the needs for the other aspects.

      On the otherhand, as I've said before, I know nothing about translation, I only speak English ... so if someone has an easy way to solve these other issues, especially if it is simpler, I'm all about it. I just don't want to see us do down the road of "we just need a Spanish version of strings X and Y" and think we have true internationalization because that's only 25% of the actual solution.
        • 4673
        • 577 Posts
        8)

        OK, you got me hooked almost.

        Does it do Iln8 or whatever that numbe is :wink:

        I agree with the multilanguage ability 100% since I'm thinking about Japanese/English based sites.
          Tangent-Warrior smiley
          • 25663 MODX Staff
          • 12,272 Posts
          Moved, 'cause I think that properly handling internationalization is of paramount importance, even though I'm just a redneck and only speak two languages: English and Redneck.

          How should I split this post up to facilitate better commenting on topical threads?
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 4673
            • 577 Posts
            It seems like this thread is honing in pretty well.

            hehe, I didn't help it much in the beginning that's for sure shockedops:

            Would like to start a new thread on just gettext. I'm more in and more in favor of gettext unless a much better alternative sticks it's head up.

            infoclipper would you mind moving part of this topic to a fresh thread?
              Tangent-Warrior smiley
              • 33496
              • 19 Posts
              Just want to say that in a project I am currently involved in, we manage language strings in a database table like the following:

              [table][tr]
              [td]DOC_IDENT[/td]
              [td]EN[/td]
              [td]Document identifier[/td]
              [/tr]
              [tr]
              [td]DOWNLOAD[/td]
              [td]EN[/td]
              [td]Download[/td]
              [/tr]
              [tr]
              [td]DOWNLOAD[/td]
              [td]SE[/td]
              [td]Ladda ner[/td]
              [/tr]
              [/table]

              Just a small example, and it’s working great for us. But using gettext may be that way to go anyway.
                Johnny Chadda
                http://johnny.chadda.se
                "This is a UNIX virus. Please remove all your files and copy this message to friends."
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                I ran across this and thought it interesting:

                http://www.jugglingdb.com/articles/index.php?id=57
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 33496
                  • 19 Posts
                  Quote from: sottwell at Jun 28, 2005, 04:23 AM

                  I ran across this and thought it interesting:

                  http://www.jugglingdb.com/articles/index.php?id=57
                  The problem with his approach is that he uses a different table for each language, making it kind of awkward database wise.

                  If instead all languages should reside in the same table, the primary key could be bound to the text id and the language.
                  ------------------------------
                  |  id    |  lang  |  phrase  |
                  ------------------------------
                  | LOGIN  |  EN    |  Login   |
                  | LOGIN  |  SE    | Logga in |
                  | ABORT  |  EN    | Abort    |
                  ------------------------------


                  Using this approach, everything can be built in to the SQL query string. For example, to get the Swedish translation of the LOGIN id, and if it does not exist, the default(English) should be used instead:

                  SELECT tt.phrase, 1 AS num
                  FROM texttranslations tt
                  WHERE tt.id = 'LOGIN'
                  AND tt.lang = 'SE'
                  UNION
                  SELECT tt.phrase, 2 AS num
                  FROM texttranslations tt
                  WHERE tt.id = 'LOGIN'
                  AND tt.lang = 'EN'
                  ORDER BY num ASC
                  LIMIT 1
                  

                  I haven’t tried the query, but it should return the current language string if it exists, else it will return the English string.

                  The current language could be saved in the database and read up into a session variable on login, so the only argument that needs to be pushed to the GetText() function should be the string id required, like GetText(’MENU_MAIN’);

                  On the site I am currently working on, the complete language array for the user’s language is read up during login an stored in a session, for faster retreival. It may or may not be faster than to query the database on each new string as it occurs.
                    Johnny Chadda
                    http://johnny.chadda.se
                    "This is a UNIX virus. Please remove all your files and copy this message to friends."
                    • 22303 MODX Staff
                    • 10,725 Posts
                    A couple of other ideas:

                    * Add a category or other grouping mechanism to the table so you can organize them into logical groups that could be retrieved from the DB and cached in session in small portions as needed - this might also serve to decrease query time for individual sets of language data and/or allow fine-grained control of each cache if needed

                    * Provide the core language information in a text or XML file format and then allow custom overrides or additions via the table; this will isolate the core language information from implementation specific ones which will be great avoiding conflicts during upgrades

                    * To support the custom language data, provide an admin interface, perhaps similar to the Keyword management, that allowed adding new language keys, values, and categories, or overriding the core ones that ship with the product

                    I’ve used these approaches in a real world J2EE call center application that was deployed in twelve languages, and it made life very easy in regards to managing our multilingual web applications.
                      • 32982
                      • 674 Posts
                      im very new but i solve the international snipet(and oters) problem doing this:
                      duplicate the folder for the second lenguage
                      put a tv (templatevariable dropdown whith values _es|_en|_jp....) in the code of the snipet main word like [[SearchForm[*lenguage*]]]
                      translate the content and duplicate the snipet,chunk,plugin.. renaming (example SearchForm_es,SearchForm_jp...)
                      and make the lenguage for this new snipets.
                      i dont know but making the snipets(...) text by variables at start for change languages
                      or a multilenguage sistem inside the snipets called by a standar value in the core (?)
                      but is a sistem could use now for a full (and easy) translations of a site and by beginers
                      another thing is make a special tv parent , changing parent change some parts of the childs
                      by
                        Jabiertxof (formerly XYZVISUAL)
                        My bussines: http://marker.es
                        https://www.youtube.com/user/jabiertxof/videos