Re: Multi-Language Site

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: J. Baute (WUPYRDEDAWJD_at_spammotel.com)
Date: 03/29/04


Date: Mon, 29 Mar 2004 09:44:41 +0200


To make things easier to use I'd suggest you write a bit of a framework to
handle the translation bit.
First of all, I wouldn't use a number as that stringID. They are just too
hard to remember once you start getting a lot of different records. Instead
a meaningfull string would be a better option IMO, something like
"LblBasket" for instance, indicating you want the string for a label which
says "Basket".

Depending on the number of translatable strings your app is going to use you
could load them all at once at the start of your page in a disconnected
recordset, and then simply use a filter to get those strings you need.
An InitTranslations() functions could take care of that, together with a
GetTrans(StringId, LanguageId) function, to fetch the wanted translated
string in the given language.
If you have a lot of pages in your app, and a lot of strings to translate it
might be a good idea to add a PageID to your table, so you can store text
seperatly by page, and also request them by page (less data to request =
faster page loading).

Also, you might consider storing all translation data in the Application
object as a freethreaded XML object, which will remove the need of
requesting the strings from the DB all the time, which will make it a lot
faster.

hope this helps,
J.

"Laphan" <news@DoNotEmailMe.co.uk> wrote in message
news:#aNDoPQFEHA.3096@TK2MSFTNGP11.phx.gbl...
> Hi All
>
> I've seen a few examples of multi-language ASP web sites, but none that
seem
> to do it very well.
>
> Basically I can see that all of the strings need to be kept in the
database
> and that the relevant table needs to be constructed as follows:
>
> STRINGID, LANGUAGEID, STRING
> 123, ENG, Basket
> 124, FRA, Baskete
> 125, NL, Baskeet
>
> and as I, the admin user, adds the possibility of another language to the
> system then I could simply duplicate the ENG (English) strings so that the
> normal user could then simply see the fields that need to edited, but what
I
> can't fathom is how I get this info into the relevant places on the web
> pages.
>
> As far as I can see the above is easy to select, eg SELECT STRING FROM
> LANGUAGES WHERE LANGUAGEID=ENG AND STRINGID IN (stringID, stringID,
> stringID, etc) << this bit means that I can hit the SQL with just the
string
> values that I want for a specific page, but how the hell will I know which
> are going where on the page when I start to use them? Surely the only
> reference that I will have is oRSv("STRING") to put in all of the relevant
> places, which won't make much sense on the page.
>
> Another factor is that I may want to change the prompts at the top of my
web
> site, do various other sql queries (eg show some products, show some
links,
> etc) and then translate the prompts at the bottom of the page. How on
earth
> can I get round this, as I can't translate the whole page and go back and
I
> can't do a bit of translation, tootle off a do other DB stuff and then
> finish off the translations as this seems a bit flakey.
>
> Any suggestions?
>
> Rgds
>
> Laphan
>
>



Relevant Pages

  • Re: Which is this sentence
    ... But in order to achieve this translation ... is objectionable in NAFL). ... This superposition state is similar to the Schrodinger cat's ... Now define the "fixed point term" for any string S to be ...
    (sci.logic)
  • Re: Language Selcection Philosophy
    ... This is the general approach of GNU gettext, ... The basic idea is that each string literal is replaced by a call to ... A utility extracts all these from the source and builds a "translation ... In the actual code, the _macro invocations ...
    (comp.arch.embedded)
  • Re: Anyone wanna help with a compression routine (new type)
    ... Pi is an infinite pseudorandom string. ... we know: For every language a part of at least 1 ... The problem is an important one as the compression of an algorithm ... translation by having a language pair. ...
    (sci.math.research)
  • Re: Saving strings to ini file
    ... My test app creates data like this: ... > other string constants, things normally declared like ... A class that encapsulates translation behavior works for me. ... string; replacements ...
    (alt.comp.lang.borland-delphi)
  • Re: Multi-Language Site
    ... a meaningfull string would be a better option IMO, ... GetTrans(StringId, LanguageId) function, to fetch the wanted translated ... and also request them by page (less data to request = ... you might consider storing all translation data in the Application ...
    (microsoft.public.inetserver.asp.db)