Localization and databases

Last post 07-22-2008 9:51 PM by notinhere. 9 replies.

Sort Posts:

  • Localization and databases

    04-17-2008, 10:10 AM
    • Loading...
    • Dinsdale
    • Joined on 06-29-2007, 2:07 PM
    • Posts 9

    We are currently designing a real estate website.  We've done many similar websites in classic ASP but this is the first for us in ASP.NET.  We've been very impressed with the localization support within ASP.NET but would like some advice regarding the best way forward to support different languages for data stored within a database.  All our sites have been multilingual in asp and we've used a customized dictionary for the static text.  Within the database, for example, in the property types table we have included a field - language_id.  If we have two languages, say English and Spanish, one row would have the label "House" with the language id for English and another row would have the label "Casa" with the language id for Spanish.  If we want to populate a drop down box with the Spanish names for property types we just query for all labels that have the Spanish langauge id.  My question is, is there a more streamlined approach to this in ASP.NET that ties in with the localization features.  Someone has suggested to me that there is a way using seperate tables (property_types_en-GB, property_types_en-US, property_types_es etc) that ties in with the localization support but unfortunately he didn't know the details :(.

    I hope that this explanation is clear.  Any advice would be greatly appreciated.

  • Re: Localization and databases

    06-04-2008, 8:06 PM

    From the example you gave (unless there are only 2 or 3 types), it sounds like names for property types should be data, it might not change very often but it not really static.

    If you are using the same sort of aproach to get the text "Please pick a property type" that you put next to the list. That text is a better target for resource files.

  • Re: Localization and databases

    06-05-2008, 5:15 AM
    • Loading...
    • ReyN
    • Joined on 07-28-2002, 10:53 AM
    • Pilipinas
    • Posts 413

    hello

    >> is there a more streamlined approach to this in ASP.NET that ties in with the localization features.

    I believe that will depend on the amount of data you are involved with. if you will just be localizing a few hundred name=value pairs for one or two languages, then .resx files may suffice. as far as I know, Microsoft's language glossaries ( the ones I think they use in their resource files ) contain a couple thousand entries for each language.

    But the localization features in  ASP.NET are somewhat limited to translating the user interface, not the data. I think Microsoft originally used these resources for building an OS which can have buttons, tabs, toolbar and menu labels and captions, etc. in different languages, not really for presenting data.

    So if you will be dealing with a large amount of translated property names, descriptions, specifications, features, etc., in multiple languages, I believe storing the resources in a database would be more appropriate. And the suggestion on separating the resources into language-specific tables might not be a bad idea.

    How to tie this up with the localization features such as resource expressions and typed object references is the big question. I haven't chanced upon any Microsoft documentation on how to go about this.

    Anyway, in a multi-lingual site I am currently helping to build for a client, we opted for the language-specific tables and just did away with the localization features in ASP.NET. we manage the content resources just as we manage any other databases. Once a user selects the language and locale, we simply work with data from the appropriate tables.

    Reynald V. Nuñez
    aspxtreme
  • Re: Localization and databases

    06-05-2008, 5:43 AM
    • Loading...
    • Dinsdale
    • Joined on 06-29-2007, 2:07 PM
    • Posts 9

    Hello,

    We are currently in the process of developng this site and have so far opted for our old approach of using a language_code column in the property types table for storing the locale codes.  We have also created views for this table so we can see at a glance the property types in the various languages.  However it has created some problems along the way and to be hosest it hasn't been a perfect solution.  I've always like the idea of using completely language-specific tables and in hindsight it may have worked better in various ways.  I find it interesting that you have chosen to completely put aside the localization features and to use the database for all resources.  It seems to me that Microsoft have but a lot of thought into the localization features but on the other hand we are very surprised that they haven't developed an elegant (if any) solution when it comes to displaying language-specific data.  Thanks for your help and advice.

    Paul

  • Re: Localization and databases

    06-05-2008, 9:03 AM
    • Loading...
    • ReyN
    • Joined on 07-28-2002, 10:53 AM
    • Pilipinas
    • Posts 413

    >> I find it interesting that you have chosen to completely put aside the localization features and to use the database for all resources. 

    Actually, we did not do away with localization resources entirely, only for the data presentation, where we use good old SQL and databinding expressions.

    We still use localized resources for the user interface, such as for control captions, instructional labels, message box, etc. and we fully utilize whatever limited features are available, such as typed object referencing, implicit/explicit resource expressions, get resource methods, etc. I think this is what it is best suited for.

    In fact even the MS docs on localization clearly states that: Localization consists primarily of translating the user interface.

    Reynald V. Nuñez
    aspxtreme
  • Re: Localization and databases

    06-07-2008, 2:43 AM
    • Loading...
    • ReyN
    • Joined on 07-28-2002, 10:53 AM
    • Pilipinas
    • Posts 413

    and by the way, i almost forgot

    in my mind one of the better uses of ASP.NET resources is in conjunction with the Login controls (login, createuserwizard, passwordrecovery, changepassword, etc.) as the text and label attributes of these controls are fully localizable, including button captions, error messages and instructional text!

    this is particularly useful when you are developing for a site with a multilingual membership base Big Smile

    Reynald V. Nuñez
    aspxtreme
  • Re: Localization and databases

    06-07-2008, 8:29 AM
    • Loading...
    • KelseyThornton
    • Joined on 07-15-2007, 12:01 PM
    • Breda, The Netherlands
    • Posts 199

    I would like to know how you can cope with date fields from a SQL Server 2005 Express database.

    I have a site running on Windows Server 2003 (English Language versoinand which I would like to have it present datetime items in Dutch (e.g. maandag instead of Monday, juni instead of June...).

    Can I do this without changing the entire machine settings. - I also want other websites to be presented in English!

    Kelsey Thornton
    (In the Netherlands)

    Don't forget - Mark the post which answered your question with "Answer", then that user will get some kudos, and your post will be marked as "Answered" for future readers!
  • Re: Localization and databases

    06-07-2008, 10:55 AM
    • Loading...
    • ReyN
    • Joined on 07-28-2002, 10:53 AM
    • Pilipinas
    • Posts 413

    hi Kelsey

    date, numbers and currency formatting is really more of a "globalization" issue and not really "localization", but anyway ... Wink

    >> Can I do this without changing the entire machine settings. - I also want other websites to be presented in English!

    yes, it depends on what it is specifically you need to do

    you can display dates from a database in the correct culture format by, for example, in a data presentation control such as a GridView

    1 - converting the date string from the db into a DateTime object and applying ToString ( "f'", cultureInfoName ) where cultureInfoName is the CultureInfo you want to display in

     2 - or you can set the entire page to display formatting in the preferred culture by setting @Page culture = cultureInfoName and then setting the DataFormatString of the BoundField to something like "{0:f}"

    This example shows the FullDateTimePattern used for each of the available cultures. Big Smile

    and here you can read more about Setting the Culture for ASP.NET Pages

    Reynald V. Nuñez
    aspxtreme
  • Re: Localization and databases

    06-07-2008, 11:35 AM
    • Loading...
    • KelseyThornton
    • Joined on 07-15-2007, 12:01 PM
    • Breda, The Netherlands
    • Posts 199

    YesCoolGreat advice - I used the globalisation feature of the web.config file to set the culture for my entire site, as it is aimed at Dutch-language speakers.!

    Thanks.

     

    Kelsey Thornton
    (In the Netherlands)

    Don't forget - Mark the post which answered your question with "Answer", then that user will get some kudos, and your post will be marked as "Answered" for future readers!
  • Re: Localization and databases

    07-22-2008, 9:51 PM
    • Loading...
    • notinhere
    • Joined on 07-22-2008, 6:42 AM
    • Posts 1

    hi,

    is there any special setup needed on the servers for these localization/globalization thing? my bi-lingual website is working fine in my laptop, however the system wouldn't save the correct character in the database at the server version (web server (2003), application server (2003) and DB server (oracle 10g). when i try inserting the character directly in oracle tables, it works fine. but upon insert using the system on the application or web server, it doesn't work -- the character is just inverted (?) mark.

    needs urgent advice. 

    thanks.

Page 1 of 1 (10 items)
Microsoft Communities
Page view counter