(GUI): added string resources.

This commit is contained in:
morkt 2017-02-03 08:53:34 +04:00
parent cd5a820c48
commit c483e745d9
7 changed files with 101 additions and 22 deletions

View File

@ -2,6 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:w="clr-namespace:Rnd.Windows" xmlns:w="clr-namespace:Rnd.Windows"
xmlns:s="clr-namespace:GARbro.GUI.Strings"
Title="{Binding Title}" ShowInTaskbar="False" WindowStartupLocation="CenterOwner" Title="{Binding Title}" ShowInTaskbar="False" WindowStartupLocation="CenterOwner"
ResizeMode="NoResize" SizeToContent="WidthAndHeight" ShowActivated="True" ResizeMode="NoResize" SizeToContent="WidthAndHeight" ShowActivated="True"
Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"> Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}">
@ -9,9 +10,9 @@
<TextBox x:Name="ErrorText" Text="{Binding Text}" IsReadOnly="True" Background="Transparent" BorderThickness="0" Margin="10"/> <TextBox x:Name="ErrorText" Text="{Binding Text}" IsReadOnly="True" Background="Transparent" BorderThickness="0" Margin="10"/>
<Separator/> <Separator/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center">
<CheckBox x:Name="IgnoreErrors" Content="_Ignore further errors" Margin="10" VerticalAlignment="Center"/> <CheckBox x:Name="IgnoreErrors" Content="{x:Static s:guiStrings.LabelIgnoreErrors}" Margin="10" VerticalAlignment="Center"/>
<Button Content="_Continue" Margin="10" Width="75" Height="25" IsDefault="True" Click="ContinueButton_Click"/> <Button Content="{x:Static s:guiStrings.ButtonContinue}" Margin="10" Width="75" Height="25" IsDefault="True" Click="ContinueButton_Click"/>
<Button Content="_Abort" Margin="10" Width="75" Height="25" IsCancel="True" Click="AbortButton_Click"/> <Button Content="{x:Static s:guiStrings.ButtonAbort}" Margin="10" Width="75" Height="25" IsCancel="True" Click="AbortButton_Click"/>
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
<Window.InputBindings> <Window.InputBindings>

View File

@ -2,7 +2,7 @@
//! \date Fri Jul 25 05:52:27 2014 //! \date Fri Jul 25 05:52:27 2014
//! \brief Extract archive frontend. //! \brief Extract archive frontend.
// //
// Copyright (C) 2014-2015 by morkt // Copyright (C) 2014-2017 by morkt
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to // of this software and associated documentation files (the "Software"), to
@ -119,7 +119,6 @@ namespace GARbro.GUI
private int m_skip_count; private int m_skip_count;
private bool m_extract_in_progress = false; private bool m_extract_in_progress = false;
private ProgressDialog m_progress_dialog; private ProgressDialog m_progress_dialog;
private Exception m_pending_error;
public bool IsActive { get { return m_extract_in_progress; } } public bool IsActive { get { return m_extract_in_progress; } }
@ -270,7 +269,6 @@ namespace GARbro.GUI
m_progress_dialog.ProgressBarStyle = ProgressBarStyle.MarqueeProgressBar; m_progress_dialog.ProgressBarStyle = ProgressBarStyle.MarqueeProgressBar;
} }
m_convert_audio = !m_skip_audio && Settings.Default.appConvertAudio; m_convert_audio = !m_skip_audio && Settings.Default.appConvertAudio;
m_pending_error = null;
m_progress_dialog.DoWork += (s, e) => ExtractWorker (file_list); m_progress_dialog.DoWork += (s, e) => ExtractWorker (file_list);
m_progress_dialog.RunWorkerCompleted += OnExtractComplete; m_progress_dialog.RunWorkerCompleted += OnExtractComplete;
m_progress_dialog.ShowDialog (m_main); m_progress_dialog.ShowDialog (m_main);
@ -305,8 +303,7 @@ namespace GARbro.GUI
{ {
if (!m_ignore_errors) if (!m_ignore_errors)
{ {
var error_text = string.Format ("{0}\n{1}\n{2}", "Failed to extract file", var error_text = string.Format (guiStrings.TextErrorExtracting, entry.Name, X.Message);
entry.Name, X.Message);
if (!m_main.Dispatcher.Invoke (() => ShowErrorDialog (error_text))) if (!m_main.Dispatcher.Invoke (() => ShowErrorDialog (error_text)))
break; break;
} }
@ -416,7 +413,7 @@ namespace GARbro.GUI
bool ShowErrorDialog (string error_text) bool ShowErrorDialog (string error_text)
{ {
var dialog = new FileErrorDialog ("File extraction error", error_text); var dialog = new FileErrorDialog (guiStrings.TextExtractionError, error_text);
var progress_dialog_hwnd = m_progress_dialog.GetWindowHandle(); var progress_dialog_hwnd = m_progress_dialog.GetWindowHandle();
if (progress_dialog_hwnd != IntPtr.Zero) if (progress_dialog_hwnd != IntPtr.Zero)
{ {
@ -449,17 +446,6 @@ namespace GARbro.GUI
m_main.Dispatcher.Invoke (m_main.RefreshView); m_main.Dispatcher.Invoke (m_main.RefreshView);
} }
m_main.SetStatusText (Localization.Format ("MsgExtractedFiles", m_extract_count)); m_main.SetStatusText (Localization.Format ("MsgExtractedFiles", m_extract_count));
if (null != m_pending_error)
{
if (m_pending_error is OperationCanceledException)
m_main.SetStatusText (m_pending_error.Message);
else
{
string message = string.Format (guiStrings.TextErrorExtracting,
m_progress_dialog.Description, m_pending_error.Message);
m_main.PopupError (message, guiStrings.MsgErrorExtracting);
}
}
this.Dispose(); this.Dispose();
} }

View File

@ -60,6 +60,15 @@ namespace GARbro.GUI.Strings {
} }
} }
/// <summary>
/// Looks up a localized string similar to _Abort.
/// </summary>
public static string ButtonAbort {
get {
return ResourceManager.GetString("ButtonAbort", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Cancel. /// Looks up a localized string similar to Cancel.
/// </summary> /// </summary>
@ -69,6 +78,15 @@ namespace GARbro.GUI.Strings {
} }
} }
/// <summary>
/// Looks up a localized string similar to _Continue.
/// </summary>
public static string ButtonContinue {
get {
return ResourceManager.GetString("ButtonContinue", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Convert. /// Looks up a localized string similar to Convert.
/// </summary> /// </summary>
@ -384,6 +402,15 @@ namespace GARbro.GUI.Strings {
} }
} }
/// <summary>
/// Looks up a localized string similar to _Ignore further errors.
/// </summary>
public static string LabelIgnoreErrors {
get {
return ResourceManager.GetString("LabelIgnoreErrors", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Skip incovertible files.. /// Looks up a localized string similar to Skip incovertible files..
/// </summary> /// </summary>
@ -965,6 +992,15 @@ namespace GARbro.GUI.Strings {
} }
} }
/// <summary>
/// Looks up a localized string similar to File extraction error.
/// </summary>
public static string TextExtractionError {
get {
return ResourceManager.GetString("TextExtractionError", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Extract text. /// Looks up a localized string similar to Extract text.
/// </summary> /// </summary>

View File

@ -458,4 +458,20 @@
<data name="CtxMenuSelectByMask" xml:space="preserve"> <data name="CtxMenuSelectByMask" xml:space="preserve">
<value>마스크로 파일 선택...</value> <value>마스크로 파일 선택...</value>
</data> </data>
</root> <data name="ButtonAbort" xml:space="preserve">
<value>Abort</value>
<comment>translation pending</comment>
</data>
<data name="ButtonContinue" xml:space="preserve">
<value>Continue</value>
<comment>translation pending</comment>
</data>
<data name="LabelIgnoreErrors" xml:space="preserve">
<value>Ignore further errors</value>
<comment>translation pending</comment>
</data>
<data name="TextExtractionError" xml:space="preserve">
<value>File extraction error</value>
<comment>translation pending</comment>
</data>
</root>

View File

@ -462,4 +462,16 @@ Overwrite?</value>
<data name="CtxMenuSelectByMask" xml:space="preserve"> <data name="CtxMenuSelectByMask" xml:space="preserve">
<value>Select files by mask...</value> <value>Select files by mask...</value>
</data> </data>
<data name="ButtonAbort" xml:space="preserve">
<value>_Abort</value>
</data>
<data name="ButtonContinue" xml:space="preserve">
<value>_Continue</value>
</data>
<data name="LabelIgnoreErrors" xml:space="preserve">
<value>_Ignore further errors</value>
</data>
<data name="TextExtractionError" xml:space="preserve">
<value>File extraction error</value>
</data>
</root> </root>

View File

@ -460,7 +460,7 @@
<value>Выбрать файлы</value> <value>Выбрать файлы</value>
</data> </data>
<data name="TextErrorExtracting" xml:space="preserve"> <data name="TextErrorExtracting" xml:space="preserve">
<value>Произошёл сбой во время извлечения файла <value>Не удалось извлечь файл
{0} {0}
{1}</value> {1}</value>
</data> </data>
@ -483,4 +483,16 @@
<data name="CtxMenuSelectByMask" xml:space="preserve"> <data name="CtxMenuSelectByMask" xml:space="preserve">
<value>Выбрать файлы по маске...</value> <value>Выбрать файлы по маске...</value>
</data> </data>
<data name="ButtonAbort" xml:space="preserve">
<value>Прервать</value>
</data>
<data name="ButtonContinue" xml:space="preserve">
<value>Продолжить</value>
</data>
<data name="LabelIgnoreErrors" xml:space="preserve">
<value>Игнорировать дальнейшие ошибки</value>
</data>
<data name="TextExtractionError" xml:space="preserve">
<value>Ошибка извлечения файла</value>
</data>
</root> </root>

View File

@ -460,4 +460,20 @@
<value>Select files by mask...</value> <value>Select files by mask...</value>
<comment>translation pending</comment> <comment>translation pending</comment>
</data> </data>
<data name="ButtonAbort" xml:space="preserve">
<value>Abort</value>
<comment>translation pending</comment>
</data>
<data name="ButtonContinue" xml:space="preserve">
<value>Continue</value>
<comment>translation pending</comment>
</data>
<data name="LabelIgnoreErrors" xml:space="preserve">
<value>Ignore further errors</value>
<comment>translation pending</comment>
</data>
<data name="TextExtractionError" xml:space="preserve">
<value>File extraction error</value>
<comment>translation pending</comment>
</data>
</root> </root>