none
"GetLocalizedString" only called once when I want to change current UI cultureInfo. RRS feed

  • Question

  • Hi

    Recently, I tried to apply multiLanguage for my WinForm project. A designSuface was add to a Form that supporting the basic opration such as coppy, cut, move and so on. Now  I want to change the language of the  propetyGrid items that according to a form or a control. So far, the propety in the propertyGrid of a form can change successfuly, but properties' category can not change.   The test project has been upload to GitHub:  

    https://github.com/gentleman-ming/GUIDesigner

    Some one can download it and try to test it. Maybe can help me resolve this problem.

    Thanks

    Ming ( Email: mingisworking@hotmail.com )


    Tuesday, September 24, 2019 3:59 AM

All replies

  • Hi,

    If you can't change the language of "category" to English, you may try to create a new PropertyGrid in English version.

    Regards,

    Kyle


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, September 24, 2019 8:13 AM
    Moderator
  • Hi

    Actually, propertyGrid showing properties of a form. The property category is designed in a form class. I want customize a class of  CategoryAtrribute,as following showing, that this class can achieve UI propertyGrid language changing. This class can change the property item language when set language when run a project, the propertyGrid language will showing as  UI language setting. But, alftering the project created, this class will not called again  when UI language changing .

    public class LocalizedCategoryAttribute : CategoryAttribute
    {
         public LocalizedCategoryAttribute(string res ourceKey):base(resourceKey)
         {
      
         }
            protected override string GetLocalizedString(string key)
            {
                 string value = MainFormLanguageResource.ResourceManager.GetString(key,Thread.CurrentThread.CurrentUICulture);
                return value;
    
            }
     }

    Regards,

    Ming



    Tuesday, September 24, 2019 9:46 AM