site in multiple language

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • vishal

    site in multiple language

    hi

    here is vishal.

    i am creating a site which will have one option for change language.
    once user selects the language i am storing his reply in session
    variable. then i want to display the site in his selected language. so
    can anyone give me idea that how can i achieve this????

    whether i should use database for storing words in different languages
    or i should use file for each language.

    is there any other better way to solve this problem???????

    thxs for your reply in advance.

  • Erwin Moller

    #2
    Re: site in multiple language

    vishal wrote:
    [color=blue]
    > hi
    >
    > here is vishal.
    >
    > i am creating a site which will have one option for change language.
    > once user selects the language i am storing his reply in session
    > variable. then i want to display the site in his selected language. so
    > can anyone give me idea that how can i achieve this????
    >
    > whether i should use database for storing words in different languages
    > or i should use file for each language.
    >
    > is there any other better way to solve this problem???????
    >
    > thxs for your reply in advance.[/color]

    Hi vishal,

    The technical side isn't complicated, the syntax/language part is hard.
    What you need to create is a database that stores all pieces of text for
    each language and retrieve the needed once on each request.

    Something like this:

    [postgresql style]

    // contains possible languages
    CREATE TABLE tbllanguage(
    languageid SERIAL PRIMARY KEY,
    language TEXT
    )

    // contains names for pieces of text
    // websitetextname here is just a name for yourself to identify the
    // piece of text, it is not used to display.
    CREATE TABLE tblwebsitetextn ames(
    websitetextname sid SERIAL PRIMARY KEY,
    websitetextname TEXT
    )

    // contains the content for peices of text in a langauge
    CREATE TABLE tblwebsitetextl anguage(
    websitetextlang uageid SERIAL PRIMARY KEY,
    languageid integer REFERENCES tbllanguage(lan guageid),
    websitetextname sid integer REFERENCES
    tblwebsitetextn ames(websitetex tnamesid),
    thetext TEXT
    )

    Suppose you store the languageid in a session.
    On a page you need 3 pieces of text (indentified by websitetextsid) , you can
    look them up in tblwebsitetextl anguage.

    If you use languages with difficult characters, be sure to look into all the
    encodingtypes. (I cannot help there)

    A few tips:
    1: It makes sense to retrieve all the needed peices of text needed on a page
    in 1 query for speed at the top of the page.
    Remember that retrieving 20 rows in 1 query is much faster than 20 seperate
    queries.

    2: You can handle images in the same way. Just let thetext in
    tblwebsitetextl anguage contain an image, including the tag: <img
    src='frenchlogo .gif'>

    3: I am sure more advanched content management systems have similar
    functionality, so if you doubt you can roll this one, have a look at them.

    This is just a basic setup.
    Hope it helps.

    Regards,
    Erwin Moller

    Comment

    • Michael Fesser

      #3
      Re: site in multiple language

      .oO(vishal)
      [color=blue]
      >i am creating a site which will have one option for change language.
      >once user selects the language i am storing his reply in session
      >variable. then i want to display the site in his selected language. so
      >can anyone give me idea that how can i achieve this????
      >
      >whether i should use database for storing words in different languages
      >or i should use file for each language.[/color]

      gettext might be an option as well.

      Micha

      Comment

      • Chung Leong

        #4
        Re: site in multiple language

        "vishal" <vishal_panjabi @yahoo.co.in> wrote in message
        news:1110441931 .954429.134540@ z14g2000cwz.goo glegroups.com.. .[color=blue]
        > hi
        >
        > here is vishal.
        >
        > i am creating a site which will have one option for change language.
        > once user selects the language i am storing his reply in session
        > variable. then i want to display the site in his selected language. so
        > can anyone give me idea that how can i achieve this????
        >
        > whether i should use database for storing words in different languages
        > or i should use file for each language.[/color]

        It all depends on the languages you're supporting. It's one thing to handle
        English, French, and German, it's quite another to handle English, Hindi,
        and Urdu.


        Comment

        • vishal

          #5
          Re: site in multiple language

          thxs for your valuable information

          Comment

          Working...