inetserver asp db:
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
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. [quoted text, click to view] "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 > >
Since i have to deal every day with multi-language (Belgium have 3 languages) i do it this way: I load the language (session or cookie) Select Case Language Case "N" include file with variabels "N.txt" Case "F" include file with variabels "F.txt" Case "D" include file with variabels "D.txt" Case Else include file with variabels "E.txt" End Select In the include files: tName = "Naam" or tName = "Nom" or tName = "Name" or tName = "Last Name" Response.Write tName & ": <Input ......." "Laphan" <news@DoNotEmailMe.co.uk> schreef in bericht news:%23aNDoPQFEHA.3096@TK2MSFTNGP11.phx.gbl... [quoted text, click to view] > 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 > >
Thanks J for your prompt reply. I understand where you are coming from with regard to use a meaningful stringname rather than an ID, but how do I use this on the page. If I did create a field entry called lbBasket, the returning recordset value would be oRSv("STRINGNAME") rather than oRSv("lblBasket") - correct? Could you explain more about the filter and functions that you have mentioned. Is it a case of getting these labels/prompts into some kind of array to use them as and when? Rgds Robbie [quoted text, click to view] "J. Baute" <WUPYRDEDAWJD@spammotel.com> wrote in message news:4067d3ea$0$2001$ba620e4c@news.skynet.be...
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. [quoted text, click to view] "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 > >
[quoted text, click to view] "Astra" <info@NoEmail.com> wrote in message news:40684a3e$1_4@127.0.0.1... > Thanks J for your prompt reply. > > I understand where you are coming from with regard to use a meaningful > stringname rather than an ID, but how do I use this on the page. If I did > create a field entry called lbBasket, the returning recordset value would be > oRSv("STRINGNAME") rather than oRSv("lblBasket") - correct? > > Could you explain more about the filter and functions that you have > mentioned. Is it a case of getting these labels/prompts into some kind of > array to use them as and when?
I wouldn't use the recordset directly, but use a function to deal with that for me. For instance, a GetTrans("LblBasket", "EN") would get you the english text for "Basket". The function itself could look something like this (not tested, just to give you an idea): Function GetTrans(StringID, LangID) oRsv.Filter = "StringID = '" & StringID & "'" If Not oRsv.EOF And oRsv.BOF Then GetTrans = oRsv("String") Else GetTrans = "Translation not found" End If ' Reset filter oRsv.Filter = "" End Function I'm assuming oRsv is an ADO recordset wich contains all necessary translations for this page. Caching this translation data somehow will be a good thing to speed up your pages, so encapsulating all the translation-logic in a set of functions or a class is definatly a good thing, so you can easily refactor it afterwards without having to change the pages that use the translations. If the only function that gets you the data is the GetTrans() function, it doesnt matter if this data comes from an ADO recordset, an array, or an XML object.
Many thanks Guys Rgds Robbie [quoted text, click to view] "Maarten" <nobody@pandora.be> wrote in message news:JcU9c.53856$4x3.3458099@phobos.telenet-ops.be...
Since i have to deal every day with multi-language (Belgium have 3 languages) i do it this way: I load the language (session or cookie) Select Case Language Case "N" include file with variabels "N.txt" Case "F" include file with variabels "F.txt" Case "D" include file with variabels "D.txt" Case Else include file with variabels "E.txt" End Select In the include files: tName = "Naam" or tName = "Nom" or tName = "Name" or tName = "Last Name" Response.Write tName & ": <Input ......." "Laphan" <news@DoNotEmailMe.co.uk> schreef in bericht news:%23aNDoPQFEHA.3096@TK2MSFTNGP11.phx.gbl... [quoted text, click to view] > 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 > >
Don't see what you're looking for? Try a search.
|