Changeset 581
- Timestamp:
- 11/19/2008 12:49:37 AM (5 years ago)
- Location:
- branches/eraser6
- Files:
-
- 6 edited
-
Eraser/Program.cs (modified) (1 diff)
-
Eraser/ProgressForm.cs (modified) (1 diff)
-
Eraser/SettingsPanel.cs (modified) (1 diff)
-
Eraser/UpdateForm.cs (modified) (9 diffs)
-
Manager/DirectExecutor.cs (modified) (3 diffs)
-
Util/Localisation.cs (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/Eraser/Program.cs
r573 r581 127 127 { 128 128 key.DeleteValue(setting); 129 MessageBox.Show( string.Format(S._("Could not load the setting {0} for plugin {1}." +130 "The setting has been lost." ), key, pluginID.ToString()),129 MessageBox.Show(S._("Could not load the setting {0} for plugin {1}. " + 130 "The setting has been lost.", key, pluginID.ToString()), 131 131 S._("Eraser"), MessageBoxButtons.OK, MessageBoxIcon.Error); 132 132 } -
branches/eraser6/Eraser/ProgressForm.cs
r487 r581 66 66 item.Text = File.GetCompactPath(e.CurrentItemName, item.Width * 2, item.Font); 67 67 pass.Text = e.CurrentTargetTotalPasses != 0 ? 68 string.Format(S._("{0} out of {1}"), e.CurrentItemPass, e.CurrentTargetTotalPasses) :68 S._("{0} out of {1}", e.CurrentItemPass, e.CurrentTargetTotalPasses) : 69 69 string.Format("{0}", e.CurrentItemPass); 70 70 71 71 if (e.TimeLeft >= TimeSpan.Zero) 72 timeLeft.Text = string.Format(S._("About {0:hh:mm:ss} left"), e.TimeLeft);72 timeLeft.Text = S._("About {0:hh:mm:ss} left", e.TimeLeft); 73 73 else 74 timeLeft.Text = string.Format(S._("Unknown"), e.TimeLeft);74 timeLeft.Text = S._("Unknown"); 75 75 76 76 itemProgress.Value = (int)(e.CurrentItemProgress * 1000); 77 77 itemProgressLbl.Text = e.CurrentItemProgress.ToString("#0%"); 78 78 overallProgress.Value = (int)(e.OverallProgress * 1000); 79 overallProgressLbl.Text = string.Format(S._("Total: {0,2:#0.00%}"), e.OverallProgress);79 overallProgressLbl.Text = S._("Total: {0,2:#0.00%}", e.OverallProgress); 80 80 } 81 81 -
branches/eraser6/Eraser/SettingsPanel.cs
r570 r581 233 233 foreach (string item in defaultsList) 234 234 defaults += "\t" + item + "\n"; 235 MessageBox.Show( string.Format(S._("The following settings held invalid values:\n\n" +235 MessageBox.Show(S._("The following settings held invalid values:\n\n" + 236 236 "{0}\nThese settings have now been set to naive defaults.\n\n" + 237 "Please check that the new settings suit your required level of security." ),237 "Please check that the new settings suit your required level of security.", 238 238 defaults), S._("Eraser"), MessageBoxButtons.OK, MessageBoxIcon.Warning); 239 239 saveSettings_Click(null, null); -
branches/eraser6/Eraser/UpdateForm.cs
r527 r581 334 334 foreach (UpdateData upd in uiUpdates.Values) 335 335 amountToDownload += upd.Update.FileSize - upd.amountDownloaded; 336 downloadingOverallLbl.Text = string.Format(S._("Overall progress: {0} left"),336 downloadingOverallLbl.Text = S._("Overall progress: {0} left", 337 337 Util.File.GetHumanReadableFilesize(amountToDownload)); 338 338 } … … 367 367 item.SubItems[1].Text = string.Empty; 368 368 else 369 item.SubItems[1].Text = string.Format(S._("Error: {0}"), 370 update.Error.Message); 369 item.SubItems[1].Text = S._("Error: {0}", update.Error.Message); 371 370 } 372 371 … … 416 415 update.Error = ((UpdateManager.ProgressErrorEventArgs)e).Exception; 417 416 update.LVItem.ImageIndex = 3; 418 update.LVItem.SubItems[1].Text = string.Format(S._("Error: {0}"), 419 update.Error.Message); 417 update.LVItem.SubItems[1].Text = S._("Error: {0}", update.Error.Message); 420 418 } 421 419 else … … 663 661 float progress = responseBuffer.Count / (float)resp.ContentLength; 664 662 OnProgress(new ProgressEventArgs(progress, progress, null, 665 string.Format(S._("{0} of {1} downloaded"),663 S._("{0} of {1} downloaded", 666 664 Util.File.GetHumanReadableFilesize(responseBuffer.Count), 667 665 Util.File.GetHumanReadableFilesize(resp.ContentLength)))); … … 817 815 float overallProgress = (currUpdate - 1 + itemProgress) / updates.Count; 818 816 OnProgress(new ProgressEventArgs(itemProgress, overallProgress, 819 update, string.Format(S._("Downloading: {0}"), update.Name)));817 update, S._("Downloading: {0}", update.Name))); 820 818 } 821 819 } … … 826 824 //Let the event handler know the download is complete. 827 825 OnProgress(new ProgressEventArgs(1.0f, (float)currUpdate / updates.Count, 828 update, string.Format(S._("Downloaded: {0}"), update.Name)));826 update, S._("Downloaded: {0}", update.Name))); 829 827 } 830 828 } … … 833 831 OnProgress(new ProgressErrorEventArgs(new ProgressEventArgs(1.0f, 834 832 (float)currUpdate / updates.Count, update, 835 string.Format(S._("Error downloading {0}: {1}"), update.Name, e.Message)),833 S._("Error downloading {0}: {1}", update.Name, e.Message)), 836 834 e)); 837 835 } … … 854 852 float progress = (float)currItem++ / files.Count; 855 853 OnProgress(new ProgressEventArgs(0.0f, progress, 856 item, string.Format(S._("Installing {0}"), item.Name)));854 item, S._("Installing {0}", item.Name))); 857 855 858 856 System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo(); … … 864 862 if (process.ExitCode == 0) 865 863 OnProgress(new ProgressEventArgs(1.0f, progress, 866 item, string.Format(S._("Installed {0}"), item.Name)));864 item, S._("Installed {0}", item.Name))); 867 865 else 868 866 OnProgress(new ProgressErrorEventArgs(new ProgressEventArgs(1.0f, 869 progress, item, string.Format(S._("Error installing {0}"), item.Name)),870 new Exception( string.Format(S._("The installer exited with an error code {0}"),867 progress, item, S._("Error installing {0}", item.Name)), 868 new Exception(S._("The installer exited with an error code {0}", 871 869 process.ExitCode)))); 872 870 } -
branches/eraser6/Manager/DirectExecutor.cs
r580 r581 622 622 if ((info.Attributes & FileAttributes.ReparsePoint) != 0) 623 623 { 624 task.Log.Add(new LogEntry( string.Format(S._("Files in {0} did not have" +625 "t heir cluster tips erased because it is a hard link or a symbolic " +626 "link."),info.FullName), LogLevel.INFORMATION));624 task.Log.Add(new LogEntry(S._("Files in {0} did not have their cluster " + 625 "tips erased because it is a hard link or a symbolic link.", 626 info.FullName), LogLevel.INFORMATION)); 627 627 return; 628 628 } … … 634 634 LogLevel.INFORMATION)); 635 635 else if ((file.Attributes & FileAttributes.ReparsePoint) != 0) 636 task.Log.Add(new LogEntry( string.Format(S._("{0} did not have its " +637 " cluster tips erased because it is a hard link or a symbolic link."),636 task.Log.Add(new LogEntry(S._("{0} did not have its cluster tips " + 637 "erased because it is a hard link or a symbolic link.", 638 638 file.FullName), LogLevel.INFORMATION)); 639 639 else … … 945 945 //using the file; throw an exception. 946 946 if (tries > 20) 947 throw new IOException( string.Format(S._("The file {0} is currently in use" +948 " and cannot be removed."), info.FullName));947 throw new IOException(S._("The file {0} is currently in use and " + 948 "cannot be removed.", info.FullName)); 949 949 } 950 950 } -
branches/eraser6/Util/Localisation.cs
r506 r581 41 41 { 42 42 /// <summary> 43 /// Translates the locali zable string to the set localized string.43 /// Translates the localisable string to the set localised string. 44 44 /// </summary> 45 /// <param name="str">The string to locali ze.</param>46 /// <returns>A locali zed string, or str if no localization exists.</returns>45 /// <param name="str">The string to localise.</param> 46 /// <returns>A localised string, or str if no localisation exists.</returns> 47 47 public static string _(string str) 48 48 { … … 51 51 52 52 /// <summary> 53 /// Translates the localizable string to the set localized string. 53 /// Translates the localisable string to the localised string, formatting all 54 /// placeholders using composite formatting. This is shorthand for 55 /// <code>string.Format(S._(str), args)</code> 54 56 /// </summary> 55 /// <param name="str">The string to localize.</param> 56 /// <param name="assembly">The assembly from which localized resource satellite 57 /// <param name="str">The string to localise.</param> 58 /// <param name="args">Arguments for the composite formatting call.</param> 59 /// <returns>The formatted and localised string.</returns> 60 /// <remarks>The localised string is retrieved before formatting.</remarks> 61 public static string _(string str, params object[] args) 62 { 63 //Get the localised version of the input string. 64 string localStr = TranslateText(str, Assembly.GetCallingAssembly()); 65 66 //Format the string. 67 return string.Format(localStr, args); 68 } 69 70 /// <summary> 71 /// Translates the localisable string to the set localised string. 72 /// </summary> 73 /// <param name="str">The string to localise.</param> 74 /// <param name="assembly">The assembly from which localised resource satellite 57 75 /// assemblies should be loaded from.</param> 58 /// <returns>A locali zed string, or str if no localization exists.</returns>76 /// <returns>A localised string, or str if no localisation exists.</returns> 59 77 public static string TranslateText(string str, Assembly assembly) 60 78 {
Note: See TracChangeset
for help on using the changeset viewer.
