PHP

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Multi lingual pages

    12 answers - 994 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Paul Novitski wrote:
    I formulated my question in general since I couldn't find an other
    message here about supporting multiple languages.
    http://php.net/setlocale
    Thanks a lot, these are good points for reading.
    1) Switching language downloads a new version of the current page,
    generally with the same markup but new text. Example:
    http://partcon.ca/
    I'll favor this way especially if several languages have to be provided.
    In both cases I store the text in database tables that contain a
    language field I can select on to match the user's request.
    I wonder if retrieving static texts from the database draws too much
    performance. I know from somebody who stores texts in large data arrays
    an uses shared memory, yet I haven't figured it out how.
    I consider storing static texts as defines and just load a different
    definition file when the user switches language. Is this practical?
    Wyss
  • No.1 | | 1434 bytes | |

    Fri, 2007-01-26 at 21:25 +0100, Wyss wrote:
    Paul Novitski wrote:

    I formulated my question in general since I couldn't find an other
    message here about supporting multiple languages.

    http://php.net/setlocale

    Thanks a lot, these are good points for reading.

    1) Switching language downloads a new version of the current page,
    generally with the same markup but new text. Example:
    http://partcon.ca/

    I'll favor this way especially if several languages have to be provided.

    In both cases I store the text in database tables that contain a
    language field I can select on to match the user's request.

    I wonder if retrieving static texts from the database draws too much
    performance. I know from somebody who stores texts in large data arrays
    an uses shared memory, yet I haven't figured it out how.

    Sure it does, but you can accumulate all the retrieved texts for a page
    and cache them so subsequent hits only require a query for the cached
    entries. If the page has some translations that may or may not show up
    depending on certain values, then you can retrieve the cache, update the
    cache with each translation not previously cached and then re-store the
    cache. After a while you'll only make 1 query (2 if you're sloppy and
    don't check a dirty bit for if the cache actually changed :)

    Cheers,
    Rob.
  • No.2 | | 2002 bytes | |

    At 1/26/2007 12:25 PM, Wyss wrote:
    >Paul Novitski wrote:
    >>In both cases I store the text in database tables that contain a
    >>language field I can select on to match the user's request.

    >
    >I wonder if retrieving static texts from the database draws too much
    >performance. I know from somebody who stores texts in large data
    >arrays an uses shared memory, yet I haven't figured it out how.
    >
    >I consider storing static texts as defines and just load a different
    >definition file when the user switches language. Is this practical?


    If you store your text in a data table and retrieve it with a query,
    you're leaning your weight on SQL (or your database engine of choice).

    If you store your text in individual text files, you're leaning on
    the operating system's own database system to locate, open, and read the file.

    If you store all your text in a single text file, you're leaning on
    server memory to store everything when you may only want a few chunks.

    Unless your site is insanely popular or huge, does the method really
    matter so much? The idea of storing all the text for an entire
    website in a single text file sounds scary but feasible if the site
    size is modest. Servers and database engines are built to perform
    file I/ quickly & efficiently, and I find it unlikely that you'll
    strain the system unless your traffic is enormous, your content huge,
    and your queries inefficient.

    Is your "static text" really static? How often is it modified? If
    you're really concerned about streamlining, consider building your
    pages dynamically from a database but then caching them on the server
    as plain html, refreshing individual files in the cache when your
    SQL-based content changes.

    Regards,

    Paul

    Juniper Webcraft Ltd.
    http://juniperwebcraft.com
  • No.3 | | 2239 bytes | |

    Wyss wrote:
    Paul Novitski wrote:

    I formulated my question in general since I couldn't find an other
    message here about supporting multiple languages.

    >
    >>

    >
    >>

    >http://php.net/setlocale
    >>

    Thanks a lot, these are good points for reading.
    >>

    >1) Switching language downloads a new version of the current page,
    >generally with the same markup but new text. Example:
    >http://partcon.ca/
    >>

    I'll favor this way especially if several languages have to be provided.

    >In both cases I store the text in database tables that contain a
    >language field I can select on to match the user's request.
    >>

    I wonder if retrieving static texts from the database draws too much
    performance. I know from somebody who stores texts in large data arrays
    an uses shared memory, yet I haven't figured it out how.

    I consider storing static texts as defines and just load a different
    definition file when the user switches language. Is this practical?

    don't go down the define('LANG_KEY', 'lang string value'); route - defines
    are comparatively SLW to create. IF you go down the road of loading in text
    from 'per lang' files I would suggest using an array as the storage mechanism:

    $Lang = array(
    'LANG_KEY' ='lang string value',
    // etc
    );

    assoc array are much less heavy to create.

    also consider that there are, imho, 2 kinds of language specific data:

    1. 'static' values - button texts, [error] messages - these are specified during site/application
    design.

    2. 'dynamic' values - document titles, headers, content - these are specified by the owner/user during
    the lifetime of the site/application

    for the rest I'll just say 'ditto' to most of what the other list members replied :-)

    Wyss
  • No.4 | | 3692 bytes | |

    Hello.

    I would like to hook up on this issue a little bit more. I am
    wondering if anybody is willing to share some good advices regarding
    how to implement a good (normative) url structure so to say when it
    comes to multi lingual sites. Let me give you an example.

    IBM has many different domains including .se, .de, .com, .es and so
    on. But, all local domains are redirected to e.g. www.ibm.com/de or
    www.ibm.com/se and so on. Is this "common practise"? Right now, I am
    about to restructure my employers site. But, in contrast to for
    example the IBM site, I would like to bind the content to the
    corresponding domain - without redirecting the visitor. All english
    content for example will be under the .com domain, all swedish
    content will be under .se domain. Hope you see what I mean.

    I am not seeking advices about how to implement such a structure (I
    have done this already). I am more interested in pros and cons with
    either way. My hope is that the site will be more Google friendly.

    Am I making sense? I might also add that I read some articles from W3
    org about localization / internationalization, but I couldn't find
    anything useful so far.

    What is your opinion?

    regards,

    //frank

    27 jan 2007 kl. 01.12 skrev Jochem Maas:

    Wyss wrote:
    >Paul Novitski wrote:
    >>

    >I formulated my question in general since I couldn't find an other
    >message here about supporting multiple languages.
    >>


    http://php.net/setlocale

    >Thanks a lot, these are good points for reading.


    1) Switching language downloads a new version of the current page,
    generally with the same markup but new text. Example:
    http://partcon.ca/

    >I'll favor this way especially if several languages have to be
    >provided.
    >>

    In both cases I store the text in database tables that contain a
    language field I can select on to match the user's request.

    >I wonder if retrieving static texts from the database draws too much
    >performance. I know from somebody who stores texts in large data
    >arrays
    >an uses shared memory, yet I haven't figured it out how.
    >>

    >I consider storing static texts as defines and just load a different
    >definition file when the user switches language. Is this practical?
    >

    don't go down the define('LANG_KEY', 'lang string value'); route -
    defines
    are comparatively SLW to create. IF you go down the road of
    loading in text
    from 'per lang' files I would suggest using an array as the storage
    mechanism:

    $Lang = array(
    'LANG_KEY' ='lang string value',
    // etc
    );

    assoc array are much less heavy to create.

    also consider that there are, imho, 2 kinds of language specific data:

    1. 'static' values - button texts, [error] messages - these are
    specified during site/application
    design.

    2. 'dynamic' values - document titles, headers, content - these are
    specified by the owner/user during
    the lifetime of the site/application

    for the rest I'll just say 'ditto' to most of what the other list
    members replied :-)
    >
    >>

    >Wyss
    >>

    >
  • No.5 | | 3996 bytes | |

    Anyone?

    //frank
    8 feb 2007 kl. 11.24 skrev Frank Arensmeier:

    Hello.

    I would like to hook up on this issue a little bit more. I am
    wondering if anybody is willing to share some good advices
    regarding how to implement a good (normative) url structure so to
    say when it comes to multi lingual sites. Let me give you an example.

    IBM has many different domains including .se, .de, .com, .es and so
    on. But, all local domains are redirected to e.g. www.ibm.com/de or
    www.ibm.com/se and so on. Is this "common practise"? Right now, I
    am about to restructure my employers site. But, in contrast to for
    example the IBM site, I would like to bind the content to the
    corresponding domain - without redirecting the visitor. All english
    content for example will be under the .com domain, all swedish
    content will be under .se domain. Hope you see what I mean.

    I am not seeking advices about how to implement such a structure (I
    have done this already). I am more interested in pros and cons with
    either way. My hope is that the site will be more Google friendly.

    Am I making sense? I might also add that I read some articles from
    W3 org about localization / internationalization, but I couldn't
    find anything useful so far.

    What is your opinion?

    regards,

    //frank
    --
    27 jan 2007 kl. 01.12 skrev Jochem Maas:
    >
    >Wyss wrote:

    Paul Novitski wrote:

    I formulated my question in general since I couldn't find an other
    message here about supporting multiple languages.

    http://php.net/setlocale

    Thanks a lot, these are good points for reading.

    1) Switching language downloads a new version of the current page,
    generally with the same markup but new text. Example:
    http://partcon.ca/

    I'll favor this way especially if several languages have to be
    provided.

    In both cases I store the text in database tables that contain a
    language field I can select on to match the user's request.

    I wonder if retrieving static texts from the database draws too much
    performance. I know from somebody who stores texts in large data
    arrays
    an uses shared memory, yet I haven't figured it out how.

    I consider storing static texts as defines and just load a different
    definition file when the user switches language. Is this practical?
    >>

    >don't go down the define('LANG_KEY', 'lang string value'); route -
    >defines
    >are comparatively SLW to create. IF you go down the road of
    >loading in text
    >from 'per lang' files I would suggest using an array as the
    >storage mechanism:
    >>

    >$Lang = array(
    >'LANG_KEY' ='lang string value',
    >// etc
    >);
    >>

    >assoc array are much less heavy to create.
    >>

    >also consider that there are, imho, 2 kinds of language specific
    >data:
    >>

    >1. 'static' values - button texts, [error] messages - these are
    >specified during site/application
    >design.
    >>

    >2. 'dynamic' values - document titles, headers, content - these
    >are specified by the owner/user during
    >the lifetime of the site/application
    >>

    >for the rest I'll just say 'ditto' to most of what the other list
    >members replied :-)
    >>


    Wyss

    >>

    >--
    >PHP General Mailing List (http://www.php.net/)
    >To unsubscribe, visit: http://www.php.net/unsub.php
    >
  • No.6 | | 2583 bytes | |

    >8 feb 2007 kl. 11.24 skrev Frank Arensmeier:
    >
    >>I would like to hook up on this issue a little bit more. I am
    >>wondering if anybody is willing to share some good advices
    >>regarding how to implement a good (normative) url structure so to
    >>say when it comes to multi lingual sites. Let me give you an example.
    >>
    >>IBM has many different domains including .se, .de, .com, .es and so
    >>on. But, all local domains are redirected to e.g. www.ibm.com/de or
    >>www.ibm.com/se and so on. Is this "common practise"? Right now, I
    >>am about to restructure my employers site. But, in contrast to for
    >>example the IBM site, I would like to bind the content to the
    >>corresponding domain - without redirecting the visitor. All english
    >>content for example will be under the .com domain, all swedish
    >>content will be under .se domain. Hope you see what I mean.
    >>
    >>I am not seeking advices about how to implement such a structure (I
    >>have done this already). I am more interested in pros and cons with
    >>either way. My hope is that the site will be more Google friendly.


    My initial thought is that it will be confusing if you use national
    TLDs instead of IS language codes. I see national TLDs as national
    indicators, not linguistic ones. I think it's appropriate to use a
    series of national TLDs for the branches of an international
    organization in various countries, but I don't see the one-to-one
    correlation between nations and languages that you're reaching
    for. Although using country codes or flags to represent languages
    might appear to work well with a very small and select sampling, it
    breaks down quickly when you include more groups.

    Maybe what would serve you better would be language-specific sub-domains, e.g.:

    sv.example.com (website in Swedish)

    contrasted with:

    example.se (website in Sweden)

    See:

    IS0 639-2
    Alpha-3 codes arranged alphabetically by the English name of language

    By the way, because your question is not how to implement such a
    system in PHP, perhaps this topic isn't really appropriate for this
    list. I'd suggest taking it to one of these:

    multiweb.googlegroups.com
    Webdesign-L
    WSG (Web Standards Group)

    Regards,

    Paul

    Paul Novitski
    Juniper Webcraft Ltd.
    http://juniperwebcraft.com
  • No.7 | | 2596 bytes | |

    Thank you Paul for your comments - very valuable!

    //frank
    9 feb 2007 kl. 10.08 skrev Paul Novitski:

    >
    >8 feb 2007 kl. 11.24 skrev Frank Arensmeier:
    >>

    I would like to hook up on this issue a little bit more. I am
    wondering if anybody is willing to share some good advices
    regarding how to implement a good (normative) url structure so to
    say when it comes to multi lingual sites. Let me give you an
    example.

    IBM has many different domains including .se, .de, .com, .es and so
    on. But, all local domains are redirected to e.g. www.ibm.com/de or
    www.ibm.com/se and so on. Is this "common practise"? Right now, I
    am about to restructure my employers site. But, in contrast to for
    example the IBM site, I would like to bind the content to the
    corresponding domain - without redirecting the visitor. All english
    content for example will be under the .com domain, all swedish
    content will be under .se domain. Hope you see what I mean.

    I am not seeking advices about how to implement such a structure (I
    have done this already). I am more interested in pros and cons with
    either way. My hope is that the site will be more Google friendly.
    --
    My initial thought is that it will be confusing if you use national
    TLDs instead of IS language codes. I see national TLDs as
    national indicators, not linguistic ones. I think it's appropriate
    to use a series of national TLDs for the branches of an
    international organization in various countries, but I don't see
    the one-to-one correlation between nations and languages that
    you're reaching for. Although using country codes or flags to
    represent languages might appear to work well with a very small and
    select sampling, it breaks down quickly when you include more groups.

    Maybe what would serve you better would be language-specific sub-
    domains, e.g.:

    sv.example.com (website in Swedish)

    contrasted with:

    example.se (website in Sweden)

    See:

    IS0 639-2
    Alpha-3 codes arranged alphabetically by the English name of language

    By the way, because your question is not how to implement such a
    system in PHP, perhaps this topic isn't really appropriate for this
    list. I'd suggest taking it to one of these:

    multiweb.googlegroups.com
    Webdesign-L
    WSG (Web Standards Group)

    Regards,

    Paul

    Paul Novitski
    Juniper Webcraft Ltd.
    http://juniperwebcraft.com
  • No.8 | | 4259 bytes | |

    Fri, 2007-02-09 at 09:03 +0100, Frank Arensmeier wrote:
    Anyone?

    If you use top level domains like that then if someone wants to swith
    between languages you won't be able to share session information without
    employing session propogation tricks.

    Cheers,
    Rob.

    //frank
    8 feb 2007 kl. 11.24 skrev Frank Arensmeier:

    Hello.

    I would like to hook up on this issue a little bit more. I am
    wondering if anybody is willing to share some good advices
    regarding how to implement a good (normative) url structure so to
    say when it comes to multi lingual sites. Let me give you an example.

    IBM has many different domains including .se, .de, .com, .es and so
    on. But, all local domains are redirected to e.g. www.ibm.com/de or
    www.ibm.com/se and so on. Is this "common practise"? Right now, I
    am about to restructure my employers site. But, in contrast to for
    example the IBM site, I would like to bind the content to the
    corresponding domain - without redirecting the visitor. All english
    content for example will be under the .com domain, all swedish
    content will be under .se domain. Hope you see what I mean.

    I am not seeking advices about how to implement such a structure (I
    have done this already). I am more interested in pros and cons with
    either way. My hope is that the site will be more Google friendly.

    Am I making sense? I might also add that I read some articles from
    W3 org about localization / internationalization, but I couldn't
    find anything useful so far.

    What is your opinion?

    regards,

    //frank
    --
    27 jan 2007 kl. 01.12 skrev Jochem Maas:
    >
    >Wyss wrote:

    Paul Novitski wrote:

    I formulated my question in general since I couldn't find an other
    message here about supporting multiple languages.

    http://php.net/setlocale

    Thanks a lot, these are good points for reading.

    1) Switching language downloads a new version of the current page,
    generally with the same markup but new text. Example:
    http://partcon.ca/

    I'll favor this way especially if several languages have to be
    provided.

    In both cases I store the text in database tables that contain a
    language field I can select on to match the user's request.

    I wonder if retrieving static texts from the database draws too much
    performance. I know from somebody who stores texts in large data
    arrays
    an uses shared memory, yet I haven't figured it out how.

    I consider storing static texts as defines and just load a different
    definition file when the user switches language. Is this practical?
    >>

    >don't go down the define('LANG_KEY', 'lang string value'); route -
    >defines
    >are comparatively SLW to create. IF you go down the road of
    >loading in text
    >from 'per lang' files I would suggest using an array as the
    >storage mechanism:
    >>

    >$Lang = array(
    >'LANG_KEY' ='lang string value',
    >// etc
    >);
    >>

    >assoc array are much less heavy to create.
    >>

    >also consider that there are, imho, 2 kinds of language specific
    >data:
    >>

    >1. 'static' values - button texts, [error] messages - these are
    >specified during site/application
    >design.
    >>

    >2. 'dynamic' values - document titles, headers, content - these
    >are specified by the owner/user during
    >the lifetime of the site/application
    >>

    >for the rest I'll just say 'ditto' to most of what the other list
    >members replied :-)
    >>


    Wyss

    >>

    >--
    >PHP General Mailing List (http://www.php.net/)
    >To unsubscribe, visit: http://www.php.net/unsub.php
    >
  • No.9 | | 268 bytes | |

    Fri, 2007-02-09 at 07:23 -0500, Robert Cummings wrote:
    Fri, 2007-02-09 at 09:03 +0100, Frank Arensmeier wrote:
    Anyone?
    If you use top level domains like that then if someone wants to swith
    no, I've developed a lithp :)
    Cheers,
    Rob.
  • No.10 | | 4602 bytes | |

    Thank you Robert.

    Actually, I am not so sure anymore if my idea of "binding" localized
    content to domains is the right path to go. After a litte research, I
    saw that many of the major sites out there are redirecting the user
    to subfolders. Maybe this is the right thing to do. What would happen
    if a page is available in English and e.g. american English or when a
    certain domain is not available?

    Right now I am playing with mod_rewrite. Looks promising.
    //frank

    9 feb 2007 kl. 13.23 skrev Robert Cummings:

    Fri, 2007-02-09 at 09:03 +0100, Frank Arensmeier wrote:
    >Anyone?
    >

    If you use top level domains like that then if someone wants to swith
    between languages you won't be able to share session information
    without
    employing session propogation tricks.

    Cheers,
    Rob.
    >
    >>

    >//frank
    >8 feb 2007 kl. 11.24 skrev Frank Arensmeier:
    >>

    Hello.

    I would like to hook up on this issue a little bit more. I am
    wondering if anybody is willing to share some good advices
    regarding how to implement a good (normative) url structure so to
    say when it comes to multi lingual sites. Let me give you an
    example.

    IBM has many different domains including .se, .de, .com, .es and so
    on. But, all local domains are redirected to e.g. www.ibm.com/de or
    www.ibm.com/se and so on. Is this "common practise"? Right now, I
    am about to restructure my employers site. But, in contrast to for
    example the IBM site, I would like to bind the content to the
    corresponding domain - without redirecting the visitor. All english
    content for example will be under the .com domain, all swedish
    content will be under .se domain. Hope you see what I mean.

    I am not seeking advices about how to implement such a structure (I
    have done this already). I am more interested in pros and cons with
    either way. My hope is that the site will be more Google friendly.

    Am I making sense? I might also add that I read some articles from
    W3 org about localization / internationalization, but I couldn't
    find anything useful so far.

    What is your opinion?

    regards,

    //frank

    27 jan 2007 kl. 01.12 skrev Jochem Maas:

    Wyss wrote:
    Paul Novitski wrote:

    I formulated my question in general since I couldn't find an other
    message here about supporting multiple languages.

    http://php.net/setlocale

    Thanks a lot, these are good points for reading.

    1) Switching language downloads a new version of the current
    page,
    generally with the same markup but new text. Example:
    http://partcon.ca/

    I'll favor this way especially if several languages have to be
    provided.

    In both cases I store the text in database tables that contain a
    language field I can select on to match the user's request.

    I wonder if retrieving static texts from the database draws too
    much
    performance. I know from somebody who stores texts in large data
    arrays
    an uses shared memory, yet I haven't figured it out how.

    I consider storing static texts as defines and just load a
    different
    definition file when the user switches language. Is this
    practical?

    don't go down the define('LANG_KEY', 'lang string value'); route -
    defines
    are comparatively SLW to create. IF you go down the road of
    loading in text
    from 'per lang' files I would suggest using an array as the
    storage mechanism:

    $Lang = array(
    'LANG_KEY' ='lang string value',
    // etc
    );

    assoc array are much less heavy to create.

    also consider that there are, imho, 2 kinds of language specific
    data:

    1. 'static' values - button texts, [error] messages - these are
    specified during site/application
    design.

    2. 'dynamic' values - document titles, headers, content - these
    are specified by the owner/user during
    the lifetime of the site/application

    for the rest I'll just say 'ditto' to most of what the other list
    members replied :-)

    Wyss

    --
    PHP General Mailing List (http://www.php.net/)
    To unsubscribe, visit: http://www.php.net/unsub.php

    >>
  • No.11 | | 218 bytes | |

    Paul Novitski wrote:
    Unless your site is insanely popular or huge, does the method really
    Sure I hope to once have an insanely popular or huge site, albeit that
    probably won't happen.
    Wyss
  • No.12 | | 1188 bytes | |

    Jochem Maas wrote:

    don't go down the define('LANG_KEY', 'lang string value'); route - defines
    are comparatively SLW to create. IF you go down the road of loading in text
    from 'per lang' files I would suggest using an array as the storage mechanism:

    $Lang = array(
    'LANG_KEY' ='lang string value',
    // etc
    );

    assoc array are much less heavy to create.

    Thanks, I'll try the assoc array.

    also consider that there are, imho, 2 kinds of language specific data:

    1. 'static' values - button texts, [error] messages - these are specified during site/application
    design.

    Yes these are the static texts I'm talking about. They don't depend on
    data, only on layout and design.

    2. 'dynamic' values - document titles, headers, content - these are specified by the owner/user during
    the lifetime of the site/application

    Sure, I've these values too and store them in the database.

    for the rest I'll just say 'ditto' to most of what the other list members replied :-)

    Thanks a lot.

    Wyss

Re: Multi lingual pages


max 4000 letters.
Your nickname that display:
In order to stop the spam: 9 + 8 =
QUESTION ON "PHP"

EMSDN.COM