改用单例模式,避免多次初始化。

This commit is contained in:
Slnanx 2024-11-17 09:50:15 +00:00
parent c95b87624e
commit 9087838427
2 changed files with 3 additions and 9 deletions

View file

@ -9,7 +9,7 @@ public class Localization
{
private Dictionary<string, string> translations;
public Localization()
private Localization()
{
// 获取当前系统的完整文化名称 例zh-CN en-US
string currentLanguage = CultureInfo.CurrentCulture.Name;

View file

@ -1,16 +1,10 @@
/**
* 使JSON文件对C#
* 使JSON文件对C#
*
* 使
*
* :
* - System.Collections.Generic
* - System.Globalization
* - System.IO
* - System.Text.Json
*
* :
* - JSON文件en.jsonzh.json
* - JSON文件en-US.jsonzh-CN.json
* - JSON文件放置程序同目录中
* -
* - localization.Translate("Try_Terminate_Process") //返回一个 string 字符串