Could someone point me to an overview of how Snitz handles internationalization?
I currently manage an open-source help desk project called Liberum Help Desk (http://www.liberum.org), and I am trying to get a feel for how other database driven, ASP applications handle multiple languages.
Here's how Liberum is currently working:
First off, in our system the database holds the language stringsn and each user can select a different language to view the pages in (plus there is a default language selected for the help desk for those who aren't logged in).
Tables Layout
tblLanguages
LangPK Int
LangName VC64
tblLangStrings
StringPK Int
LangFK Int (relates to tblLanguages.LangPK)
LangVariable VC64
LangString Text
tblUsers
[normal user information]
LangFK Int (relationship to tblLanguage.LankPK)
In the web pages where we want to print text we use a function and pass it the variable name of the string. For example, if we wanted to print "Submit New Problem", the code would be:
<%=Lang("SubmitNewProb")%>
The function 'Lang' does the interesting part. Instead of just reading in a translated string one variable at a time, it reads all strings for a language at a time. The strings are then stored in an application variable so future request for translated strings won't need to hit the database. The reason this was done was becuase on a given page there may be 20+ request for translated strings.
Here's some psuedo-code for Function Lang(strStringVariable):
SELECT LangFK FROM tblUsers
If Not IsObject(Application("LangCache")) Then
' ### If the cache doesn't exist, created it by querying the DB
SELECT LangVariable, LangString FROM tblLangStrings
WHERE LangFK = [tblUsers.LangFK]
Application("LangCache") = rs.GetRows
End If
Lang = FindInArray(Application("LangCache"), strStringVariable)
FindInArray is fairly efficient in searching the cache and has a O(n) = sqrt(n). I guess my concern with this is the amount of memory usage on the web server when have all of the languages cached. We currently have about 400 strings, which may increase to 1000 for the next release. If we average about 30 bytes for the translated text and 10 bytes for the variable, that's 40 bytes per entry which is 39KB (40B * 1000) per language. A site with 3 languages enabled is using about 120KB of memory for these Application variables.
How does Snitz compare in handling the translated strings? I haven't had a chance to go through the code as I've been a little busy with my project (and cleaning up my hacked forum). Does Snitz even use the database to house translated strings?
Thanks for you time and any help you can give me!
Doug Luxem
[moved by bozden on 01 October 2002]
<