Best way to localize UserControl in C # (winforms)

Make me lack of knowledge, I edited this question

I create UserControlwith DataGridViewin it, and I want to simplify the implementation process as much as possible, so I wonder if I should do this using localization? So far, as far as I know, research , my approach to localization is as follows:

For example, I have one button on mine form/UserControlwith the text property set to "hi", now I want to localize my own form/UserControlfor the Italian language.

  • Set the localizable property to true and select the language (in this case, Italian)
  • Google translate
  • Set the text property to "Ciao"

English is by default, so I already have a file .resxin my form, but after that VS will generate resources for Italian with button.Textas key and β€œciao” as value if I understand correctly, but what happens if someone comes and changes property button.Textfrom hello to "hello world", then my Italian resources will not be correct if they are not manually changed, is there any way to do this automatically?

I’m interested because when my UserControlc is DataGridViewimplemented on some form, I can’t say which columns I will have DataGridView, so I wonder if I should leave the localization process to the person who exercises my control?

Thanks, I really appreciate the help and sorry for the editing.

+4
2

() ( ).
/ , .
resx / , , , ( /), (Infralution Globalizer)

, ,

(, YourResourceFile.resx)

public MyUserControl()
{
        columnFirstName.Header = YourResourceFile.FirstName;
        columnLastName.Header = YourResourceFile.LastName;
}

, :

, 1, , , , ,

Update:
, VS ResXManager ().

+3

Localizable UserControl true.

, UserControl, , :

[Localizable(true)]
public string MyTranslatableLabel
{
    get;set;
}
enter code here

, , Designer.cs , UserControl, :

this.myUserControl.MyTranslatableLabel = "Initial label of user control";

MS VisualStudio 2017 Community

0

Source: https://habr.com/ru/post/1690988/


All Articles