|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Multi language tooltips in Windows formsI am working on an application which needs localization. I am able to localize all the controls on the form except the tool tips. I searched alot on google, but was unable to find some sample application. Does anyone here have an idea for implementing localization easily for tool tips in windows forms application ? Another question is about the procedure to implement localization in winforms application. I have built a class library which has a method named ApplyCulture. This method takes an argument of form object by ref and then I iterate through controls collection to set strings retrieved from database. This is so because I wanted to store my key / value pairs for multilanguage in database instead of RESX files. So now the actual question is, whether my approach is optimal and obvious ? Or is there anything I can do to make it optimal. Also, when you add a RESX file, how does the strings change when you change UICulture property of current thread. Any help would be appreciated. Thanks, coolCoder. On 28 Nov., 13:21, coolCoder <anant.yadunath.kulka***@gmail.com>
wrote: > I am working on an application which needs localization. I am I would use 'My.Resources' for this purpose. Simply copy your> able to localize all the controls on the form except the tool tips. I > searched alot on google, but was unable to find some sample > application. Does anyone here have an idea for implementing > localization easily for tool tips in windows forms application ? project's "Resources.resx" file, rename it to "Resources.de-DE.resx" for German resources, for example. You can use any language identifier instead of the 'de-DE', even 'de' or 'en'. Then you can pass 'My.Resources.SampleToolTip' in the call to your 'ToolTip' object's 'SetToolTip' method. > Another question is about the procedure to implement This is not as easy because it's impossible to determine where the> localization in winforms application. I have built a class library > which has a method named ApplyCulture. This method takes an argument > of form object by ref and then I iterate through controls collection > to set strings retrieved from database. This is so because I wanted to > store my key / value pairs for multilanguage in database instead of > RESX files. So now the actual question is, whether my approach is > optimal and obvious ? Or is there anything I can do to make it > optimal. Also, when you add a RESX file, how does the strings change > when you change UICulture property of current thread. string assigned to a control comes from (which resource, to be more precise). You'll have to store this information somewhere in order to assign the right string to the control.
Show quote
Hide quote
On Nov 28, 7:56 pm, "Herfried K. Wagner [MVP]" <h***@gmx.at> wrote: Hi Herfried,> On 28 Nov., 13:21, coolCoder <anant.yadunath.kulka***@gmail.com> > wrote: > > > I am working on an application which needs localization. I am > > able to localize all the controls on the form except the tool tips. I > > searched alot on google, but was unable to find some sample > > application. Does anyone here have an idea for implementing > > localization easily for tool tips in windows forms application ? > > I would use 'My.Resources' for this purpose. Simply copy your > project's "Resources.resx" file, rename it to "Resources.de-DE.resx" > for German resources, for example. You can use any language > identifier instead of the 'de-DE', even 'de' or 'en'. Then you can > pass 'My.Resources.SampleToolTip' in the call to your 'ToolTip' > object's 'SetToolTip' method. > > > Another question is about the procedure to implement > > localization in winforms application. I have built a class library > > which has a method named ApplyCulture. This method takes an argument > > of form object by ref and then I iterate through controls collection > > to set strings retrieved from database. This is so because I wanted to > > store my key / value pairs for multilanguage in database instead of > > RESX files. So now the actual question is, whether my approach is > > optimal and obvious ? Or is there anything I can do to make it > > optimal. Also, when you add a RESX file, how does the strings change > > when you change UICulture property of current thread. > > This is not as easy because it's impossible to determine where the > string assigned to a control comes from (which resource, to be more > precise). You'll have to store this information somewhere in order to > assign the right string to the control. > > -- > Herfried K. Wagner [MVP] > <URL:http://dotnet.mvps.org/> First of all, thanks for your reply. Actually I have extended the ResourceManager class so that I have a new class called ResourceManagerSql. This class does have GetString() method which returns me correct string value for a key passed as an argument. Now let me clear my questions a bit. 1. I have described that I am iterating through controls collections and there child controls to change the strings when user switches language. <User can switch language using a button> So, I wanted to know, how the strings are changed when you use RESX files ? Automatically or whether the IDE (VS.NET 2005) writes code for changing these strings some where ? If I am totally lost on the topic, please let me know the exact procedure to extend the ResourceManager class so that strings automatically change when I set the UICulture of current thread. 2. Now the second question is related to the first. Since tool tip is a control extender, I am not able to access ToolTip property from code itself. So imagine a class library, which iterates through each and every control and changes the strings as it finds those in the database. How can I set ToolTips in this fashion ? Whether my approach is correct or not ? I did not find any material for extending the ResourceManager class. Can you please point me to some useful link ? Thanks, coolCoder
sort two arrays as one?
Copying files with progress bar How to stop disabled text boxes being greyed out VB2008 changes? Simple Pulbic Variable Exclude code of my application Vb.Net/SQL slowdown Kill explorer process and disable it restart automatically VB.NET desktop equivalent to asp.net stylesheets using foxpro table from VB.net 2005 with oledb |
|||||||||||||||||||||||