Translating a Visual Studio project

余生颓废 提交于 2019-12-04 21:38:21

There is a build in way in .Net using resx files.

  • You can find the short introduction here.

  • More on Programmers stackexchange

  • MSDN is quite extensive with it's documentation about this topic and it is a good read. MSDN

There are a lot of Tools out there helping with the translation based on .Net localization but you can also do it in VS directly.

The .Net applications able to change translations on the fly usually use custom made internationalization e.g. loading text files and refreshing the GUI.

If you want to do something like that on your own be aware that you also have to resize controls so that the text fits.

For your problem wiht #count text text and text text #count you can use string.Format like.

  1. Add a resx file to your project like Localized.resx
  2. Add a string property "CountText" with value {0} text text.
  3. Add a second resx Localized.en.resx
  4. Add string property "CountText" with value text text {0}. to Localized.en.resx
  5. Where you write your progress to the GUI use string.Format(Localized.CountText, myCount);
  6. Switch the program language as shown in the first link.
  7. .Net automatically loads the corresponding resource for a language.

To learn about all the possibilities especially translating with VS you really should go through the MSDN library articles. Translation can get cumbersome if you miss something.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!