Translate my application

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • VBTricks.de.vu Webmaster

    #1

    Translate my application

    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.VBTric ks.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
    _______________ _______________ _______________ ________
  • Cor Ligthert [MVP]

    #2
    Re: Translate my application

    Hi,

    I saw that there was a link including VBNet code how to add a tag property
    to a menu Item on msdn.


    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


    Comment

    • Mick Doherty

      #3
      Re: Translate my application

      Don't know anything about sharpdevelop so can't advise there on
      localisation.

      I would assume that IExtenderProvid ers 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 InitializeCompo nent() code).

      You'll find the source on my site at:


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

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

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

      --
      Mick Doherty
      Dotnetrix offers Nothing. Standard and Premium versions available.



      "VBTricks.d e.vu Webmaster" <nospam@thisser verdoesntexist. com> wrote in
      message news:eZlmFh3jFH A.3300@TK2MSFTN GP15.phx.gbl...[color=blue]
      > 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.VBTric ks.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
      > _______________ _______________ _______________ ________[/color]


      Comment

      • stand__sure

        #4
        Re: Translate my application

        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.Threadi ng.Thread.Curre ntThread.Curren tUICulture = New
        System.Globaliz ation.CultureIn fo("th-TH")

        Comment

        • VBTricks.de.vu Webmaster

          #5
          Re: Translate my application

          Hello,

          thanks for the help. I now use a function that is called this way
          TranslateMenu(m nuFile, 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.VBTric ks.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
          _______________ _______________ _______________ ________

          Comment

          • Mick Doherty

            #6
            Re: Translate my application

            > As Mick said, all "controls" implement Tag. What I meant were MenuItems,[color=blue]
            > ColumnHeaders, which are no controls...
            >[/color]

            Actually, that was Cor :)

            Glad you got a working solution.

            --
            Mick Doherty
            Dotnetrix offers Nothing. Standard and Premium versions available.



            Comment

            • VBTricks.de.vu Webmaster

              #7
              Re: Translate my application

              Oops,

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


              Stefan

              --
              _______________ _______________ _____www.VBTric ks.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
              _______________ _______________ _______________ ________

              Comment

              Working...