C#: How to bind the text of a winforms button to a resource

后端 未结 6 1795
刺人心
刺人心 2021-01-02 21:32

We have a resource file with lots of translated strings used various places in our application. Is there a better way for binding for example the text of a button to a certa

6条回答
  •  醉话见心
    2021-01-02 22:29

    Your way is the best way to do this if you have developers who are not personally fluent in the languages you're translating your application into. I've done this before with an English application that had to be translated into Spanish, Portuguese and Chinese (I only speak one of these semi-fluently). The original forms were all created in English, and in the form's Load event the code iterated through every control and searched for each control's Text property in a translations spreadsheet, and replaced it with the appropriate translation.

    The built-in way of internationalizing a form (which is basically a variant of form inheritance) assumes that the programmer is fluent in the language you need to translate to, which is pretty much of a stretch, and it requires you to manually enter all the translated text values for each form and each language. It also makes your binary larger (potentially much larger), since it adds a .resx file for each form for each language that you support.

提交回复
热议问题