We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19405
    • 7 Posts
    Hi all..
    I´m working in a new project, and using an idea that might be usefull here or somebodyelse.

    ’how to store text in a DB field in multiple languajes’ may be the title...

    I need:
    Multiple languages contents in same field .
    maybe Poor for indexing, but really god for development.
    At last, indexing and search will be done with crawlers in the posted pages, not in the database directly.

    i don´t know how much languages in the future.
    I only want to store /have data for languajes used. Not empty fields.

    I develop:

    a parser to store/retrieve data from de DB:
    some objects/functions to generate/manipulate input fields to modify the data dependig of the active languages, some to save the data from those input fields... and some to retrieve the data to publish in the web page via scripting.

    ( in my case VBSCRPIT/JSCRIPT objects mix in ASP ), but portable to php or other SS script.

    The Data:
    {"UK":"Some text","ES":"Algo de texto","DE":"Not know German"}
    YES, it is JSON.
    is stored in A field. not multiple fields, not multiple tables, not multiple nothing.

    Pros:
    flexibility!

    Cons:
    Some server side additional functions.
    DB normalization sad

    BUT IT WORKS.


    hope you can share what do you think about that.
      Saludos.
      Miguelito.
      www.gnomo.net www.cometas.info foro.cometas.info
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      This could be very interesting. I’ve got a translation company client who has four languages already, fortunately European languages, so I’ve got a table for storing commonly used translation terms with four separate fields, one for each language, and due to their database configuration ISO-8859-1 is used. But now they are mumbling something about adding Chinese to the mix. I was considering going to a separate table for each language, but this would work much better! And make AJAX access much easier!
        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