PDA

View Full Version : Multilingual asp web site structure


mohmedsh
05-08-2003, 07:38 AM
Hi
I am new to this forum but i checked it out and i think it is great community.
We are devloping an b2b site that is in eglish. the site is working for about a year till now and we have decided to add a new local arabic version. it was developed using asp and sql and we have some kind big dbase.

here is the options i have in mind
1- create a folder for arabic and copy all files in it then modify them
2- add the language to the same files and choose between them by passing parameter then use the code for the paramter

here are the main information you may need to know to help
1- the site offer products and services that are stored in the dbase. the user will switch between languages and should find all information in the choosen language. that means the dbase will contain 2 versions of the data with the same id so we display the inofrmation related to the language.
2- the layout will be in both languages. keep in mind that we almost have more than 1000 file of codes so any changes or enhancement should be minimum.
3-i am posting right now to find out the best way to make the work time minimum for now and future

include language files is an option too but is it the best option.I have been thinking of include language files but i was thinking that will slow done a bit as this text will have to be as variables or
constants. I may be wrong but i am not sure of making all text and messages this way. also i am realy affriad of using the 2nd option i have for including the 2 languages in the same file for the following reasons
1- i will have to display data from dbase selected for the language and that means the select statment will not be the same for arabic and english.
2- there will be different conditions for arabic and english data view. lets explain,
if the user is in english version and the service is only added in arabic version i will not show the arabic data and i will show for example "data in arabic only click here to view", but if the user is in
arabic version and there is no arabic version of the service i will show the english version.
3- there is a lot of data entry pages and site builder pages that will add arabic in different tables or in different columns in the same tables.
4- dealing with the big number of files is not fine at all and maybe adding french is the next step
i am too much confused and as i have looked out it is not that hard in .net but migration to .net is not an option for now

i am looking for the best way to create the arabic version and any

comments are welcome.

thanks

david7777
05-08-2003, 08:39 AM
I have never done anything like this before, but possible creating a duplicate of the database might be a good idea. So you will have one for english, and one for arabic. So then whatever the user has chosen as their language, you can search the correct database.

Also - creating a seperate folder for the new language could be hell - when you update your site, then you always have to do 2 updates, and eventually, the 2 sites will be completely diffirent and too much work to change.

If you are going through all this trouble to change the language of the site, then why is ASP.NET not an option? You are going to have to re-code all your pages anyway, so why not just upgrade as well? Then at least it will make life easier to add new languages later, and you will be future proofed, as ASP.NET is relativly new and has cutting technology. :)

mohmedsh
05-08-2003, 09:14 AM
thanks david
1st regarding the dbase duplicate i think it is a very good idea but here comes a problem as we have to keep one id for each product or service in any language.
i mean when i add a service i have an id and when i get the version i use the same id for it but if you have any comments i will be gald to know.
the problem for imigration is that i am not .net involved yet and the budget to get a redesign will be high. also that means new host and that is not current option.
i think i will vote for making include language files and declare the text for languages in the files specialy if we consider that our pages are dbase driven so the text will be minimum in the pages.
i will wait for any comments
thanks

raf
05-08-2003, 09:30 AM
Why need a new db?

If you have some sort of star (= a 'central' facts table with mostly numerical values that are foreign key for all descriptive tables) or snowflake (= + extra intermediate tables)design then you could use this central table for all languages and just set up a descriptive table for the variables that need one. Say your facts table looks like
id category product
1-----4-------10

products table like

prID price supplier descr
10---345----23----23

and a description table like

descrID english arab
23------Blabla--Albalb

Then you just need to add a new variable and new values in this last table, if you add a language. Inside your app, when you build the sql statements (on the fly), you only need to specify the variable that needs to be selected from the last table. The joins all stay the same, processing of the recordsets all stays the same etc.

If you have a multi-language site, you'de best use a litle instructiontext etc as possible and it ideally should all be parametrised. And don't set up different folders (unless the different languages offer different functionalitys and content. I've seen some big firms choose the 'seperate folder' approach, but since it is a databasedriven webapp, i'de try to stick with parametrising all textual content and pull it out of a db. Just my opinion.

mohmedsh
05-08-2003, 03:47 PM
it is good idea raf i will look for the dbase design. but i need more information about what do you mean by instructiontext

raf
05-08-2003, 07:13 PM
i need more information about what do you mean by instructiontext
if you take all the text in your app, you'll have text you pull out of a db (descriptions about product ad services etc) and you could make that multi-language with a good db-design.

But you will also have instructions on your webpages. Like "Pick one of the listed services by clicking on the description" and things like that (labels in front of formfields etc). I think that in a multi-language app, you should try to keep them as limited as possible. and probably be best of if you can store these in a db as well(or in an XML file)

mohmedsh
05-08-2003, 08:20 PM
I have recived the following and i will share here
From : Mat Tillett
Hi Mohmedsh

When I develop a multilingual site I use a session to store the
language preferred and then use the session contents for most of the
linking to external files/data etc.

I.e., for all the buttons/gfx used in the site I would store
them in their independent folders: '/images/gb' for English or
'/images/fr' for French, etc

Then using the session that was set previously, I would link to
any images via:

<img src="/images/<%=session("lang" )%>/image.gif">

All body content for the site is stored in a SQL table and again
only retrieved by the session:-

strSQL = "SELECT bodytext FROM Websitetext "
strSQL = strSQL & "WHERE lang = '" & session("lang" ) & "'
"
strSQL = strSQL & "AND webpage = 'index'"

I did have a scenario when the client wanted six languages, but
only three to work and the other three to default to English. What I
did for this was use 'case' to select the language from a querystring
(lang):-

Select case lcase(request("lang" ))
case "fr"
session("lang" ) = "fr"

case "de"
session("lang" ) = "de"

case else
session("lang" ) = "gb"
End Select

Also a good reason to use 'case' was because if people alter the
query string (like they do) it would always default to 'gb', solving
that small problem

This method has worked well for me, and is so easy to add
another language to when the client requires additional languages.

If you have not got access to SQL for the data, you could
possibly use :-

server.execute("index_" & session("lang" ) & ".asp" or spool from
text files, etc. I have not tried this method so I am not to sure how
good it would be.


Your idea of duplicating file and altering them is a BAD idea,
mostly because if you have six languages, and you make a change to any
of the files, you then have to do it a further five times. Imagine if
your alterations are 100 lines of code, in different places...Nightmare!

Apart from that, it has been the most successful for me.

Cheers and HTH,
Mat.
THnaks for mat

mohmedsh
05-08-2003, 08:21 PM
I have recived the following and i will also share here
From : Nick Blower
it appears that you are pulling all your data from a database. there for the
best option is to ask the user what language they want when they start the
site and then only pull the data from the correct table. the trouble with
this is that it could be difficult to maintain the IDs of each record. a
better option would be to have either both sets of data (english and arabic)
is the same table. therefore you'd only need to add say a_ or e_ to the
correct field names. ie a_description or e_description. this would be the
simplest option.
the better option is to have a linking table that says where the data for
each language is. so looking for description of item 12. linking table:

id | english | arabic | french | etc
---+---------+--------+--------+-----
12 | 23 | 44 | 2 | ...
13 | 43 | 12 | 55 | ...

and so on. this would allow you to add as many languages as you like easily.
(after initial setup.)

hope this helps


nick

mohmedsh
05-10-2003, 01:16 AM
I have recived the following too
If there's no possiblity of you EVER needing to add other languages to the site and you want to get this done ASAP, then you can get away with using a session variable (instead of a querystring variable) to hold the current language and select the relevant hardcoded text within the pages.

However, if there IS the *slightest* possibility that you might need to translate it for other language, or you want to do it PROPERLY, then a more flexible and maintainable approach is required.

I went about this by using XML (stored as an in-memory, application level, free-threaded DOM) instead of a database, since it is fast, cached, and easily maintainable. Each language-specific string was pulled out via a quick XPath query (on the single, application-level DOM), wrapped up in a handy function.

e.g.

Code
<languages>
<language shortname="en" longname="English" LCID="2057">
<string name="AccessDenied" value="Access denied"/>
<string name="Apply" value="Apply"/>
<string name="AccessGranted" value="Access granted"/>
<string name="ChooseLanguage" value="Please selected your desired language"/>
<string name="Options" value="Options"/>
<string name="EmailTo" value="Email to"/>
<string name="Next" value="Next"/>
</language>
<language shortname="es" longname="Español" LCID="1034">
</language>
<language shortname="de" longname="Deutsch" LCID="1031">
</language>
<language shortname="dk" longname="Danish" LCID="1030">
</language>
<language shortname="fi" longname="Finnish" LCID="1035">
</language>
<language shortname="it" longname="Italian" LCID="1040">
</language>
<language shortname="nl" longname="Nederlands" LCID="1043">
<string name="Apply" value="Vastleggen"/>
<string name="Options" value="Opties"/>
<string name="EmailTo" value="Email naar"/>
<string name="Next" value="Volgende"/>
</language>
<language shortname="fr" longname="Français" LCID="1036">
</language>
<language shortname="" longname="Svenska" LCID="1053">
</language>
</languages>Let me know if you need more info.

_________________
M@rco - www.marcustucker.com
Analyst Programmer / SPF Mentor (ASP'er of the year '02)

thanks for all
I need more comments please