diff --git a/GarExtract.cs b/GarExtract.cs index af09754f..f554263c 100644 --- a/GarExtract.cs +++ b/GarExtract.cs @@ -208,26 +208,24 @@ namespace GARbro.GUI extractProgressDialog.Description = file_list.First().Name; extractProgressDialog.ProgressBarStyle = ProgressBarStyle.MarqueeProgressBar; } + int extract_count = 0; extractProgressDialog.DoWork += (s, e) => { try { int total = file_list.Count(); - int i = 0; foreach (var entry in file_list) { if (extractProgressDialog.CancellationPending) break; if (total > 1) - extractProgressDialog.ReportProgress (i*100/total, null, entry.Name); + extractProgressDialog.ReportProgress (extract_count*100/total, null, entry.Name); if (null != image_format && entry.Type == "image") ExtractImage (arc, entry, image_format); else arc.Extract (entry); - ++i; + ++extract_count; } - SetStatusText (string.Format (guiStrings.MsgExtractCompletePlural, i, - Localization.Plural (i, "file"))); } catch (Exception X) { @@ -241,6 +239,7 @@ namespace GARbro.GUI arc.Dispose(); Dispatcher.Invoke (RefreshView); } + SetStatusText (Localization.Format ("MsgExtractedFiles", extract_count)); }; extractProgressDialog.ShowDialog (this); } diff --git a/Strings/guiStrings.Designer.cs b/Strings/guiStrings.Designer.cs index b1eda5a5..3f8cc571 100644 --- a/Strings/guiStrings.Designer.cs +++ b/Strings/guiStrings.Designer.cs @@ -303,24 +303,6 @@ namespace GARbro.GUI.Strings { } } - /// - /// Looks up a localized string similar to file. - /// - public static string LPfile1 { - get { - return ResourceManager.GetString("LPfile1", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to files. - /// - public static string LPfile2 { - get { - return ResourceManager.GetString("LPfile2", resourceCulture); - } - } - /// /// Looks up a localized string similar to About Game Resource browser. /// @@ -448,11 +430,20 @@ namespace GARbro.GUI.Strings { } /// - /// Looks up a localized string similar to Extracted {0} {1}. + /// Looks up a localized string similar to Extracted {0} file. /// - public static string MsgExtractCompletePlural { + public static string MsgExtractedFiles1 { get { - return ResourceManager.GetString("MsgExtractCompletePlural", resourceCulture); + return ResourceManager.GetString("MsgExtractedFiles1", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Extracted {0} files. + /// + public static string MsgExtractedFiles2 { + get { + return ResourceManager.GetString("MsgExtractedFiles2", resourceCulture); } } diff --git a/Strings/guiStrings.resx b/Strings/guiStrings.resx index e4226282..feed8927 100644 --- a/Strings/guiStrings.resx +++ b/Strings/guiStrings.resx @@ -198,12 +198,6 @@ Extract {0} to - - file - - - files - About Game Resource browser @@ -225,8 +219,8 @@ Extracted {0} into {1} - - Extracted {0} {1} + + Extracted {0} file Extracting files from {0} @@ -348,4 +342,7 @@ Overwrite? _Help + + Extracted {0} files + \ No newline at end of file diff --git a/Strings/guiStrings.ru-RU.resx b/Strings/guiStrings.ru-RU.resx index 0ed7ea51..b3408a07 100644 --- a/Strings/guiStrings.ru-RU.resx +++ b/Strings/guiStrings.ru-RU.resx @@ -195,15 +195,6 @@ Извлечь {0} в - - файл - - - файла - - - файлов - О программе @@ -225,9 +216,6 @@ {0} извлечён в {1} - - Извлечено {0} {1} - Извлекаются файлы из {0} @@ -360,4 +348,13 @@ _Справка + + Извлечён {0} файл + + + Извлечено {0} файла + + + Извлечено {0} файлов + \ No newline at end of file diff --git a/Utility.cs b/Utility.cs index d59ca0e9..fa1e5edd 100644 --- a/Utility.cs +++ b/Utility.cs @@ -109,7 +109,7 @@ namespace GARbro.GUI public static class Localization { - public static string Plural (int n, string en_singular) + public static string Plural (int n, string msg_id) { string suffix; if (CultureInfo.CurrentUICulture.Name == "ru-RU") @@ -122,15 +122,25 @@ namespace GARbro.GUI } try { - var res = guiStrings.ResourceManager.GetString ("LP"+en_singular+suffix); - return res ?? en_singular; + var res = guiStrings.ResourceManager.GetString (msg_id+suffix); + if (null == res && suffix != "1") + res = guiStrings.ResourceManager.GetString (msg_id+"1"); + if (null == res) + Trace.WriteLine (string.Format ("Missing string resource for '{0}' token", msg_id+suffix)); + return res ?? msg_id; } - catch + catch (Exception X) { - return en_singular; + Trace.WriteLine (X.Message, "Localization.Plural"); + return msg_id; } } + public static string Format (string msg_id, int n) + { + return string.Format (Plural (n, msg_id), n); + } + // Localization.Format ("{0:file:files} copied", count); // public static string Format (string format, params object[] args); }