mirror of
https://github.com/SabreTools/MPF.git
synced 2026-02-04 05:35:52 +00:00
Continue UI translation work (#900)
* No redundant translation * semicolon * rename DefaultUILanguage * finish rename * Cleanup * Fix SetInterfaceLanguage * Fix LanguageMenuItemClick * Set resources before window loads * set lang during init * Update interface language after setting options * Check language menuitem when updating options * Clear checks when loading language from options * SetInterfaceLanguage clears checks * obj as MenuItem * safer unchecking * type naming * uncheck menuitem * var * don't uncheck within setlanguage * test * equals * top left menu margin * help menu right margin * Fix title bar * Margin on help menu item * margin on stack panel * more translations * Translate message boxes * fix margin * only change lang if options was saved * only update language if it has been updated * smaller negative margin * padding * padding on textblock * Revert GHA changes
This commit is contained in:
@@ -143,18 +143,18 @@ namespace MPF.Frontend
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Default UI language to launch MPF into
|
||||
/// Default interface language to launch MPF into
|
||||
/// </summary>
|
||||
public InterfaceLanguage DefaultUILanguage
|
||||
public InterfaceLanguage DefaultInterfaceLanguage
|
||||
{
|
||||
get
|
||||
{
|
||||
var valueString = GetStringSetting(Settings, "DefaultUILanguage", InterfaceLanguage.AutoDetect.ShortName());
|
||||
var valueString = GetStringSetting(Settings, "DefaultInterfaceLanguage", InterfaceLanguage.AutoDetect.ShortName());
|
||||
return valueString.ToInterfaceLanguage();
|
||||
}
|
||||
set
|
||||
{
|
||||
Settings["DefaultUILanguage"] = value.ShortName();
|
||||
Settings["DefaultInterfaceLanguage"] = value.ShortName();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,9 +52,9 @@ namespace MPF.Frontend.ViewModels
|
||||
public static List<Element<InternalProgram>> InternalPrograms => PopulateInternalPrograms();
|
||||
|
||||
/// <summary>
|
||||
/// List of available UI languages
|
||||
/// List of available interface languages
|
||||
/// </summary>
|
||||
public static List<Element<InterfaceLanguage>> UILanguages => Element<InterfaceLanguage>.GenerateElements();
|
||||
public static List<Element<InterfaceLanguage>> InterfaceLanguages => Element<InterfaceLanguage>.GenerateElements();
|
||||
|
||||
/// <summary>
|
||||
/// List of available log compression methods
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Markup;
|
||||
@@ -310,9 +309,6 @@ namespace MPF.UI
|
||||
InitializeComponent();
|
||||
#endif
|
||||
|
||||
// Assign resource dictionaries
|
||||
SetUILanguage();
|
||||
|
||||
// Create control templates
|
||||
CreateControlTemplate("ComboBoxTemplate");
|
||||
CreateControlTemplate("ComboBoxEditableTemplate");
|
||||
@@ -363,60 +359,6 @@ namespace MPF.UI
|
||||
Resources[resourceName] = controlTemplate;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a strings resource dictionary for use as the UI language
|
||||
/// </summary>
|
||||
private void SetUILanguage()
|
||||
{
|
||||
// Add English strings to merged dictionary as default, add translations later
|
||||
var baselineDictionary = new ResourceDictionary();
|
||||
baselineDictionary.Source = new Uri("Resources/Strings.xaml", UriKind.Relative);
|
||||
Resources.MergedDictionaries.Add(baselineDictionary);
|
||||
|
||||
// Get current region code
|
||||
string region = "";
|
||||
try
|
||||
{
|
||||
// Can throw exception depending on current locale
|
||||
region = new RegionInfo(CultureInfo.CurrentUICulture.Name).TwoLetterISORegionName;
|
||||
}
|
||||
catch { }
|
||||
|
||||
// Select startup language based on current system locale
|
||||
var translatedDictionary = new ResourceDictionary();
|
||||
switch (CultureInfo.CurrentUICulture.TwoLetterISOLanguageName)
|
||||
{
|
||||
case "en":
|
||||
// English already loaded, don't add any translated text
|
||||
break;
|
||||
|
||||
case "ko":
|
||||
// Translate UI elements to Korean
|
||||
translatedDictionary.Source = new Uri("Resources/Strings.ko.xaml", UriKind.Relative);
|
||||
break;
|
||||
|
||||
case "zh":
|
||||
// Check if region uses Traditional or Simplified Chinese
|
||||
string[] traditionalRegions = { "TW", "HK", "MO" };
|
||||
if (Array.Exists(traditionalRegions, r => r.Equals(region, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
// TODO: Translate UI elements to Traditional Chinese
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: Translate UI elements to Simplified Chinese
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Unsupported language, don't add any translated text
|
||||
break;
|
||||
}
|
||||
|
||||
// Add the strings resource to app resources
|
||||
Resources.MergedDictionaries.Add(translatedDictionary);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a named style and add it to the current set of resources
|
||||
/// </summary>
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
<system:String x:Key="StatusGroupBoxString">상태</system:String>
|
||||
<system:String x:Key="WarningLabelString">경고:</system:String>
|
||||
|
||||
<!-- Main Window
|
||||
<system:String x:Key="AppTitleString">미디어 프리저베이션 프런트엔드</system:String> -->
|
||||
<!-- Main Window -->
|
||||
<!-- <system:String x:Key="AppTitleString">미디어 프리저베이션 프런트엔드</system:String> -->
|
||||
<!-- Top Menu Bar -->
|
||||
<system:String x:Key="FileMenuString">파일</system:String>
|
||||
<system:String x:Key="ExitMenuItemString">종료</system:String>
|
||||
@@ -72,8 +72,8 @@
|
||||
<system:String x:Key="DiscIDExpanderString">PS3 디스크 ID 수동 설정</system:String>
|
||||
<system:String x:Key="DiscIDLabelString">디스크 ID</system:String>
|
||||
<system:String x:Key="DiscIDStatusLabelString">디스크 ID 상태</system:String>
|
||||
<system:String x:Key="LayerbreakLabelString">Layerbreak (sectors)</system:String>
|
||||
<system:String x:Key="PICExpanderString">Permanent Information & Control (PIC) 수동 설정</system:String>
|
||||
<system:String x:Key="LayerbreakLabelString">Layerbreak (sectors)</system:String>
|
||||
<system:String x:Key="PICLabelString">PIC</system:String>
|
||||
<system:String x:Key="PICFilePathLabelString">PIC 파일 경로</system:String>
|
||||
<system:String x:Key="PICStatusLabelString">PIC 상태</system:String>
|
||||
@@ -81,12 +81,31 @@
|
||||
|
||||
<!-- Media Information Guide Window -->
|
||||
<system:String x:Key="MediaInformationTitleString">미디어 정보</system:String>
|
||||
<system:String x:Key="RingCodeGuideButtonString">링 코드 가이드</system:String>
|
||||
<!-- Common Info Tab -->
|
||||
<system:String x:Key="CommonInfoTabString">일반 정보</system:String>
|
||||
<system:String x:Key="CommonMediaInfoGroupBoxString">일반 미디어 정보</system:String>
|
||||
<system:String x:Key="CategoryLabelString">카테고리</system:String>
|
||||
<system:String x:Key="RegionLabelString">지역</system:String>
|
||||
<system:String x:Key="LanguagesLabelString">언어 (언어)</system:String>
|
||||
<system:String x:Key="LanguagesLabelString">언어 (문자)</system:String>
|
||||
<system:String x:Key="LanguageSelectionViaLabelString">언어 선택 방식</system:String>
|
||||
<system:String x:Key="VersionsAndEditionGroupBoxString">버전 및 에디션</system:String>
|
||||
<!-- Additional Info Tab -->
|
||||
<system:String x:Key="AdditionalInfoTabString">추가 정보</system:String>
|
||||
<system:String x:Key="ExtrasGroupBoxString">추가</system:String>
|
||||
<system:String x:Key="PCMacHybridLabelString">PC/Mac 하이브리드</system:String>
|
||||
<system:String x:Key="RingCodeGuideButtonString">링 코드 가이드</system:String>
|
||||
<system:String x:Key="PhysicalIdentifiersGroupBoxString">물리적 식별자</system:String>
|
||||
<system:String x:Key="PublisherIdentifiersGroupBoxString">게시자 식별자</system:String>
|
||||
<!-- Contents Tab -->
|
||||
<system:String x:Key="ContentsTabString">내용물</system:String>
|
||||
<!-- Ringcodes Tab -->
|
||||
<system:String x:Key="RingcodesTabString">링 코드</system:String>
|
||||
<system:String x:Key="L0InfoGroupBoxString">데이터/L0 정보</system:String>
|
||||
<system:String x:Key="L1InfoGroupBoxString">라벨/L1 정보</system:String>
|
||||
<system:String x:Key="L2InfoGroupBoxString">L2 정보</system:String>
|
||||
<system:String x:Key="L3InfoGroupBoxString">L3 정보</system:String>
|
||||
<!-- Read-Only Info Tab -->
|
||||
<system:String x:Key="ReadOnlyInfoTabString">읽기 전용 정보</system:String>
|
||||
|
||||
<!-- Ring Code Guide Window -->
|
||||
<system:String x:Key="RingCodeGuideTitleString">링 코드 가이드</system:String>
|
||||
@@ -103,4 +122,19 @@
|
||||
<!-- Check for Updates Window -->
|
||||
<system:String x:Key="CheckForUpdatesTitleString">버전 업데이트 확인</system:String>
|
||||
|
||||
<!-- Eject Window -->
|
||||
<system:String x:Key="EjectTitleString">꺼내다</system:String>
|
||||
<system:String x:Key="EjectMessageString">이제 디스크를 꺼내셔도 됩니다</system:String>
|
||||
|
||||
<!-- Ask Before Quit Window -->
|
||||
<system:String x:Key="QuitTitleString">종료</system:String>
|
||||
<system:String x:Key="QuitMessageString">덤프가 아직 처리 중입니다. 종료하시겠습니까?</system:String>
|
||||
|
||||
<!-- Protection Error Window -->
|
||||
<system:String x:Key="ProtectionErrorTitleString">오류!</system:String>
|
||||
<system:String x:Key="ProtectionErrorMessageString">예외가 발생했습니다. 자세한 내용은 로그를 참조하세요</system:String>
|
||||
|
||||
<!-- Protection Detected Window -->
|
||||
<system:String x:Key="ProtectionDetectedTitleString">감지된 보호</system:String>
|
||||
|
||||
</ResourceDictionary>
|
||||
|
||||
@@ -81,12 +81,31 @@
|
||||
|
||||
<!-- Media Information Guide Window -->
|
||||
<system:String x:Key="MediaInformationTitleString">Media Information</system:String>
|
||||
<system:String x:Key="RingCodeGuideButtonString">Ring Code Guide</system:String>
|
||||
<!-- Common Info Tab -->
|
||||
<system:String x:Key="CommonInfoTabString">Common Info</system:String>
|
||||
<system:String x:Key="CommonMediaInfoGroupBoxString">Common Media Information</system:String>
|
||||
<system:String x:Key="CategoryLabelString">Category</system:String>
|
||||
<system:String x:Key="RegionLabelString">Region</system:String>
|
||||
<system:String x:Key="LanguagesLabelString">Languages</system:String>
|
||||
<system:String x:Key="LanguageSelectionViaLabelString">Language Selection Via</system:String>
|
||||
<system:String x:Key="VersionsAndEditionGroupBoxString">Version and Editions</system:String>
|
||||
<!-- Additional Info Tab -->
|
||||
<system:String x:Key="AdditionalInfoTabString">Additional Info</system:String>
|
||||
<system:String x:Key="ExtrasGroupBoxString">Extras</system:String>
|
||||
<system:String x:Key="PCMacHybridLabelString">PC/Mac Hybrid</system:String>
|
||||
<system:String x:Key="RingCodeGuideButtonString">Ring Code Guide</system:String>
|
||||
<system:String x:Key="PhysicalIdentifiersGroupBoxString">Physical Identifiers</system:String>
|
||||
<system:String x:Key="PublisherIdentifiersGroupBoxString">Publisher Identifiers</system:String>
|
||||
<!-- Contents Tab -->
|
||||
<system:String x:Key="ContentsTabString">Contents</system:String>
|
||||
<!-- Ringcodes Tab -->
|
||||
<system:String x:Key="RingcodesTabString">Ringcodes</system:String>
|
||||
<system:String x:Key="L0InfoGroupBoxString">Data/L0 Info</system:String>
|
||||
<system:String x:Key="L1InfoGroupBoxString">Label/L1 Info</system:String>
|
||||
<system:String x:Key="L2InfoGroupBoxString">L2 Info</system:String>
|
||||
<system:String x:Key="L3InfoGroupBoxString">L3 Info</system:String>
|
||||
<!-- Read-Only Info Tab -->
|
||||
<system:String x:Key="ReadOnlyInfoTabString">Read-Only Info</system:String>
|
||||
|
||||
<!-- Ring Code Guide Window -->
|
||||
<system:String x:Key="RingCodeGuideTitleString">Ring Code Guide</system:String>
|
||||
@@ -103,4 +122,19 @@
|
||||
<!-- Check for Updates Window -->
|
||||
<system:String x:Key="CheckForUpdatesTitleString">Version Update Check</system:String>
|
||||
|
||||
<!-- Eject Window -->
|
||||
<system:String x:Key="EjectTitleString">Eject</system:String>
|
||||
<system:String x:Key="EjectMessageString">It is now safe to eject the disc</system:String>
|
||||
|
||||
<!-- Ask Before Quit Window -->
|
||||
<system:String x:Key="QuitTitleString">Quit</system:String>
|
||||
<system:String x:Key="QuitMessageString">A dump is still being processed, are you sure you want to quit?</system:String>
|
||||
|
||||
<!-- Protection Error Window -->
|
||||
<system:String x:Key="ProtectionErrorTitleString">Error!</system:String>
|
||||
<system:String x:Key="ProtectionErrorMessageString">An exception occurred, see the log for details</system:String>
|
||||
|
||||
<!-- Protection Detected Window -->
|
||||
<system:String x:Key="ProtectionDetectedTitleString">Detected Protection(s)</system:String>
|
||||
|
||||
</ResourceDictionary>
|
||||
|
||||
@@ -33,7 +33,8 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Image Grid.Column="0" Source="/Images/Icon.ico" Height="20" Width="20" Margin="1" MouseDown="TitleMouseDown" />
|
||||
<StackPanel Panel.ZIndex="1" Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}">
|
||||
<StackPanel Panel.ZIndex="1" Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center" Margin="0,0,-5,0"
|
||||
Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}">
|
||||
<Menu x:Name="TopLeftMenuBar" Width="Auto" Height="20"
|
||||
Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"
|
||||
Foreground="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}">
|
||||
@@ -87,7 +88,7 @@
|
||||
</StackPanel>
|
||||
<Label Panel.ZIndex="0" Grid.Column="1" Grid.ColumnSpan="5" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" MouseDown="TitleMouseDown">
|
||||
<Label.Content>
|
||||
<TextBlock TextAlignment="Center"><Run FontWeight="Bold" Text="{DynamicResource AppTitleString}" /></TextBlock>
|
||||
<TextBlock TextAlignment="Center" Padding="0,0,20,0"><Run FontWeight="Bold" Text="{DynamicResource AppTitleString}" /></TextBlock>
|
||||
</Label.Content>
|
||||
<Label.ContextMenu>
|
||||
<ContextMenu Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
#if NET40
|
||||
using System.Threading.Tasks;
|
||||
@@ -95,17 +96,8 @@ namespace MPF.UI.Windows
|
||||
System.Windows.Shell.WindowChrome.SetWindowChrome(this, chrome);
|
||||
#endif
|
||||
|
||||
// Set default language
|
||||
var dictionary = new ResourceDictionary();
|
||||
dictionary.Source = MainViewModel.Options.DefaultUILanguage switch
|
||||
{
|
||||
InterfaceLanguage.English => new Uri("../Resources/Strings.xaml", UriKind.Relative),
|
||||
InterfaceLanguage.Korean => new Uri("../Resources/Strings.ko.xaml", UriKind.Relative),
|
||||
|
||||
// Default to English
|
||||
_ => new Uri("../Resources/Strings.xaml", UriKind.Relative),
|
||||
};
|
||||
Application.Current.Resources.MergedDictionaries.Add(dictionary);
|
||||
// Set all resources before window loads (Must set English here)
|
||||
SetInterfaceLanguage(InterfaceLanguage.English);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -136,6 +128,9 @@ namespace MPF.UI.Windows
|
||||
translationStrings["StopDumpingButtonString"] = (string)Application.Current.FindResource("StopDumpingButtonString");
|
||||
MainViewModel.TranslateStrings(translationStrings);
|
||||
|
||||
// Set interface language according to the options
|
||||
SetInterfaceLanguage(MainViewModel.Options.DefaultInterfaceLanguage);
|
||||
|
||||
// Set the UI color scheme according to the options
|
||||
ApplyTheme();
|
||||
|
||||
@@ -154,6 +149,93 @@ namespace MPF.UI.Windows
|
||||
}
|
||||
}
|
||||
|
||||
#region Interface Language
|
||||
|
||||
/// <summary>
|
||||
/// Set the current interface language to a provided InterfaceLanguage
|
||||
/// </summary>
|
||||
private void SetInterfaceLanguage(InterfaceLanguage lang)
|
||||
{
|
||||
// Auto detect language
|
||||
if (lang == InterfaceLanguage.AutoDetect)
|
||||
{
|
||||
AutoSetInterfaceLanguage();
|
||||
return;
|
||||
}
|
||||
|
||||
// Set baseline language (English), required as some translations may not translate all strings
|
||||
if (lang != InterfaceLanguage.English)
|
||||
{
|
||||
var baselineDictionary = new ResourceDictionary();
|
||||
baselineDictionary.Source = new Uri("../Resources/Strings.xaml", UriKind.Relative);
|
||||
Application.Current.Resources.MergedDictionaries.Add(baselineDictionary);
|
||||
}
|
||||
|
||||
var dictionary = new ResourceDictionary();
|
||||
dictionary.Source = lang switch
|
||||
{
|
||||
InterfaceLanguage.English => new Uri("../Resources/Strings.xaml", UriKind.Relative),
|
||||
InterfaceLanguage.Korean => new Uri("../Resources/Strings.ko.xaml", UriKind.Relative),
|
||||
_ => new Uri("../Resources/Strings.xaml", UriKind.Relative),
|
||||
};
|
||||
Application.Current.Resources.MergedDictionaries.Add(dictionary);
|
||||
|
||||
// Update the labels in MainViewModel
|
||||
var translationStrings = new Dictionary<string, string>();
|
||||
translationStrings["StartDumpingButtonString"] = (string)Application.Current.FindResource("StartDumpingButtonString");
|
||||
translationStrings["StopDumpingButtonString"] = (string)Application.Current.FindResource("StopDumpingButtonString");
|
||||
translationStrings["NoSystemSelectedString"] = (string)Application.Current.FindResource("NoSystemSelectedString");
|
||||
MainViewModel.TranslateStrings(translationStrings);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the interface language based on system locale
|
||||
/// Should only run at app startup, use SetInterfaceLanguage(lang) elsewhere
|
||||
/// </summary>
|
||||
public void AutoSetInterfaceLanguage()
|
||||
{
|
||||
// Get current region code to distinguish regional variants of languages
|
||||
string region = "";
|
||||
try
|
||||
{
|
||||
// Can throw exception depending on current locale
|
||||
region = new RegionInfo(CultureInfo.CurrentUICulture.Name).TwoLetterISORegionName;
|
||||
}
|
||||
catch { }
|
||||
|
||||
switch (CultureInfo.CurrentUICulture.TwoLetterISOLanguageName)
|
||||
{
|
||||
case "en":
|
||||
// Translate UI elements to English
|
||||
SetInterfaceLanguage(InterfaceLanguage.English);
|
||||
break;
|
||||
|
||||
case "ko":
|
||||
// Translate UI elements to Korean
|
||||
SetInterfaceLanguage(InterfaceLanguage.Korean);
|
||||
break;
|
||||
|
||||
case "zh":
|
||||
// Check if region uses Traditional or Simplified Chinese
|
||||
string[] traditionalRegions = { "TW", "HK", "MO" };
|
||||
if (Array.Exists(traditionalRegions, r => r.Equals(region, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
// TODO: Translate UI elements to Traditional Chinese
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: Translate UI elements to Simplified Chinese
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Unsupported language, don't add any translated text
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region UI Functionality
|
||||
|
||||
/// <summary>
|
||||
@@ -256,7 +338,8 @@ namespace MPF.UI.Windows
|
||||
{
|
||||
if (MainViewModel.AskBeforeQuit)
|
||||
{
|
||||
MessageBoxResult result = CustomMessageBox.Show(this, "A dump is still being processed, are you sure you want to quit?", "Quit", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);
|
||||
MessageBoxResult result = CustomMessageBox.Show(this, (string)Application.Current.FindResource("QuitMessageString"),
|
||||
(string)Application.Current.FindResource("QuitTitleString"), MessageBoxButton.YesNo, MessageBoxImage.Exclamation);
|
||||
if (result == MessageBoxResult.No)
|
||||
e.Cancel = true;
|
||||
}
|
||||
@@ -281,7 +364,8 @@ namespace MPF.UI.Windows
|
||||
public bool? ShowMediaInformationWindow(Options? options, ref SubmissionInfo? submissionInfo)
|
||||
{
|
||||
if (options?.ShowDiscEjectReminder == true)
|
||||
CustomMessageBox.Show(this, "It is now safe to eject the disc", "Eject", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
CustomMessageBox.Show(this, (string)Application.Current.FindResource("EjectMessageString"),
|
||||
(string)Application.Current.FindResource("EjectTitleString"), MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
|
||||
var mediaInformationWindow = new MediaInformationWindow(options ?? new Options(), submissionInfo)
|
||||
{
|
||||
@@ -513,6 +597,25 @@ namespace MPF.UI.Windows
|
||||
if (MainViewModel.Options.DefaultOutputPath != options.DefaultOutputPath)
|
||||
MainViewModel.OutputPath = string.Empty;
|
||||
|
||||
// Set the language according to the settings
|
||||
if (savedSettings)
|
||||
{
|
||||
var oldDefaultLang = MainViewModel.Options.DefaultInterfaceLanguage;
|
||||
var newDefaultLang = options.DefaultInterfaceLanguage;
|
||||
if (oldDefaultLang != newDefaultLang)
|
||||
{
|
||||
SetInterfaceLanguage(newDefaultLang);
|
||||
|
||||
// Uncheck all language menu items
|
||||
foreach (var item in LanguagesMenuItem.Items)
|
||||
{
|
||||
var menuItem = item as MenuItem;
|
||||
if (menuItem != null && menuItem.IsCheckable)
|
||||
menuItem.IsChecked = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update and save options, if necessary
|
||||
MainViewModel.UpdateOptions(savedSettings, options);
|
||||
|
||||
@@ -593,24 +696,17 @@ namespace MPF.UI.Windows
|
||||
|
||||
// Change UI language to selected item
|
||||
string lang = clickedItem.Header.ToString() ?? "";
|
||||
var dictionary = new ResourceDictionary();
|
||||
dictionary.Source = lang switch
|
||||
{
|
||||
"ENG" => new Uri("../Resources/Strings.xaml", UriKind.Relative),
|
||||
"한국어" => new Uri("../Resources/Strings.ko.xaml", UriKind.Relative),
|
||||
_ => new Uri("../Resources/Strings.xaml", UriKind.Relative),
|
||||
};
|
||||
Application.Current.Resources.MergedDictionaries.Add(dictionary);
|
||||
SetInterfaceLanguage(
|
||||
lang : lang switch
|
||||
{
|
||||
"ENG" => InterfaceLanguage.English,
|
||||
"한국어" => InterfaceLanguage.Korean,
|
||||
_ => InterfaceLanguage.English,
|
||||
}
|
||||
);
|
||||
|
||||
// Update the labels that don't get updated automatically
|
||||
SetMediaTypeVisibility();
|
||||
|
||||
// Update the labels in MainViewModel
|
||||
var translationStrings = new Dictionary<string, string>();
|
||||
translationStrings["StartDumpingButtonString"] = (string)Application.Current.FindResource("StartDumpingButtonString");
|
||||
translationStrings["StopDumpingButtonString"] = (string)Application.Current.FindResource("StopDumpingButtonString");
|
||||
translationStrings["NoSystemSelectedString"] = (string)Application.Current.FindResource("NoSystemSelectedString");
|
||||
MainViewModel.TranslateStrings(translationStrings);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -627,9 +723,11 @@ namespace MPF.UI.Windows
|
||||
if (!MainViewModel.LogPanelExpanded)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(output))
|
||||
CustomMessageBox.Show(this, output, "Detected Protection(s)", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
CustomMessageBox.Show(this, output, (string)Application.Current.FindResource("ProtectionDetectedTitleString"),
|
||||
MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
else
|
||||
CustomMessageBox.Show(this, "An exception occurred, see the log for details", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
CustomMessageBox.Show(this, (string)Application.Current.FindResource("ProtectionErrorMessageString"),
|
||||
(string)Application.Current.FindResource("ProtectionErrorTitleString"), MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -69,10 +69,10 @@
|
||||
<TabControl Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"
|
||||
Foreground="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"
|
||||
Style="{DynamicResource CustomTabControlStyle}">
|
||||
<TabItem x:Name="CommonInfo" Header="Common Info" Style="{DynamicResource CustomTabItemStyle}">
|
||||
<TabItem x:Name="CommonInfo" Header="{DynamicResource CommonInfoTabString}" Style="{DynamicResource CustomTabItemStyle}">
|
||||
<ScrollViewer CanContentScroll="False" VerticalScrollBarVisibility="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MaxHeight="500">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<GroupBox Header="Common Media Information" Margin="5" Padding="5" BorderThickness="1" BorderBrush="LightGray"
|
||||
<GroupBox Header="{DynamicResource CommonMediaInfoGroupBoxString}" Margin="5" Padding="5" BorderThickness="1" BorderBrush="LightGray"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<controls:UserInput Label="Title"
|
||||
@@ -155,7 +155,7 @@
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<GroupBox Header="Version and Editions" Margin="5" Padding="5" BorderThickness="1" BorderBrush="LightGray"
|
||||
<GroupBox Header="{DynamicResource VersionsAndEditionGroupBoxString}" Margin="5" Padding="5" BorderThickness="1" BorderBrush="LightGray"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<controls:UserInput Label="Version" Text="{Binding SubmissionInfo.VersionAndEditions.Version, Mode=TwoWay}"/>
|
||||
@@ -168,10 +168,10 @@
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="Additional Info" Style="{DynamicResource CustomTabItemStyle}">
|
||||
<TabItem Header="{DynamicResource AdditionalInfoTabString}" Style="{DynamicResource CustomTabItemStyle}">
|
||||
<ScrollViewer CanContentScroll="False" VerticalScrollBarVisibility="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MaxHeight="500">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<GroupBox Header="Extras" Margin="5" Padding="5" BorderThickness="1" BorderBrush="LightGray"
|
||||
<GroupBox Header="{DynamicResource ExtrasGroupBoxString}" Margin="5" Padding="5" BorderThickness="1" BorderBrush="LightGray"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid x:Name="PCMacHybridGrid" Visibility="Collapsed">
|
||||
@@ -199,7 +199,7 @@
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<GroupBox Header="Physical Identifiers" Margin="5" Padding="5" BorderThickness="1" BorderBrush="LightGray"
|
||||
<GroupBox Header="{DynamicResource PhysicalIdentifiersGroupBoxString}" Margin="5" Padding="5" BorderThickness="1" BorderBrush="LightGray"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<controls:UserInput x:Name="BBFCRegistrationNumberTextBox" Label="BBFC Reg. No."
|
||||
@@ -219,7 +219,7 @@
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<GroupBox Header="Publisher Identifiers" Margin="5" Padding="5" BorderThickness="1" BorderBrush="LightGray"
|
||||
<GroupBox Header="{DynamicResource PublisherIdentifiersGroupBoxString}" Margin="5" Padding="5" BorderThickness="1" BorderBrush="LightGray"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<controls:UserInput x:Name="AcclaimIDTextBox" Label="Acclaim ID"
|
||||
@@ -282,7 +282,7 @@
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="Contents" Style="{DynamicResource CustomTabItemStyle}">
|
||||
<TabItem Header="{DynamicResource ContentsTabString}" Style="{DynamicResource CustomTabItemStyle}">
|
||||
<ScrollViewer CanContentScroll="False" VerticalScrollBarVisibility="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MaxHeight="500">
|
||||
<GroupBox Margin="5" Padding="5" BorderThickness="1" BorderBrush="LightGray"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||
@@ -346,10 +346,10 @@
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="Ringcodes" Style="{DynamicResource CustomTabItemStyle}">
|
||||
<TabItem Header="{DynamicResource RingcodesTabString}" Style="{DynamicResource CustomTabItemStyle}">
|
||||
<ScrollViewer CanContentScroll="False" VerticalScrollBarVisibility="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MaxHeight="500">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<GroupBox x:Name="L0Info" Header="Data/L0 Info" Margin="5" Padding="5" BorderThickness="1" BorderBrush="LightGray"
|
||||
<GroupBox x:Name="L0Info" Header="{DynamicResource L0InfoGroupBoxString}" Margin="5" Padding="5" BorderThickness="1" BorderBrush="LightGray"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<controls:UserInput x:Name="L0MasteringRing" Label="Data/L0 Mastering Ring"
|
||||
@@ -365,7 +365,7 @@
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<GroupBox x:Name="L1Info" Header="Label/L1 Info" Margin="5" Padding="5" BorderThickness="1" BorderBrush="LightGray"
|
||||
<GroupBox x:Name="L1Info" Header="{DynamicResource L1InfoGroupBoxString}" Margin="5" Padding="5" BorderThickness="1" BorderBrush="LightGray"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<controls:UserInput x:Name="L1MasteringRing" Label="Label/L1 Mastering Ring"
|
||||
@@ -381,7 +381,7 @@
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<GroupBox x:Name="L2Info" Header="L2 Info" Visibility="Collapsed" Margin="5" Padding="5" BorderThickness="1" BorderBrush="LightGray"
|
||||
<GroupBox x:Name="L2Info" Header="{DynamicResource L2InfoGroupBoxString}" Visibility="Collapsed" Margin="5" Padding="5" BorderThickness="1" BorderBrush="LightGray"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<controls:UserInput x:Name="L2MasteringRing" Label="L2 Mastering Ring"
|
||||
@@ -393,7 +393,7 @@
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<GroupBox x:Name="L3Info" Header="L3 Info" Visibility="Collapsed" Margin="5" Padding="5" BorderThickness="1" BorderBrush="LightGray"
|
||||
<GroupBox x:Name="L3Info" Header="{DynamicResource L3InfoGroupBoxString}" Visibility="Collapsed" Margin="5" Padding="5" BorderThickness="1" BorderBrush="LightGray"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<controls:UserInput x:Name="L3MasteringRing" Label="L3 Mastering Ring"
|
||||
@@ -408,7 +408,7 @@
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="Read-Only Info" Style="{DynamicResource CustomTabItemStyle}">
|
||||
<TabItem Header="{DynamicResource ReadOnlyInfoTabString}" Style="{DynamicResource CustomTabItemStyle}">
|
||||
<ScrollViewer CanContentScroll="False" VerticalScrollBarVisibility="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MaxHeight="500">
|
||||
<GroupBox Margin="5" Padding="5" BorderThickness="1" BorderBrush="LightGray"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||
|
||||
@@ -93,8 +93,8 @@
|
||||
/>
|
||||
|
||||
<Label VerticalAlignment="Center" Content="Default UI Language:" HorizontalAlignment="Right" />
|
||||
<ComboBox x:Name="DefaultUILanguageComboBox" Height="22" Width="200" HorizontalAlignment="Left"
|
||||
ItemsSource="{Binding UILanguages}" SelectedItem="{Binding Options.DefaultUILanguage, Converter={StaticResource ElementConverter}, Mode=TwoWay}"
|
||||
<ComboBox x:Name="DefaultInterfaceLanguageComboBox" Height="22" Width="200" HorizontalAlignment="Left"
|
||||
ItemsSource="{Binding InterfaceLanguages}" SelectedItem="{Binding Options.DefaultInterfaceLanguage, Converter={StaticResource ElementConverter}, Mode=TwoWay}"
|
||||
Style="{DynamicResource CustomComboBoxStyle}" />
|
||||
</UniformGrid>
|
||||
</GroupBox>
|
||||
|
||||
Reference in New Issue
Block a user