mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 12:45:00 +00:00
feature<*>: add translation for Simplified Chinese
This commit is contained in:
parent
2054df31b9
commit
5418ccac9e
70 changed files with 1492 additions and 554 deletions
|
@ -30,6 +30,25 @@ namespace SourceGit {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load text from locales.
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
public static string Text(string key) {
|
||||
return Current.FindResource("Text." + key) as string;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Format text
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="args"></param>
|
||||
/// <returns></returns>
|
||||
public static string Format(string key, params object[] args) {
|
||||
return string.Format(Text(key), args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raise error message.
|
||||
/// </summary>
|
||||
|
@ -109,6 +128,16 @@ namespace SourceGit {
|
|||
}
|
||||
}
|
||||
|
||||
// Apply locales
|
||||
if (Setting.UI.Locale != "en_US") {
|
||||
foreach (var rs in Current.Resources.MergedDictionaries) {
|
||||
if (rs.Source != null && rs.Source.OriginalString.StartsWith("pack://application:,,,/Resources/Locales/")) {
|
||||
rs.Source = new Uri($"pack://application:,,,/Resources/Locales/{Setting.UI.Locale}.xaml", UriKind.Absolute);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Show main window
|
||||
MainWindow = new UI.Launcher();
|
||||
MainWindow.Show();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue