This article is a mirror article of machine translation, please click here to jump to the original article.

View: 3205|Reply: 0

[.NET Core] .NET Core program multilingual read and write resource (.resx) files

[Copy link]
Posted on 6/7/2023 10:44:08 PM | | | |
Requirements: When developing a desktop application, you may need to consider supporting multiple languages, when the user opens the program, it will judge the operating system locale, and load the corresponding language package resources.Use an external resource (.resx) file to update resource translation information, without recompiling the program without adding keywords.

  • ResXResourceWriter: Writes the resource to an XML resource (.resx) file or output stream.
  • ResXResourceReader: Enumerates XML resource (.resx) files and streams, and reads sequential resource names and value pairs.
  • ResXResourceSet: Enumerates its resources and retrieves individual resources by name.


The above objects are inSystem.Windows.Forms.dllIf you want to use it in .NET 6, you need to reference a third-party package (ResXResourceReader.NetStandard pulls ResXReourceWriter and ResXResourceReader from the Winforms github and packages them as . NetStandard), the command is as follows:

The test code is as follows:



generatedTestResources.resxThe file is actually a file in XML format, as follows:



Resources:

The hyperlink login is visible.
The hyperlink login is visible.

(End)





Previous:[Turn] (MSSQL) SQL Server database int and guid for primary key comparison
Next:[MSSQL] SQL SERVER ordered GUIDs and unordered GUIDs as primary key aggregation index tests
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com