locked
Dynamic text localization RRS feed

  • Question

  • User-1404871118 posted

    Hey, I'm currently researching ways to offer multilingual support on a website I am involved in.

    I'm currently waying up the pros and cons of either using the asp.net resource files or storing all the data for labels etc in a database.

    The idea of using the resource files with the ability to use the “Generate Local Resource” function is appealing due to the fact that the it will be a lot quicker to implement(it’s a rather big website) with a lot of labels.

    What I'm unsure about is how to localize dynamic text using this method.  For instance we have a sales items page where there are various checks when trying to add a new sales item, each one of these checks has a resulting error message which we display in a single label.  How would I localize this data using the resx files?  I thought it might just be changing the meta:resourcekey of  the object but I couldn't’t find any examples.

    Any info / advice on this is appreciated.

    Cheers, 

    Tuesday, August 14, 2007 4:51 AM

All replies

  • User-1974636474 posted

    Maybe

     

    if (A)
       errorLabel.Text = GetLocalResourceObject("myErrorMsg");
    else
       errorLabel.Text = GetLocalResourceObject("myAltErrorMsg");
     Or did I get something wrong?
    Tuesday, August 14, 2007 6:26 AM
  • User-1404871118 posted

     Ahh, thats exactly what I wanted, couldnt seem to find that snippet anywhere.

     

    Cheers 

    Tuesday, August 14, 2007 6:35 AM
  • User482119511 posted
    I'm curious as to how you are implementing the localization. Localization, if done correctly, should not force you to do IF statements to load different error strings, instead they should be stored in separate resource files for a specific culture.  Am I missing something in your description that makes my assumptions incorrect?
    Wednesday, August 15, 2007 1:19 PM
  • User-1404871118 posted
    The if statements are already there, they are used to display error messages such as "Item name already exists".  So that will need to be translated and put into the seperate resx files.

    Caligares Krom's has fully answered my question on how to do what I wanted.

    errorLabel.Text = GetLocalResourceObject("itemAlreadyExistsMsg");

    Thanks again.
    Thursday, August 16, 2007 3:43 AM
  • User774853046 posted

    I want to dynamically load resource files depends upon the language selected by the user. Kindly help me solve this problem.

    Thanks

    Tuesday, August 21, 2007 10:46 AM
  • User2112451447 posted

    I want to dynamically load resource files depends upon the language selected by the user. Kindly help me solve this problem.

    http://msdn.microsoft.com/en-us/library/bz9tc508(VS.80).aspx  (look at the section about setting the culture programmatically)

    HTH

    Thursday, August 23, 2007 12:49 PM
  • User774853046 posted

    Thanks Jimmy,

     I worked out that problem. Now I am fetching values from resource files. At the same time i want to fetch locale values from ORACLE Database also, for populating some dropdowns. Kindly guide me.

     Cheers

    Friday, August 24, 2007 1:34 AM