By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,332 Members | 1,212 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,332 IT Pros & Developers. It's quick & easy.

Translate my application

P: n/a
Hello,

in VB6 I used to translate my application by setting the tag-property of
all controls, menu-entries... to a number which has been linked to a
string (array). Then I went through all controls or a form, checked the
tag-property and changed the caption-property to the lokalized string.
This was working for me fine.
Therefore I wanted to use the same implementation in VB.net.
Unfortunately I found out, that menuitems and some other controls do not
implement a tag-property. I surely could use inheritance to create a
menuentry with a tag-property, but I think the menueditor of my #develop
environment would accept them.
I also tried to use the localizable-property of the form and then to
translate the controls but this does not work with my #develop and the
resources created with winres.exe do not seem to work with it either.
What other ways to translate my apps?
Thanks in advance,

Stefan

--
___________________________________www.VBTricks.de .vu
the free resource for Visual Basic, Gambas and Pascal
components, tips & complete projects

www: http://www.VBTricks.de.vu
mail: vbtricks <at> gmx <dot> net
__________________________________________________ ___
Nov 21 '05 #1
Share this Question
Share on Google+
6 Replies

P: n/a
Hi,

I saw that there was a link including VBNet code how to add a tag property
to a menu Item on msdn.
http://support.microsoft.com/default...b;en-us;555264

Every control has a tag by the way, because in VBNet are controls always
inherited from control which has that.
http://msdn.microsoft.com/library/de...ssTagTopic.asp

I hope this helps,

Cor
Nov 21 '05 #2

P: n/a
Don't know anything about sharpdevelop so can't advise there on
localisation.

I would assume that IExtenderProviders work with its IDE though (otherwise
you couldn't use errorprovider or tooltip) so you may like to implement my
MenuExtender which adds a tag property to standard menuitems (saves manually
changing InitializeComponent() code).

You'll find the source on my site at:
http://dotnetrix.co.uk/menus.html

To set value at runtime:
\\\
MenuExtender1.SetTag(menuitem1,"SomeValue")
///

To get value at runtime:
\\\
Dim someObject As Object = MenuExtender1.GetTag(menuitem1)

If Not (someObject Is Nothing) Then
someValue = someObject.ToString()
End If
///

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"VBTricks.de.vu Webmaster" <no****@thisserverdoesntexist.com> wrote in
message news:eZ**************@TK2MSFTNGP15.phx.gbl...
Hello,

in VB6 I used to translate my application by setting the tag-property of
all controls, menu-entries... to a number which has been linked to a
string (array). Then I went through all controls or a form, checked the
tag-property and changed the caption-property to the lokalized string.
This was working for me fine.
Therefore I wanted to use the same implementation in VB.net. Unfortunately
I found out, that menuitems and some other controls do not implement a
tag-property. I surely could use inheritance to create a menuentry with a
tag-property, but I think the menueditor of my #develop environment would
accept them.
I also tried to use the localizable-property of the form and then to
translate the controls but this does not work with my #develop and the
resources created with winres.exe do not seem to work with it either.
What other ways to translate my apps?
Thanks in advance,

Stefan

--
___________________________________www.VBTricks.de .vu
the free resource for Visual Basic, Gambas and Pascal
components, tips & complete projects

www: http://www.VBTricks.de.vu
mail: vbtricks <at> gmx <dot> net
__________________________________________________ ___

Nov 21 '05 #3

P: n/a
I've never had any problems localizing forms -- the IDE does a nice
job.

here are the steps:
0) set the Localizable property of your form to True
1) ON PAPER: Design the form and translate the UI elements as needed
2) Add the controls to the form for the *default* culture
3) Save it
4) Set the Language property of the form to the appropriate culture
5) Add the localized content to the form
6) Repeat the last two steps as needed

***you will either need to change the culture on your machine before
each test OR you will need to explicitly set the culture before
instantiating the form
(System.Threading.Thread.CurrentThread.CurrentUICu lture = New
System.Globalization.CultureInfo("th-TH")

Nov 21 '05 #4

P: n/a
Hello,

thanks for the help. I now use a function that is called this way
TranslateMenu(mnuFile, 1).
So I have to call it for every menuitem, but it works. I definitely
prefer textfiles that can be easily translated (although I need someone
who speaks French, Spanish... anyway, no matter which solution I take ;-) )
As Mick said, all "controls" implement Tag. What I meant were MenuItems,
ColumnHeaders, which are no controls...
Thanks again,

Stefan
--
___________________________________www.VBTricks.de .vu
the free resource for Visual Basic, Gambas and Pascal
components, tips & complete projects

www: http://www.VBTricks.de.vu
mail: vbtricks <at> gmx <dot> net
__________________________________________________ ___
Nov 21 '05 #5

P: n/a
> As Mick said, all "controls" implement Tag. What I meant were MenuItems,
ColumnHeaders, which are no controls...


Actually, that was Cor :)

Glad you got a working solution.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
Nov 21 '05 #6

P: n/a
Oops,

sorry. Hope you help me in the future anyway...
Stefan

--
___________________________________www.VBTricks.de .vu
the free resource for Visual Basic, Gambas and Pascal
components, tips & complete projects

www: http://www.VBTricks.de.vu
mail: vbtricks <at> gmx <dot> net
__________________________________________________ ___
Nov 21 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.