Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to translate the property item name of the control in the properties window?

How to translate the property item name of the control in the properties window?

Scheduled Pinned Locked Moved C#
tutorialquestion
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mctramp168
    wrote on last edited by
    #1

    How to translate the property of the control in the properties window? For example,there is a Button on the winForm,then many properties is listed in the properties windows,such as Text、BackColor,now I want to translate the name of the property from english into other languange: for instance: English Chinese Text 文本 BackColor 背面颜色 Thanks all in advance!

    L 1 Reply Last reply
    0
    • M mctramp168

      How to translate the property of the control in the properties window? For example,there is a Button on the winForm,then many properties is listed in the properties windows,such as Text、BackColor,now I want to translate the name of the property from english into other languange: for instance: English Chinese Text 文本 BackColor 背面颜色 Thanks all in advance!

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Donwload the .NET languagepack[^] of your choice and install it. It doesn't only translate error-messages, but also properties, if I'm not mistaken. You cannot translate the texts by yourself, since there is no interface.

      M 1 Reply Last reply
      0
      • L Lost User

        Donwload the .NET languagepack[^] of your choice and install it. It doesn't only translate error-messages, but also properties, if I'm not mistaken. You cannot translate the texts by yourself, since there is no interface.

        M Offline
        M Offline
        mctramp168
        wrote on last edited by
        #3

        Thank Eddy for your answer. I remember my colleague I have achieved this funtion in his program,not handling by the system languagepack,He can change the Text property of the button with any name.

        L 1 Reply Last reply
        0
        • M mctramp168

          Thank Eddy for your answer. I remember my colleague I have achieved this funtion in his program,not handling by the system languagepack,He can change the Text property of the button with any name.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          The language-pack does it automatically, and the translations are embedded deep in the .NET runtime. It's a low-impact solution to your question, and I suggest you take a look at it before experimenting with sourcecode. BTW, my Visual Studio IDE @ work uses these Dutch language-packs, and it's bloody annoying to search for something simple like "ForeColor". Not only is the sort-order different (Voorgrondkleur), but it's in a category with a different name. It gets worse when you're facing a localized version of an error - and you need to search the English-based MSDN for the same error.. It doesn't increase the productivity, it just causes more bugs. Within the computer, everything should remain in a single language. That has nothing to do with the language that the end-user sees. It's just not possible to teach a computer all the localized versions of a boolean.

          mctramp168 wrote:

          I remember my colleague I have achieved this funtion in his program,not handling by the system languagepack,He can change the Text property of the button with any name.

          Phone your collegue, ask how he did it :) You could also redefine the property-names, as shown in the example below;

              /// <summary>
              /// This is the original property. We want to 'rename' these in code as well as
              /// in the property-editor. First, we'll hide the current property as much
              /// as reasonable:
              /// </summary>
              \[Browsable(false)\]
              public override System.Drawing.Color ForeColor
              {
                  get
                  {
                      return base.ForeColor;
                  }
                  set
                  {
                      base.ForeColor = value;
                  }
              }
          
              /// <summary>
              /// This is our 'translated' version of the "ForeColor". It gets dumped in the same
              /// category as before, but you could also translate that string. 
              /// 
              /// If you do, a new category will be created automatically, and the property will
              /// be visible under that new category-name.
              /// </summary>
              \[Browsable(true), Category("Appearance")\]
              public System.Drawing.Color VeurgrondKleur
              {
                  get
                  {
                      return this.ForeColor;
                  }
                  set
                  {
                      this.ForeColor = value;
                  }
              }
          

          This will hide the "ForeColor" from the property-editor in Vi

          M 1 Reply Last reply
          0
          • L Lost User

            The language-pack does it automatically, and the translations are embedded deep in the .NET runtime. It's a low-impact solution to your question, and I suggest you take a look at it before experimenting with sourcecode. BTW, my Visual Studio IDE @ work uses these Dutch language-packs, and it's bloody annoying to search for something simple like "ForeColor". Not only is the sort-order different (Voorgrondkleur), but it's in a category with a different name. It gets worse when you're facing a localized version of an error - and you need to search the English-based MSDN for the same error.. It doesn't increase the productivity, it just causes more bugs. Within the computer, everything should remain in a single language. That has nothing to do with the language that the end-user sees. It's just not possible to teach a computer all the localized versions of a boolean.

            mctramp168 wrote:

            I remember my colleague I have achieved this funtion in his program,not handling by the system languagepack,He can change the Text property of the button with any name.

            Phone your collegue, ask how he did it :) You could also redefine the property-names, as shown in the example below;

                /// <summary>
                /// This is the original property. We want to 'rename' these in code as well as
                /// in the property-editor. First, we'll hide the current property as much
                /// as reasonable:
                /// </summary>
                \[Browsable(false)\]
                public override System.Drawing.Color ForeColor
                {
                    get
                    {
                        return base.ForeColor;
                    }
                    set
                    {
                        base.ForeColor = value;
                    }
                }
            
                /// <summary>
                /// This is our 'translated' version of the "ForeColor". It gets dumped in the same
                /// category as before, but you could also translate that string. 
                /// 
                /// If you do, a new category will be created automatically, and the property will
                /// be visible under that new category-name.
                /// </summary>
                \[Browsable(true), Category("Appearance")\]
                public System.Drawing.Color VeurgrondKleur
                {
                    get
                    {
                        return this.ForeColor;
                    }
                    set
                    {
                        this.ForeColor = value;
                    }
                }
            

            This will hide the "ForeColor" from the property-editor in Vi

            M Offline
            M Offline
            mctramp168
            wrote on last edited by
            #5

            Thank Eddy for your zealous help. I know your above handleing method,if each property is handled like that, It needs a lot of time, I saw a set software, it can let non-programmer user to design a winform after you teach them simply, the winform's property is translated by the programmer, then the non-programmer can very easy to learn to design simple winform. I only want to know this skill of translating the property of the control. I try to ask my past colleague. Thanks !

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups