Translate my application

  • Thread starter VBTricks.de.vu Webmaster
  • Start date
V

VBTricks.de.vu Webmaster

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
_____________________________________________________
 
M

Mick Doherty

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
///
 
S

stand__sure

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.CurrentUICulture = New
System.Globalization.CultureInfo("th-TH")
 
V

VBTricks.de.vu Webmaster

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
_____________________________________________________
 
M

Mick Doherty

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.
 
V

VBTricks.de.vu Webmaster

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
_____________________________________________________
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top