From 1612064c66e2892f9ef362943d61c3d76d75f3d4 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Wed, 18 Jul 2018 16:59:35 +0100 Subject: [PATCH] [loc] finalize new translations for 3.2 * Also fix a MinGW warning --- res/loc/ChangeLog.txt | 28 ++++++++++----- res/loc/pollock/Pollock.cs | 70 +++++++++++++++++++++++--------------- res/loc/rufus.loc | 26 +++++++++++--- src/rufus.c | 8 ++--- src/rufus.rc | 10 +++--- 5 files changed, 94 insertions(+), 48 deletions(-) diff --git a/res/loc/ChangeLog.txt b/res/loc/ChangeLog.txt index bcc92b64..51270d72 100644 --- a/res/loc/ChangeLog.txt +++ b/res/loc/ChangeLog.txt @@ -5,15 +5,27 @@ When editing an existing translation, make sure to follow: https://github.com/pbatard/rufus/wiki/Localization#Editing_a_translation o v3.2 (2018.??.??) - - *NEW* MSG_087 - *NEW* MSG_123 - *NEW* MSG_124 - *NEW* MSG_125 - *NEW* MSG_126 - *NEW* MSG_127 - - *NEW* MSG_172 - - *NEW* MSG_240 + The following appears in Advanced format options → Check device for bad blocks → dropdown menu with + %s being replaced with SLC, MLC or TLC, which is a type of flash memory. In other words, this message + should mean "for a flash memory device of type %s". *Please* try to keep the translation as short as + possible so that it won't result in an overly large dropdown... + - *NEW* MSG_087 "for %s devices" + The following 4 messages can be tested using https://github.com/pbatard/rufus/raw/master/res/loc/test/casper_test.iso + - *NEW* MSG_123 "Persistent partition size" + - *NEW* MSG_124 "No persistence" + - *NEW* MSG_125 "Set the size of the persistent partition for live USB media. Setting the size to 0 disables the persistent partition." + - *NEW* MSG_126 "Set the partition size units." + As of Rufus 3.2, *ALL* downloads from the servers are digitally signed, and their signature is validated using the + public key that is embedded in the application. This message appears in an error dialog if the validation fails. + - *NEW* MSG_172 "Invalid download signature" + This message was present in 3.0, but I forgot to mention it then. It has to do with the signature + validation that Rufus uses when downloading an update. + - *NEW* MSG_240 "The signature for the downloaded update can not be validated (...)" + You can see this status message by pressing -- and then selecting Start. + It's the same as MSG_286 but with a process that *may* be faster, hence the name. - *NEW* MSG_306 + Note: Because this is the introduction of a new translation framework, and I am a bit short of time for that + unification of MSG_084/MSG_104/MSG_114/MSG_116 will happen in another translation round... o v3.0 (2018.03.27) - All positioning ('m', 's') has now been removed as well as some controls, for the 3.0 UI redesign diff --git a/res/loc/pollock/Pollock.cs b/res/loc/pollock/Pollock.cs index 55953e4b..23e6fc3c 100644 --- a/res/loc/pollock/Pollock.cs +++ b/res/loc/pollock/Pollock.cs @@ -959,6 +959,7 @@ namespace pollock [STAThread] static void Main(string[] args) { + bool use_local_loc = false; Console.OutputEncoding = System.Text.Encoding.UTF8; Console.CancelKeyPress += delegate (object sender, ConsoleCancelEventArgs e) { e.Cancel = true; @@ -966,6 +967,11 @@ namespace pollock }; Console.WriteLine($"{app_name} {version_str} - Poedit to rufus.loc conversion utility"); Console.WriteLine(); + foreach (var arg in args) + { + if (arg.Contains("l")) + use_local_loc = true; + } if (AppDomain.CurrentDomain.FriendlyName.Contains('m')) goto Maintainer_Mode; @@ -986,7 +992,7 @@ namespace pollock if (ver == null) { Console.WriteLine("ERROR: Could not access application data."); - goto Exit; + goto Error; } foreach (var line in ver.Split('\n')) { @@ -1010,7 +1016,7 @@ namespace pollock if ((download_url == null) || (rufus_url == null) || (update_version[0] == 0)) { Console.WriteLine("FAILED"); - goto Exit; + goto Error; } Console.WriteLine("DONE"); @@ -1023,7 +1029,7 @@ namespace pollock if (DownloadFile(download_url)) { Console.WriteLine("Now re-launch this program using the latest version."); - goto Exit; + goto Error; } Console.WriteLine("Download failed."); } @@ -1051,10 +1057,19 @@ namespace pollock } } - // Download the latest loc file - Console.Write("Downloading the latest loc file... "); - if (!DownloadFile(loc_url)) - goto Exit; + if (!use_local_loc) + { + // Download the latest loc file + Console.Write("Downloading the latest loc file... "); + if (!DownloadFile(loc_url)) + goto Error; + } + else + { + var local_loc = @"C:\rufus\res\loc\rufus.loc"; + Console.Write($"Copying loc file from '{local_loc}'... "); + File.Copy(local_loc, "rufus.loc", true); + } var loc_file = loc_url.Split('/').Last(); // Convert to CRLF and get all the language ids @@ -1109,13 +1124,18 @@ Retry: Console.WriteLine($"{list[index][0]} was selected."); Console.WriteLine(); po_file = $"{list[index][1]}.po"; + if (File.Exists(po_file)) + { + if (!PromptForQuestion($"A '{po_file}' file already exists. Do you want to overwrite it? (If unsure, answer 'y')")) + goto Error; + } Language old_en_US = null; if (list[index][2] == list[0][2]) { Console.WriteLine("Note: This language is already at the most recent version!"); if (!PromptForQuestion("Do you still want to edit it?")) - goto Exit; + goto Error; } else { @@ -1133,26 +1153,19 @@ Retry: var url = "https://github.com/pbatard/rufus/releases/tag/v" + list[index][2]; var str = DownloadString(url); if (str == null) - { - index = -1; - goto Exit; - } + goto Error; var sha = str.Substring(str.IndexOf("/pbatard/rufus/commit/") + 22, 40); // TODO: Remove this once everyone has upgraded past 3.2 string loc_dir = ((list[index][2][0] == '2') || ((list[index][2][0] == '3') && (list[index][2][2] == '0'))) ? "localization" : "loc"; url = "https://github.com/pbatard/rufus/raw/" + sha + "/res/" + loc_dir + "/rufus.loc"; if (!DownloadFile(url, old_loc_file)) - { - index = -1; - goto Exit; - } + goto Error; } var old_langs = ParseLocFile(old_loc_file, "en-US"); if ((old_langs == null) || (old_langs.Count != 1)) { Console.WriteLine("Error: Unable to get en-US data from previous loc file."); - index = -1; - goto Exit; + goto Error; } old_en_US = old_langs[0]; } @@ -1160,8 +1173,7 @@ Retry: if (CreatePoFiles(ParseLocFile(loc_file, list[index][1]), old_en_US) != 1) { Console.WriteLine("Failed to create PO file"); - index = -1; - goto Exit; + goto Error; } // Watch for file modifications @@ -1182,18 +1194,18 @@ Retry: Console.WriteLine($"* The {list[index][0]} translation file ({list[index][1]}) is now ready to be edited in Poedit."); Console.WriteLine("* Please look for entries highlited in orange - they are the ones requiring an update."); Console.WriteLine("*"); - Console.WriteLine("* Whenever you save your changes in Poedit, an new 'rufus.loc' will be generated so"); - Console.WriteLine($"* that you can test your changes using '{rufus_file}' in the same directory."); + Console.WriteLine("* Whenever you save your changes in Poedit, a new 'rufus.loc' will be generated so"); + Console.WriteLine($"* that you can test it with '{rufus_file}' in the same directory."); Console.WriteLine("*"); Console.WriteLine("* PLEASE DO NOT CLOSE THIS CONSOLE APPLICATION - IT NEEDS TO RUN IN THE BACKGROUND!"); Console.WriteLine("* Instead, when you are done editing your translation, simply close Poedit."); Console.WriteLine("*************************************************************************************"); - WaitForKey("Press any key to launch Poedit..."); + WaitForKey($"Press any key to open '{po_file}' in Poedit..."); Process process = new Process(); process.StartInfo.FileName = poedit; process.StartInfo.WorkingDirectory = app_dir; - process.StartInfo.Arguments = $"{list[index][1]}.po"; + process.StartInfo.Arguments = po_file; process.StartInfo.WindowStyle = ProcessWindowStyle.Maximized; if (!process.Start()) { @@ -1201,7 +1213,7 @@ Retry: goto Exit; } Console.SetCursorPosition(0, Console.CursorTop - 1); - Console.WriteLine("Running Poedit... "); + Console.WriteLine("Running Poedit... "); DateTime launch_date = DateTime.Now; process.WaitForExit(); Console.WriteLine($"Poedit {((DateTime.Now - launch_date).Milliseconds < 100? "is already running (?)..." : "was closed.")}"); @@ -1213,7 +1225,7 @@ Retry: else { Console.WriteLine("Poedit was not found. You will have to launch it and open the"); - Console.WriteLine($"'{app_dir + list[index][1]}.po' file manually."); + Console.WriteLine($"'{po_file}' file manually."); } Exit: @@ -1223,11 +1235,15 @@ Exit: { Process.Start($"mailto:pete@akeo.ie?subject=Rufus {list[index][0]} translation v{list[0][2]} update" + $"&body=Hi Pete,%0D%0A%0D%0APlease find attached the latest {list[index][0]} translation." + - $"%0D%0A%0D%0A" + + $"%0D%0A%0D%0A" + $"%0D%0A%0D%0ARegards,"); } return; +Error: + WaitForKey("Press any key to exit..."); + return; + Maintainer_Mode: string file_name; OpenFileDialog file_dialog = new OpenFileDialog(); diff --git a/res/loc/rufus.loc b/res/loc/rufus.loc index d76818b3..3bb2efdf 100644 --- a/res/loc/rufus.loc +++ b/res/loc/rufus.loc @@ -157,7 +157,8 @@ t MSG_032 "UEFI (non CSM)" t MSG_033 "BIOS or UEFI" # Number of bad block check passes (singular for 1 pass) t MSG_034 "%d pass" -# Number of bad block check passes (plural for 2 or more passes) +# Number of bad block check passes (plural for 2 or more passes). +# See MSG_087 for the message that %s gets replaced with. t MSG_035 "%d passes %s" t MSG_036 "ISO Image" t MSG_037 "Application" @@ -225,6 +226,11 @@ t MSG_084 "This ISO image seems to use an obsolete version of '%s'.\n" "'%s' exists there, it will be reused automatically." t MSG_085 "Downloading '%s'" t MSG_086 "No image selected" +# This message appears in Advanced format options → Check device for bad blocks → dropdown menu +# %s will be replaced with SLC, MLC or TLC, which is a type of flash memory. In other words, this +# message should mean "for a flash memory device of type %s". *Please* try to keep the translation +# as short as possible so that it won't result in an overly large dropdown... It's okay to use a +# translation for "type" instead of "device" (e.g. "for TLC type"). See also MSG_035. t MSG_087 "for %s devices" t MSG_088 "Image is too big" t MSG_089 "The image is too big for the selected target." @@ -308,11 +314,18 @@ t MSG_119 "advanced drive properties" t MSG_120 "advanced format options" t MSG_121 "Show %s" t MSG_122 "Hide %s" +# A persistent partitions can be used with "Live" USB media to store data. +# It means that data can be preserved across reboots on "Live" USB drives. +# To test this feature, please download and select 'casper_test.iso' from: +# https://github.com/pbatard/rufus/raw/master/res/loc/test/casper_test.iso t MSG_123 "Persistent partition size" +# This message appears in the persistence 'Size' control when the slider is set to 0. +# If running out of space, it is okay to use "No partition" or "None" to indicate that a persistent +# partition will not be created (because the 'Size' edit control is *not* adjusted for width). t MSG_124 "No persistence" -t MSG_125 "Use this slider to set the size of the persistent partition. Setting the size to 0 disables the persistent partition." -t MSG_126 "Use this field to enter the size of the persistent partition. Setting the size to 0 disables the persistent partition." -t MSG_127 "Set the persistent partition size unit." +# Tooltips used for the peristence size slider and edit control +t MSG_125 "Set the size of the persistent partition for live USB media. Setting the size to 0 disables the persistent partition." +t MSG_126 "Set the partition size units." t MSG_150 "Type of computer you plan to use this bootable drive with. It is your responsibility to determine whether " "your target is of BIOS or UEFI type before you start creating the drive, as it may fail to boot otherwise." # You shouldn't translate 'Legacy Mode' as this is an option that usually appears in English in the UEFI settings. @@ -340,6 +353,8 @@ t MSG_169 "Create an extra hidden partition and try to align partitions boundari "This can improve boot detection for older BIOSes" t MSG_170 "Enable the listing of USB Hard Drive enclosures. USE AT YOUR OWN RISKS!!!" t MSG_171 "Start the formatting operation.\nThis will DESTROY any data on the target!" +# As of Rufus 3.2, *ALL* downloads from the servers are digitally signed, and their signature is validated using the +# public key that is embedded in the application. This message appears in an error dialog if the validation fails. t MSG_172 "Invalid download signature" t MSG_173 "Click to select..." t MSG_174 "Rufus - The Reliable USB Formatting Utility" @@ -437,6 +452,7 @@ t MSG_237 "Bad Blocks: Testing with pattern 0x%02X" # Example: "Partitioning (MBR)..." t MSG_238 "Partitioning (%s)..." t MSG_239 "Deleting partitions..." +# This message has to do with the signature validation that Rufus uses when downloading an update. t MSG_240 "The signature for the downloaded update can not be validated. This could mean that your " "system is improperly configured for signature validation or indicate a malicious download.\n\n" "The download will be deleted. Please check the log for more details." @@ -521,6 +537,8 @@ t MSG_303 "Show the log" t MSG_304 "Create a disk image of the selected device" t MSG_305 "Use this option to indicate whether you want to use this device to install Windows on another disk, " "or if you want to run Windows directly from this drive (Windows To Go)." +# You can see this status message by pressing -- and then selecting START. +# It's the same as MSG_286 but with a process that *may* be faster, hence the name. t MSG_306 "Fast-zeroing drive: %0.1f%% completed" ######################################################################### diff --git a/src/rufus.c b/src/rufus.c index ad188cc2..0300edf6 100644 --- a/src/rufus.c +++ b/src/rufus.c @@ -1625,8 +1625,8 @@ static void InitDialog(HWND hDlg) CreateTooltip(GetDlgItem(hDlg, IDS_CSM_HELP_TXT), lmprintf(MSG_151), 30000); CreateTooltip(GetDlgItem(hDlg, IDC_IMAGE_OPTION), lmprintf(MSG_305), 30000); CreateTooltip(GetDlgItem(hDlg, IDC_PERSISTENCE_SLIDER), lmprintf(MSG_125), 30000); - CreateTooltip(GetDlgItem(hDlg, IDC_PERSISTENCE_SIZE), lmprintf(MSG_126), 30000); - CreateTooltip(GetDlgItem(hDlg, IDC_PERSISTENCE_UNITS), lmprintf(MSG_127), 30000); + CreateTooltip(GetDlgItem(hDlg, IDC_PERSISTENCE_SIZE), lmprintf(MSG_125), 30000); + CreateTooltip(GetDlgItem(hDlg, IDC_PERSISTENCE_UNITS), lmprintf(MSG_126), 30000); if (!advanced_mode_device) // Hide as needed, since we display the advanced controls by default ToggleAdvancedDeviceOptions(FALSE); @@ -2050,7 +2050,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA lPos = (LONG)pos; SendMessage(GetDlgItem(hMainDialog, IDC_PERSISTENCE_SLIDER), TBM_SETPOS, TRUE, lPos); if (persistence_size >= (SelectedDrive.DiskSize - img_report.projected_size)) { - static_sprintf(tmp, "%d", lPos); + static_sprintf(tmp, "%ld", lPos); app_changed_size = TRUE; SetWindowTextU(GetDlgItem(hMainDialog, IDC_PERSISTENCE_SIZE), tmp); } @@ -2420,7 +2420,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA if (lPos != 0) { if (persistence_size == 0) TogglePersistenceControls(TRUE); - sprintf(tmp, "%ld", lPos); + static_sprintf(tmp, "%ld", lPos); } else { TogglePersistenceControls(FALSE); static_sprintf(tmp, "0 (%s)", lmprintf(MSG_124)); diff --git a/src/rufus.rc b/src/rufus.rc index 699419c9..0bcce8a8 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDD_DIALOG DIALOGEX 12, 12, 232, 326 STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_ACCEPTFILES -CAPTION "Rufus 3.2.1342" +CAPTION "Rufus 3.2.1343" FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP @@ -392,8 +392,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,2,1342,0 - PRODUCTVERSION 3,2,1342,0 + FILEVERSION 3,2,1343,0 + PRODUCTVERSION 3,2,1343,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -411,13 +411,13 @@ BEGIN VALUE "Comments", "https://akeo.ie" VALUE "CompanyName", "Akeo Consulting" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "3.2.1342" + VALUE "FileVersion", "3.2.1343" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2018 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "rufus-3.2.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "3.2.1342" + VALUE "ProductVersion", "3.2.1343" END END BLOCK "VarFileInfo"