-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try to translate a native dictionary
- Loading branch information
Showing
3 changed files
with
55 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 29 additions & 5 deletions
34
src/Leo.Wpf.App/Infrastructure/Constants/Constants.Genders.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,37 @@ | ||
namespace Leo.Wpf.App.Infrastructure | ||
using System.Globalization; | ||
|
||
namespace Leo.Wpf.App.Infrastructure | ||
{ | ||
public partial class Constants | ||
{ | ||
public static Dictionary<string, string> Genders = new() | ||
{ | ||
// i18n | ||
{"Unkonw", "未知" }, | ||
{"Male", "男" }, | ||
{"Female", "女" }, | ||
{"Unkonw", GetString("Unkonw") }, | ||
{"Male", GetString("Male") }, | ||
{"Female", GetString("Female") }, | ||
}; | ||
|
||
// TODO i18n | ||
private static string GetString(string key) | ||
{ | ||
var enUS = new Dictionary<string, string>() | ||
{ | ||
{"Unkonw", "Unkonw" }, | ||
{"Male", "Male" }, | ||
{"Female", "Female" }, | ||
}; | ||
var zhCN = new Dictionary<string, string>() | ||
{ | ||
{"Unkonw", "未知" }, | ||
{"Male", "男" }, | ||
{"Female", "女" }, | ||
}; | ||
|
||
if (CultureInfo.CurrentUICulture.Name.Contains("zh")) | ||
{ | ||
return zhCN[key]; | ||
} | ||
return enUS[key]; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters