From 9339c20ba8f3433ef23aa2483c7b5d475a842085 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Wed, 31 Jul 2013 01:43:02 +0100 Subject: [PATCH] [localization] localize messages, more French translations --- res/localization/rufus.loc | 205 ++++++++++++++++++++++++++++++++++--- src/.msvc/rufus.vcxproj | 4 + src/badblocks.c | 12 ++- src/drive.c | 5 +- src/format.c | 43 ++++---- src/iso.c | 2 +- src/localization.c | 2 +- src/localization_data.h | 100 ++++++++++++++++++ src/msapi_utf8.h | 9 ++ src/net.c | 16 +-- src/resource.h | 100 ++++++++++++++++++ src/rufus.c | 47 +++++---- src/rufus.h | 2 +- src/stdfn.c | 4 +- src/stdio.c | 20 +--- src/stdlg.c | 4 +- src/syslinux.c | 3 +- 17 files changed, 479 insertions(+), 99 deletions(-) diff --git a/res/localization/rufus.loc b/res/localization/rufus.loc index 4d326583..92f6bb27 100644 --- a/res/localization/rufus.loc +++ b/res/localization/rufus.loc @@ -10,30 +10,208 @@ t MSG_003 "WARNING: ALL DATA ON DEVICE '%s' WILL BE DESTROYED.\n" "To continue with this operation, click OK. To quit click CANCEL." t MSG_004 "Rufus update policy" t MSG_005 "Do you want to allow Rufus to check for application updates online?" +t MSG_006 "Close" # Must be the same as IDD_DIALOG:IDCANCEL (i.e. "Close" - I know it's confusing) +t MSG_007 "Cancel" + +# Status messages - these messages will appear on the status bar +t MSG_501 "Cancelling - Please wait..." +t MSG_502 "Scanning ISO image..." +t MSG_503 "Failed to scan ISO image" +# Parameter: the name of an obsolete Syslinux .c32 module. eg: "Obsolete vesamenu.c32 detected" +t MSG_504 "Obsolete %s detected" +# Display the name of the ISO selected. eg: "Using ISO: en_win7_x64_sp1.iso" +t MSG_505 "Using ISO: %s" +# Typically "Missing ldlinux.c32 file" +t MSG_506 "Missing %s file" +# Same message, once for singular and plural ("1 device found", "2 devices found") +t MSG_508 "%d device found" +t MSG_509 "%d devices found" +t MSG_510 "DONE" +t MSG_511 "Cancelled" +t MSG_512 "FAILED" +# Used when a new update has been downloaded and lauched +t MSG_513 "Launching new application..." +t MSG_514 "Failed to launch new application" +# Open/Save file +t MSG_515 "Opened %s" +t MSG_516 "Saved %s" +# Formatting status (make sure you use a double % to print the percent sign) +t MSG_517 "Formatting: %d%% completed" +t MSG_518 "Creating file system: Task %d/%d completed" +t MSG_519 "NTFS Fixup: %d%% completed" +t MSG_521 "Setting Label (This may take while)..." +# Parameter: the file system. eg. "Formatting (NTFS)..." +t MSG_522 "Formatting (%s)..." +t MSG_523 "NTFS Fixup (Checkdisk)..." +t MSG_524 "Clearing MBR/PBR/GPT structures..." +t MSG_525 "Requesting disk access..." +t MSG_526 "Analyzing existing boot records..." +t MSG_527 "Closing existing volume..." +t MSG_528 "Writing master boot record..." +t MSG_529 "Writing partition boot record..." +t MSG_530 "Copying DOS files..." +t MSG_531 "Copying ISO files..." +t MSG_532 "Win7 EFI boot setup (this may take a while)..." +t MSG_533 "Finalizing, please wait..." +# Takes the Syslinux version as paramete. eg. "Installing Syslinux v5..." +t MSG_534 "Installing Syslinux v%d..." +# Bad blocks status. eg: "Bad Blocks: PASS 1/2 - 12.34% (0/0/1 errors)" +t MSG_535 "Bad Blocks: PASS %d/%d - %0.2f%% (%d/%d/%d errors)" +t MSG_536 "Bad Blocks: Testing with random pattern" +t MSG_537 "Bad Blocks: Testing with pattern 0x%02X" +# eg. "Partitioning (MBR)..." +t MSG_538 "Partitioning (%s)..." +t MSG_539 "Deleting partitions..." +t MSG_540 "Downloading %s: Connecting..." +t MSG_541 "Downloading: %0.1f%%" +t MSG_542 "Failed to download file." +t MSG_543 "Checking for Rufus updates..." +t MSG_544 "Updates: Unable to connect to the internet" +t MSG_545 "Updates: Unable to acces version data" +t MSG_546 "A new version of Rufus is available!" +t MSG_547 "No new version of Rufus was found" +t MSG_548 "Application registry keys successfully deleted" +t MSG_549 "Failed to delete application registry keys" +# eg. "Fixed disk detection enabled" "ISO size check disabled" +t MSG_550 "%s enabled" +t MSG_551 "%s disabled" +t MSG_552 "Size checks" +t MSG_553 "Fixed disks detection" +t MSG_554 "Force large FAT32 formatting" +t MSG_555 "NoDriveTypeAutorun will be deleted on exit" +t MSG_556 "Fake drive detection" ################################################################################ l "French" 0x040c, 0x080c, 0x0c0c, 0x100c, 0x140c, 0x180c, 0x1c0c, 0x200c, 0x240c, 0x280c, 0x2c0c, 0x300c, 0x340c, 0x380c, 0xe40c s IDD_DIALOG -t IDS_FORMATOPTIONS_TXT "Options de Formattage " -t IDS_LABEL_TXT "Nouveau label" -t IDS_FILESYSTEM_TXT "Système de fichier" -t IDS_CLUSTERSIZE_TXT "Taille de clusters" t IDS_DEVICE_TXT "Periphérique" t IDS_PARTITION_TYPE_TXT "Type de partition et système de destination" +t IDS_FILESYSTEM_TXT "Système de fichier" +t IDS_CLUSTERSIZE_TXT "Taille de clusters" +t IDS_LABEL_TXT "Nouveau label" +t IDS_FORMATOPTIONS_TXT "Options de Formattage " t IDC_BADBLOCKS "Vérification de mauvais blocs:" t IDC_QUICKFORMAT "Formattage rapide" t IDC_BOOT "Disque de démarrage avec:" t IDC_SET_ICON "Ajouter un label étendu et une icône" m IDC_ADVANCED +36 0 +t IDC_ABOUT "A propos..." +t IDCANCEL "Fermer" +t IDC_START "Démarrer" +t IDC_ADVANCED_GROUP "Options avancées" +t IDC_ENABLE_FIXED_DISKS "Liste les disques fixes ou non partitionés" +t IDC_EXTRA_PARTITION "Options de compatibilité pour vieux BIOS" +t IDC_RUFUS_MBR "Rufus MBR avec ID BIOS:" + +s IDD_ABOUTBOX +t IDD_ABOUTBOX "A propos de Rufus" +t IDC_ABOUT_LICENSE "License" +t IDC_ABOUT_UPDATES "Mises à jour" + +s IDD_LICENSE +t IDD_LICENSE "License Rufus" + +s IDD_NOTIFICATION +t IDC_MORE_INFO "Plus d'info..." +t IDYES "Oui" +t IDNO "Non" + +s IDD_LOG +t IDC_LOG_CLEAR "Effacer" +t IDC_LOG_SAVE "Enregistrer" +t IDCANCEL "Fermer" + +s IDD_UPDATE_POLICY +t IDD_UPDATE_POLICY "Paramètres de mises à jour" +t IDS_UPDATE_SETTINGS_TXT "Options" +t IDS_UPDATE_FREQUENCY_TXT "Tester les mises à jour:" +t IDS_INCLUDE_BETAS_TXT "Inclure les bétas:" +t IDC_CHECK_NOW "Tester maintenant" +m IDC_CHECK_NOW -10,0 +r IDC_CHECK_NOW +20,0 +t IDCANCEL "Fermer" + +s IDD_NEW_VERSION +t IDD_NEW_VERSION "Test des mises à jour - Rufus" +t IDS_NEW_VERSION_AVAIL_TXT "Une nouvelle version est disponible. Veuillez télécharger la nouvelle version !" +t IDC_WEBSITE "Cliquez ici pour aller sur le site de Rufus" +t IDS_NEW_VERSION_NOTES_TXT "Notes pour cette version" +t IDS_NEW_VERSION_DOWNLOAD_TXT "Télécharger" +t IDC_DOWNLOAD ""Télécharger"" +t IDCANCEL "Fermer" + +s IDD_ISO_EXTRACT +t IDD_ISO_EXTRACT "Copie des fichier ISO..." +t IDC_ISO_FILENAME "Ouverture de l'image - veuillez patienter..." +t IDC_ISO_ABORT "Annuler" s IDD_MESSAGES +# éèêàç t MSG_001 "Autre instance detectée" t MSG_002 "Une autre instance de Rufus est en cours d'exécution.\n" "Veuillez fermer la première instance avant d'en lancer une seconde." -t MSG_003 "ATTENTION: TOUTES LES DONNEES SUR LE VOLUME '%s' VONT ETRE EFFACEES.\n" +t MSG_003 "ATTENTION: TOUTES LES DONNEES DU VOLUME '%s' VONT ETRE EFFACEES.\n" "Pour continuer cette operation, cliquez sur OK.\nPour quitter cliquez sur ANNULER." t MSG_004 "Mises à jour" t MSG_005 "Voulez-vous authoriser Rufus à chercher des mises à jour en ligne?" +t MSG_006 "Fermer" +t MSG_007 "Annuler" + +# Status messages +t MSG_501 "Annulation - Veuillez patienter..." +t MSG_502 "Analyse de l'image ISO..." +t MSG_503 "Echec d'analyse de l'image ISO" +t MSG_504 "Fichier %s obsolète detecté" +t MSG_505 "ISO utilisée: %s" +t MSG_506 "Fichier %s manquant" +t MSG_508 "%d périphérique détecté" +t MSG_509 "%d périphériques détectés" +t MSG_510 "Opération terminée" +t MSG_511 "Opération annulée" +t MSG_512 "ECHEC" +t MSG_513 "Lancement de la nouvelle application..." +t MSG_514 "Echec de lancement de l'application" +t MSG_515 "%s ouvert" +t MSG_516 "%s sauvegardé" +t MSG_517 "Formatage: %d%% complet" +t MSG_518 "Création du système: Tache %d/%d complète" +t MSG_519 "Finalisation NTFS: %d%% complète" +t MSG_521 "Ecriture du label (peut prendre du temps)..." +t MSG_522 "Formatage (%s)..." +t MSG_523 "Finalisation NTFS (Checkdisk)..." +t MSG_524 "Effacement des structures MBR/PBR/GPT..." +t MSG_525 "Requête d'accès disque..." +t MSG_526 "Analyse des structures de boot existantes..." +t MSG_527 "Fermeture des volumes existants..." +t MSG_528 "Ecriture du MBR..." +t MSG_529 "Ecriture du PBR..." +t MSG_530 "Copie des fichiers DOS..." +t MSG_531 "Copie des fichiers ISO..." +t MSG_532 "Ecriture boot Win7 EFI (peut prendre du temps)..." +t MSG_533 "Finalisation, veuillez patienter..." +t MSG_534 "Installation de Syslinux v%d..." +t MSG_535 "Défauts: PASSE %d/%d - %0.2f%% (%d/%d/%d erreurs)" +t MSG_536 "Défauts: Test avec motif aléatoire" +t MSG_537 "Défauts: Test avec motif 0x%02X" +t MSG_538 "Partitionage (%s)..." +t MSG_539 "Effaçement des partitions..." +t MSG_540 "Télechargement de %s: Connection..." +t MSG_541 "Télechargement: %0.1f%%" +t MSG_542 "Echec de télechargement du fichier" +t MSG_543 "Recherche des mises à jour..." +t MSG_544 "MAJ: Impossible de se connecter" +t MSG_545 "MAJ: Pas d'accès aux données de mises à jour" +t MSG_546 "Une nouvelle version de Rufus est disponible !" +t MSG_547 "Pas de mise à jour" +t MSG_548 "Clés registres supprimées" +t MSG_549 "Echec de suppression des clés registres" +t MSG_550 "%s activé" +t MSG_551 "%s désactivé" +t MSG_552 "Tests de dépassement de taille" +t MSG_553 "Détection de disques fixes" +t MSG_554 "Force 'large FAT32'" +t MSG_555 "NoDriveTypeAutorun sera effacé en sortie" +t MSG_556 "Test de contrefaçons" ################################################################################ l "Chinese (Traditional)" 0x0404, 0x0804, 0x0c04, 0x1004, 0x1404 @@ -70,11 +248,6 @@ t IDC_ABOUT_LICENSE "许可证" t IDC_ABOUT_UPDATES "更新" t IDOK "确定" -s IDD_ISO_EXTRACT -t IDD_ISO_EXTRACT "复制ISO文件..." -t IDC_ISO_FILENAME "打开ISO映像 - 请稍候..." -t IDC_ISO_ABORT "取消" - s IDD_LICENSE t IDD_LICENSE "Rufus 许可证" t IDOK "取消" @@ -110,11 +283,13 @@ t IDS_NEW_VERSION_DOWNLOAD_TXT "下载" t IDC_DOWNLOAD "下载" t IDCANCEL "取消" +s IDD_ISO_EXTRACT +t IDD_ISO_EXTRACT "复制ISO文件..." +t IDC_ISO_FILENAME "打开ISO映像 - 请稍候..." +t IDC_ISO_ABORT "取消" + s IDD_MESSAGES -t MSG_001 "Other instance detected" -t MSG_002 "Another Rufus application is running.\n" - "Please close the first application before running another one." -t MSG_003 "WARNING: ALL DATA ON DEVICE '%s' WILL BE DESTROYED.\n" - "To continue with this operation, click OK. To quit click CANCEL." t MSG_004 "更新方案和设置" t MSG_005 "你要允許此應用程序檢查更新?" +t MSG_006 "关闭" +t MSG_007 "撤消" diff --git a/src/.msvc/rufus.vcxproj b/src/.msvc/rufus.vcxproj index 059fa5c2..333bb3fa 100644 --- a/src/.msvc/rufus.vcxproj +++ b/src/.msvc/rufus.vcxproj @@ -87,6 +87,7 @@ ..\msvc-missing;..\ms-sys\inc;..\syslinux\libinstaller;..\syslinux\libfat;..\libcdio;..\getopt;%(AdditionalIncludeDirectories) CompileAsC true + false setupapi.lib;comctl32.lib;wininet.lib;%(AdditionalDependencies) @@ -113,6 +114,7 @@ ProgramDatabase CompileAsC true + false setupapi.lib;comctl32.lib;wininet.lib;%(AdditionalDependencies) @@ -135,6 +137,7 @@ ..\msvc-missing;..\ms-sys\inc;..\syslinux\libinstaller;..\syslinux\libfat;..\libcdio;..\getopt;%(AdditionalIncludeDirectories) CompileAsC true + false setupapi.lib;comctl32.lib;wininet.lib;%(AdditionalDependencies) @@ -160,6 +163,7 @@ ..\msvc-missing;..\ms-sys\inc;..\syslinux\libinstaller;..\syslinux\libfat;..\libcdio;..\getopt;%(AdditionalIncludeDirectories) CompileAsC true + false setupapi.lib;comctl32.lib;wininet.lib;%(AdditionalDependencies) diff --git a/src/badblocks.c b/src/badblocks.c index b7d27334..0f71480b 100644 --- a/src/badblocks.c +++ b/src/badblocks.c @@ -45,6 +45,8 @@ #include "badblocks.h" #include "file.h" #include "msapi_utf8.h" +#include "resource.h" +#include "localization.h" FILE* log_fd = NULL; static const char* abort_msg = "Too many bad blocks, aborting test\n"; @@ -326,12 +328,12 @@ static void print_status(void) percent = calc_percent((unsigned long) currently_testing, (unsigned long) num_blocks); percent = (percent/2.0f) + ((cur_op==OP_READ)? 50.0f : 0.0f); - PrintStatus(0, FALSE, "Bad Blocks: PASS %d/%d - %0.2f%% (%d/%d/%d errors)", + PrintStatus(0, FALSE, lmprintf(MSG_535, cur_pattern, nr_pattern, - percent, + percent, num_read_errors, num_write_errors, - num_corruption_errors); + num_corruption_errors)); UpdateProgress(OP_BADBLOCKS, (((cur_pattern-1)*100.0f) + percent) / nr_pattern); } @@ -357,7 +359,7 @@ static void pattern_fill(unsigned char *buffer, unsigned int pattern, for (ptr = buffer; ptr < buffer + n; ptr++) { (*ptr) = rand() % (1 << (8 * sizeof(char))); } - PrintStatus(3500, FALSE, "Bad Blocks: Testing with random pattern."); + PrintStatus(3500, FALSE, lmprintf(MSG_536)); } else { bpattern[0] = 0; for (i = 0; i < sizeof(bpattern); i++) { @@ -374,7 +376,7 @@ static void pattern_fill(unsigned char *buffer, unsigned int pattern, else i--; } - PrintStatus(3500, FALSE, "Bad Blocks: Testing with pattern 0x%02X.", bpattern[i]); + PrintStatus(3500, FALSE, lmprintf(MSG_537, bpattern[i])); cur_pattern++; } } diff --git a/src/drive.c b/src/drive.c index 90368da8..63a3f49f 100644 --- a/src/drive.c +++ b/src/drive.c @@ -30,6 +30,7 @@ #include "rufus.h" #include "resource.h" #include "sys_types.h" +#include "localization.h" /* * Globals @@ -625,7 +626,7 @@ BOOL CreatePartition(HANDLE hDrive, int partition_style, int file_system, BOOL m DWORD size; LONGLONG size_in_sectors; - PrintStatus(0, TRUE, "Partitioning (%s)...", PartitionTypeName[partition_style]); + PrintStatus(0, TRUE, lmprintf(MSG_538, PartitionTypeName[partition_style])); if ((partition_style == PARTITION_STYLE_GPT) || (!IsChecked(IDC_EXTRA_PARTITION))) { // Go with the MS 1 MB wastage at the beginning... @@ -772,7 +773,7 @@ BOOL DeletePartitions(HANDLE hDrive) DWORD size; CREATE_DISK CreateDisk = {PARTITION_STYLE_RAW, {{0}}}; - PrintStatus(0, TRUE, "Deleting partitions..."); + PrintStatus(0, TRUE, lmprintf(MSG_539)); size = sizeof(CreateDisk); r = DeviceIoControl(hDrive, IOCTL_DISK_CREATE_DISK, diff --git a/src/format.c b/src/format.c index c24a225d..4996fdcd 100644 --- a/src/format.c +++ b/src/format.c @@ -43,6 +43,7 @@ #include "file.h" #include "format.h" #include "badblocks.h" +#include "localization.h" /* * Globals @@ -67,16 +68,16 @@ static BOOLEAN __stdcall FormatExCallback(FILE_SYSTEM_CALLBACK_COMMAND Command, switch(Command) { case FCC_PROGRESS: percent = (DWORD*)pData; - PrintStatus(0, FALSE, "Formatting: %d%% completed.", *percent); + PrintStatus(0, FALSE, lmprintf(MSG_517, *percent)); UpdateProgress(OP_FORMAT, 1.0f * (*percent)); break; case FCC_STRUCTURE_PROGRESS: // No progress on quick format - PrintStatus(0, TRUE, "Creating file system: Task %d/%d completed.", ++task_number, nb_steps[fs_index]); + PrintStatus(0, TRUE, lmprintf(MSG_518, ++task_number, nb_steps[fs_index])); format_percent += 100.0f / (1.0f * nb_steps[fs_index]); UpdateProgress(OP_CREATE_FS, format_percent); break; case FCC_DONE: - PrintStatus(0, TRUE, "Creating file system: Task %d/%d completed.", nb_steps[fs_index], nb_steps[fs_index]); + PrintStatus(0, TRUE, lmprintf(MSG_518, nb_steps[fs_index], nb_steps[fs_index])); UpdateProgress(OP_CREATE_FS, 100.0f); if(*(BOOLEAN*)pData == FALSE) { uprintf("Error while formatting.\n"); @@ -151,7 +152,7 @@ static BOOLEAN __stdcall ChkdskCallback(FILE_SYSTEM_CALLBACK_COMMAND Command, DW case FCC_PROGRESS: case FCC_CHECKDISK_PROGRESS: percent = (DWORD*)pData; - PrintStatus(0, FALSE, "NTFS Fixup: %d%% completed.", *percent); + PrintStatus(0, FALSE, lmprintf(MSG_519, *percent)); break; case FCC_DONE: if(*(BOOLEAN*)pData == FALSE) { @@ -364,7 +365,8 @@ static BOOL FormatFAT32(DWORD DriveIndex) // Debug temp vars ULONGLONG FatNeeded, ClusterCount; - PrintStatus(0, TRUE, "Formatting (Large FAT32)..."); + // TODO: use another lmsg for Large FAT32 + PrintStatus(0, TRUE, lmprintf(MSG_522, "Large FAT32")); VolumeId = GetVolumeID(); // Open the drive and lock it @@ -549,7 +551,7 @@ static BOOL FormatFAT32(DWORD DriveIndex) format_percent = 0.0f; for (i=0; i<(SystemAreaSize+BurstSize-1); i+=BurstSize) { format_percent = (100.0f*i)/(1.0f*(SystemAreaSize+BurstSize)); - PrintStatus(0, FALSE, "Formatting: %d%% completed.", (int)format_percent); + PrintStatus(0, FALSE, lmprintf(MSG_517, (int)format_percent)); UpdateProgress(OP_FORMAT, format_percent); if (IS_ERROR(FormatStatus)) goto out; // For cancellation if (write_sectors(hLogicalVolume, BytesPerSect, i, BurstSize, pZeroSect) != (BytesPerSect*BurstSize)) { @@ -575,7 +577,7 @@ static BOOL FormatFAT32(DWORD DriveIndex) // Set the FAT32 volume label GetWindowTextW(hLabel, wLabel, ARRAYSIZE(wLabel)); ToValidLabel(wLabel, TRUE); - PrintStatus(0, TRUE, "Setting Label (This may take while)..."); + PrintStatus(0, TRUE, lmprintf(MSG_521)); // Handle must be closed for SetVolumeLabel to work safe_closehandle(hLogicalVolume); VolumeName = GetLogicalName(DriveIndex, TRUE, TRUE); @@ -606,7 +608,7 @@ static BOOL FormatDrive(DWORD DriveIndex) { BOOL r = FALSE; PF_DECL(FormatEx); - char FSType[32], format_status[64]; + char FSType[32]; char *locale, *VolumeName = NULL; WCHAR* wVolumeName = NULL; WCHAR wFSType[32]; @@ -615,8 +617,7 @@ static BOOL FormatDrive(DWORD DriveIndex) size_t i; GetWindowTextA(hFileSystem, FSType, ARRAYSIZE(FSType)); - safe_sprintf(format_status, ARRAYSIZE(format_status), "Formatting (%s)...", FSType); - PrintStatus(0, TRUE, format_status); + PrintStatus(0, TRUE, lmprintf(MSG_522, FSType)); VolumeName = GetLogicalName(DriveIndex, FALSE, TRUE); wVolumeName = utf8_to_wchar(VolumeName); if (wVolumeName == NULL) { @@ -678,7 +679,7 @@ static BOOL CheckDisk(char DriveLetter) size_t i; wDriveRoot[0] = (WCHAR)DriveLetter; - PrintStatus(0, TRUE, "NTFS Fixup (Checkdisk)..."); + PrintStatus(0, TRUE, lmprintf(MSG_523)); PF_INIT_OR_OUT(Chkdsk, fmifs); @@ -770,7 +771,7 @@ static BOOL ClearMBRGPT(HANDLE hPhysicalDrive, LONGLONG DiskSize, DWORD SectorSi uint64_t i, last_sector = DiskSize/SectorSize; unsigned char* pBuf = (unsigned char*) calloc(SectorSize, 1); - PrintStatus(0, TRUE, "Clearing MBR/PBR/GPT structures..."); + PrintStatus(0, TRUE, lmprintf(MSG_524)); if (pBuf == NULL) { FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_NOT_ENOUGH_MEMORY; goto out; @@ -1173,7 +1174,7 @@ DWORD WINAPI FormatThread(LPVOID param) pt = GETPARTTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme))); bt = GETBIOSTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme))); - PrintStatus(0, TRUE, "Requesting disk access...\n"); + PrintStatus(0, TRUE, lmprintf(MSG_525)); hPhysicalDrive = GetPhysicalHandle(DriveIndex, TRUE, TRUE); if (hPhysicalDrive == INVALID_HANDLE_VALUE) { FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_OPEN_FAILED; @@ -1210,7 +1211,7 @@ DWORD WINAPI FormatThread(LPVOID param) } CHECK_FOR_USER_CANCEL; - PrintStatus(0, TRUE, "Analyzing existing boot records...\n"); + PrintStatus(0, TRUE, lmprintf(MSG_526)); AnalyzeMBR(hPhysicalDrive); if ((hLogicalVolume != NULL) && (hLogicalVolume != INVALID_HANDLE_VALUE)) { AnalyzePBR(hLogicalVolume); @@ -1286,7 +1287,7 @@ DWORD WINAPI FormatThread(LPVOID param) } // Close the (unmounted) volume before formatting if ((hLogicalVolume != NULL) && (hLogicalVolume != INVALID_HANDLE_VALUE)) { - PrintStatus(0, TRUE, "Closing existing volume...\n"); + PrintStatus(0, TRUE, lmprintf(MSG_527)); if (!CloseHandle(hLogicalVolume)) { uprintf("Could not close volume: %s\n", WindowsErrorString()); FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_ACCESS_DENIED; @@ -1333,7 +1334,7 @@ DWORD WINAPI FormatThread(LPVOID param) // Thanks to Microsoft, we must fix the MBR AFTER the drive has been formatted if (pt == PARTITION_STYLE_MBR) { - PrintStatus(0, TRUE, "Writing master boot record..."); + PrintStatus(0, TRUE, lmprintf(MSG_528)); if (!WriteMBR(hPhysicalDrive)) { if (!IS_ERROR(FormatStatus)) FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_WRITE_FAULT; @@ -1380,7 +1381,7 @@ DWORD WINAPI FormatThread(LPVOID param) } // NB: if you unmount the logical volume here, XP will report error: // [0x00000456] The media in the drive may have changed - PrintStatus(0, TRUE, "Writing partition boot record..."); + PrintStatus(0, TRUE, lmprintf(MSG_529)); if (!WritePBR(hLogicalVolume)) { if (!IS_ERROR(FormatStatus)) FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_WRITE_FAULT; @@ -1409,7 +1410,7 @@ DWORD WINAPI FormatThread(LPVOID param) if (IsChecked(IDC_BOOT)) { if ((dt == DT_WINME) || (dt == DT_FREEDOS)) { UpdateProgress(OP_DOS, -1.0f); - PrintStatus(0, TRUE, "Copying DOS files..."); + PrintStatus(0, TRUE, lmprintf(MSG_530)); if (!ExtractDOS(drive_name)) { if (!IS_ERROR(FormatStatus)) FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_CANNOT_COPY; @@ -1418,7 +1419,7 @@ DWORD WINAPI FormatThread(LPVOID param) } else if (dt == DT_ISO) { if (iso_path != NULL) { UpdateProgress(OP_DOS, 0.0f); - PrintStatus(0, TRUE, "Copying ISO files..."); + PrintStatus(0, TRUE, lmprintf(MSG_531)); drive_name[2] = 0; if (!ExtractISO(iso_path, drive_name, FALSE)) { if (!IS_ERROR(FormatStatus)) @@ -1427,7 +1428,7 @@ DWORD WINAPI FormatThread(LPVOID param) } if ((bt == BT_UEFI) && (!iso_report.has_efi) && (iso_report.has_win7_efi)) { // TODO: (v1.3.4) check ISO with EFI only - PrintStatus(0, TRUE, "Win7 EFI boot setup (this may take a while)..."); + PrintStatus(0, TRUE, lmprintf(MSG_532)); wim_image[0] = drive_name[0]; efi_dst[0] = drive_name[0]; efi_dst[sizeof(efi_dst) - sizeof("\\bootx64.efi")] = 0; @@ -1450,7 +1451,7 @@ DWORD WINAPI FormatThread(LPVOID param) } } UpdateProgress(OP_FINALIZE, -1.0f); - PrintStatus(0, TRUE, "Finalizing, please wait..."); + PrintStatus(0, TRUE, lmprintf(MSG_533)); if (IsChecked(IDC_SET_ICON)) SetAutorun(drive_name); // Issue another complete remount before we exit, to ensure we're clean diff --git a/src/iso.c b/src/iso.c index 0086fea1..8a5f7456 100644 --- a/src/iso.c +++ b/src/iso.c @@ -492,7 +492,7 @@ out: iso_blocking_status = -1; if (scan_only) { // Remove trailing spaces from the label - for (j=(int)safe_strlen(iso_report.label)-1; ((j>=0)&&(isspace(iso_report.label[j]))); j--) + for (j=(int)safe_strlen(iso_report.label)-1; ((j>=0)&&(isspaceU(iso_report.label[j]))); j--) iso_report.label[j] = 0; // We use the fact that UDF_BLOCKSIZE and ISO_BLOCKSIZE are the same here iso_report.projected_size = total_blocks * ISO_BLOCKSIZE; diff --git a/src/localization.c b/src/localization.c index a071c48a..fc3afe93 100644 --- a/src/localization.c +++ b/src/localization.c @@ -301,7 +301,7 @@ char* lmprintf(int msg_id, ...) } if (format == NULL) { - safe_sprintf(buf[buf_id], 2047, "MSG_%03d UNTRANSLATED", msg_id); + safe_sprintf(buf[buf_id], 2047, "MSG_%03d UNTRANSLATED", msg_id - MSG_000); } else { va_start(args, msg_id); safe_vsnprintf(buf[buf_id], 2047, format, args); diff --git a/src/localization_data.h b/src/localization_data.h index f9db8cda..4140ba57 100644 --- a/src/localization_data.h +++ b/src/localization_data.h @@ -197,6 +197,106 @@ const loc_control_id control_id[] = { LOC_CTRL(MSG_097), LOC_CTRL(MSG_098), LOC_CTRL(MSG_099), + LOC_CTRL(MSG_500), + LOC_CTRL(MSG_501), + LOC_CTRL(MSG_502), + LOC_CTRL(MSG_503), + LOC_CTRL(MSG_504), + LOC_CTRL(MSG_505), + LOC_CTRL(MSG_506), + LOC_CTRL(MSG_507), + LOC_CTRL(MSG_508), + LOC_CTRL(MSG_509), + LOC_CTRL(MSG_510), + LOC_CTRL(MSG_511), + LOC_CTRL(MSG_512), + LOC_CTRL(MSG_513), + LOC_CTRL(MSG_514), + LOC_CTRL(MSG_515), + LOC_CTRL(MSG_516), + LOC_CTRL(MSG_517), + LOC_CTRL(MSG_518), + LOC_CTRL(MSG_519), + LOC_CTRL(MSG_520), + LOC_CTRL(MSG_521), + LOC_CTRL(MSG_522), + LOC_CTRL(MSG_523), + LOC_CTRL(MSG_524), + LOC_CTRL(MSG_525), + LOC_CTRL(MSG_526), + LOC_CTRL(MSG_527), + LOC_CTRL(MSG_528), + LOC_CTRL(MSG_529), + LOC_CTRL(MSG_530), + LOC_CTRL(MSG_531), + LOC_CTRL(MSG_532), + LOC_CTRL(MSG_533), + LOC_CTRL(MSG_534), + LOC_CTRL(MSG_535), + LOC_CTRL(MSG_536), + LOC_CTRL(MSG_537), + LOC_CTRL(MSG_538), + LOC_CTRL(MSG_539), + LOC_CTRL(MSG_540), + LOC_CTRL(MSG_541), + LOC_CTRL(MSG_542), + LOC_CTRL(MSG_543), + LOC_CTRL(MSG_544), + LOC_CTRL(MSG_545), + LOC_CTRL(MSG_546), + LOC_CTRL(MSG_547), + LOC_CTRL(MSG_548), + LOC_CTRL(MSG_549), + LOC_CTRL(MSG_550), + LOC_CTRL(MSG_551), + LOC_CTRL(MSG_552), + LOC_CTRL(MSG_553), + LOC_CTRL(MSG_554), + LOC_CTRL(MSG_555), + LOC_CTRL(MSG_556), + LOC_CTRL(MSG_557), + LOC_CTRL(MSG_558), + LOC_CTRL(MSG_559), + LOC_CTRL(MSG_560), + LOC_CTRL(MSG_561), + LOC_CTRL(MSG_562), + LOC_CTRL(MSG_563), + LOC_CTRL(MSG_564), + LOC_CTRL(MSG_565), + LOC_CTRL(MSG_566), + LOC_CTRL(MSG_567), + LOC_CTRL(MSG_568), + LOC_CTRL(MSG_569), + LOC_CTRL(MSG_570), + LOC_CTRL(MSG_571), + LOC_CTRL(MSG_572), + LOC_CTRL(MSG_573), + LOC_CTRL(MSG_574), + LOC_CTRL(MSG_575), + LOC_CTRL(MSG_576), + LOC_CTRL(MSG_577), + LOC_CTRL(MSG_578), + LOC_CTRL(MSG_579), + LOC_CTRL(MSG_580), + LOC_CTRL(MSG_581), + LOC_CTRL(MSG_582), + LOC_CTRL(MSG_583), + LOC_CTRL(MSG_584), + LOC_CTRL(MSG_585), + LOC_CTRL(MSG_586), + LOC_CTRL(MSG_587), + LOC_CTRL(MSG_588), + LOC_CTRL(MSG_589), + LOC_CTRL(MSG_590), + LOC_CTRL(MSG_591), + LOC_CTRL(MSG_592), + LOC_CTRL(MSG_593), + LOC_CTRL(MSG_594), + LOC_CTRL(MSG_595), + LOC_CTRL(MSG_596), + LOC_CTRL(MSG_597), + LOC_CTRL(MSG_598), + LOC_CTRL(MSG_599), LOC_CTRL(IDOK), LOC_CTRL(IDCANCEL), LOC_CTRL(IDABORT), diff --git a/src/msapi_utf8.h b/src/msapi_utf8.h index ef219b6a..4a0d1ea9 100644 --- a/src/msapi_utf8.h +++ b/src/msapi_utf8.h @@ -54,6 +54,15 @@ extern "C" { _ms_wlvi.pszText = utf8_to_wchar(pszText_); \ SNDMSG((hwndLV),LVM_SETITEMTEXTW,(WPARAM)(i),(LPARAM)&_ms_wlvi); sfree(_ms_wlvi.pszText);} +// Never ever use isdigit() or isspace(), etc. on UTF-8 strings! +// These calls take an int and char is signed so MS compilers will produce an assert error on anything that's > 0x80 +#define isasciiU(c) isascii((unsigned char)(c)) +#define iscntrlU(c) iscntrl((unsigned char)(c)) +#define isdigitU(c) isdigit((unsigned char)(c)) +#define isspaceU(c) isspace((unsigned char)(c)) +#define isxdigitU(c) isxdigit((unsigned char)(c)) +// NB: other issomething() calls are not implemented as they may require multibyte UTF-8 sequences to be converted + #define sfree(p) do {if (p != NULL) {free((void*)(p)); p = NULL;}} while(0) #define wconvert(p) wchar_t* w ## p = utf8_to_wchar(p) #define walloc(p, size) wchar_t* w ## p = (wchar_t*)calloc(size, sizeof(wchar_t)) diff --git a/src/net.c b/src/net.c index ccbe207d..2c0c7f97 100644 --- a/src/net.c +++ b/src/net.c @@ -34,6 +34,7 @@ #include "rufus.h" #include "registry.h" #include "resource.h" +#include "localization.h" /* Maximum download chunk size, in bytes */ #define DOWNLOAD_BUFFER_SIZE 10240 @@ -263,7 +264,7 @@ BOOL DownloadFile(const char* url, const char* file, HWND hProgressDialog) SendMessage(hProgressDialog, UM_ISO_INIT, 0, 0); } - PrintStatus(0, FALSE, "Downloading %s: Connecting...\n", file); + PrintStatus(0, FALSE, lmprintf(MSG_540, file)); uprintf("Downloading %s from %s\n", file, url); if (!InternetCrackUrlA(url, (DWORD)safe_strlen(url), 0, &UrlParts)) { @@ -340,7 +341,7 @@ BOOL DownloadFile(const char* url, const char* file, HWND hProgressDialog) break; dwSize += dwDownloaded; SendMessage(hProgressBar, PBM_SETPOS, (WPARAM)(MAX_PROGRESS*((1.0f*dwSize)/(1.0f*dwTotalSize))), 0); - PrintStatus(0, FALSE, "Downloading: %0.1f%%\n", (100.0f*dwSize)/(1.0f*dwTotalSize)); + PrintStatus(0, FALSE, lmprintf(MSG_541, (100.0f*dwSize)/(1.0f*dwTotalSize))); if (fwrite(buf, 1, dwDownloaded, fd) != dwDownloaded) { uprintf("Error writing file '%s': %s\n", file, WinInetErrorString()); goto out; @@ -362,7 +363,7 @@ out: if (fd != NULL) fclose(fd); if (!r) { _unlink(file); - PrintStatus(0, FALSE, "Failed to download file."); + PrintStatus(0, FALSE, lmprintf(MSG_542)); SetLastError(error_code); MessageBoxU(hMainDialog, IS_ERROR(FormatStatus)?StrError(FormatStatus):WinInetErrorString(), "File download", MB_OK|MB_ICONERROR); @@ -456,7 +457,7 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param) } } - PrintStatus(3000, TRUE, "Checking for " APPLICATION_NAME " updates...\n"); + PrintStatus(3000, TRUE, lmprintf(MSG_543)); status++; // 1 if (!GetVersionExA(&os_version)) { @@ -600,15 +601,14 @@ out: if (hSession) InternetCloseHandle(hSession); switch(status) { case 1: - PrintStatus(3000, TRUE, "Updates: Unable to connect to the internet.\n"); + PrintStatus(3000, TRUE, lmprintf(MSG_544)); break; case 2: - PrintStatus(3000, TRUE, "Updates: Unable to access version data.\n"); + PrintStatus(3000, TRUE, lmprintf(MSG_545)); break; case 3: case 4: - PrintStatus(3000, FALSE, "%s new version of " APPLICATION_NAME " %s\n", - found_new_version?"A":"No", found_new_version?"is available!":"was found."); + PrintStatus(3000, FALSE, lmprintf(found_new_version?MSG_546:MSG_547)); default: break; } diff --git a/src/resource.h b/src/resource.h index 98856f5b..f8bb096d 100644 --- a/src/resource.h +++ b/src/resource.h @@ -208,6 +208,106 @@ #define MSG_097 3097 #define MSG_098 3098 #define MSG_099 3099 +#define MSG_500 3500 +#define MSG_501 3501 +#define MSG_502 3502 +#define MSG_503 3503 +#define MSG_504 3504 +#define MSG_505 3505 +#define MSG_506 3506 +#define MSG_507 3507 +#define MSG_508 3508 +#define MSG_509 3509 +#define MSG_510 3510 +#define MSG_511 3511 +#define MSG_512 3512 +#define MSG_513 3513 +#define MSG_514 3514 +#define MSG_515 3515 +#define MSG_516 3516 +#define MSG_517 3517 +#define MSG_518 3518 +#define MSG_519 3519 +#define MSG_520 3520 +#define MSG_521 3521 +#define MSG_522 3522 +#define MSG_523 3523 +#define MSG_524 3524 +#define MSG_525 3525 +#define MSG_526 3526 +#define MSG_527 3527 +#define MSG_528 3528 +#define MSG_529 3529 +#define MSG_530 3530 +#define MSG_531 3531 +#define MSG_532 3532 +#define MSG_533 3533 +#define MSG_534 3534 +#define MSG_535 3535 +#define MSG_536 3536 +#define MSG_537 3537 +#define MSG_538 3538 +#define MSG_539 3539 +#define MSG_540 3540 +#define MSG_541 3541 +#define MSG_542 3542 +#define MSG_543 3543 +#define MSG_544 3544 +#define MSG_545 3545 +#define MSG_546 3546 +#define MSG_547 3547 +#define MSG_548 3548 +#define MSG_549 3549 +#define MSG_550 3550 +#define MSG_551 3551 +#define MSG_552 3552 +#define MSG_553 3553 +#define MSG_554 3554 +#define MSG_555 3555 +#define MSG_556 3556 +#define MSG_557 3557 +#define MSG_558 3558 +#define MSG_559 3559 +#define MSG_560 3560 +#define MSG_561 3561 +#define MSG_562 3562 +#define MSG_563 3563 +#define MSG_564 3564 +#define MSG_565 3565 +#define MSG_566 3566 +#define MSG_567 3567 +#define MSG_568 3568 +#define MSG_569 3569 +#define MSG_570 3570 +#define MSG_571 3571 +#define MSG_572 3572 +#define MSG_573 3573 +#define MSG_574 3574 +#define MSG_575 3575 +#define MSG_576 3576 +#define MSG_577 3577 +#define MSG_578 3578 +#define MSG_579 3579 +#define MSG_580 3580 +#define MSG_581 3581 +#define MSG_582 3582 +#define MSG_583 3583 +#define MSG_584 3584 +#define MSG_585 3585 +#define MSG_586 3586 +#define MSG_587 3587 +#define MSG_588 3588 +#define MSG_589 3589 +#define MSG_590 3590 +#define MSG_591 3591 +#define MSG_592 3592 +#define MSG_593 3593 +#define MSG_594 3594 +#define MSG_595 3595 +#define MSG_596 3596 +#define MSG_597 3597 +#define MSG_598 3598 +#define MSG_599 3599 // Next default values for new objects // diff --git a/src/rufus.c b/src/rufus.c index b3b2f6e9..b162b302 100644 --- a/src/rufus.c +++ b/src/rufus.c @@ -870,7 +870,7 @@ static void EnableControls(BOOL bEnable) EnableWindow(GetDlgItem(hMainDialog, IDC_SET_ICON), bEnable); EnableWindow(GetDlgItem(hMainDialog, IDC_ADVANCED), bEnable); EnableWindow(GetDlgItem(hMainDialog, IDC_ENABLE_FIXED_DISKS), bEnable); - SetDlgItemTextU(hMainDialog, IDCANCEL, bEnable?"Close":"Cancel"); + SetDlgItemTextU(hMainDialog, IDCANCEL, lmprintf(bEnable?MSG_006:MSG_007)); } /* Callback for the log window */ @@ -1008,7 +1008,7 @@ BOOL CALLBACK ISOProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) switch (LOWORD(wParam)) { case IDC_ISO_ABORT: FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_CANCELLED; - PrintStatus(0, FALSE, "Cancelling - Please wait..."); + PrintStatus(0, FALSE, lmprintf(MSG_501)); uprintf("Cancelling (from ISO proc.)\n"); EnableWindow(GetDlgItem(hISOProgressDlg, IDC_ISO_ABORT), FALSE); if (format_thid != NULL) @@ -1036,10 +1036,10 @@ DWORD WINAPI ISOScanThread(LPVOID param) if (iso_path == NULL) goto out; - PrintStatus(0, TRUE, "Scanning ISO image...\n"); + PrintStatus(0, TRUE, lmprintf(MSG_502)); if (!ExtractISO(iso_path, "", TRUE)) { SendMessage(hISOProgressDlg, UM_ISO_EXIT, 0, 0); - PrintStatus(0, TRUE, "Failed to scan ISO image."); + PrintStatus(0, TRUE, lmprintf(MSG_503)); safe_free(iso_path); goto out; } @@ -1070,7 +1070,7 @@ DWORD WINAPI ISOScanThread(LPVOID param) fclose(fd); use_own_c32[i] = TRUE; } else { - PrintStatus(0, FALSE, "Obsolete %s detected", old_c32_name[i]); + PrintStatus(0, FALSE, lmprintf(MSG_504, old_c32_name[i])); safe_sprintf(msgbox, sizeof(msgbox), "This ISO image seems to use an obsolete version of '%s'.\n" "Boot menus may not may not display properly because of this.\n\n" "A newer version can be downloaded by " APPLICATION_NAME " to fix this issue:\n" @@ -1095,7 +1095,7 @@ DWORD WINAPI ISOScanThread(LPVOID param) SetFSFromISO(); SetMBRProps(); for (i=(int)safe_strlen(iso_path); (i>0)&&(iso_path[i]!='\\'); i--); - PrintStatus(0, TRUE, "Using ISO: %s\n", &iso_path[i+1]); + PrintStatus(0, TRUE, lmprintf(MSG_505, &iso_path[i+1])); // Some Linux distros, such as Arch Linux, require the USB drive to have // a specific label => copy the one we got from the ISO image if (iso_report.label[0] != 0) { @@ -1252,7 +1252,7 @@ static BOOL BootCheck(void) uprintf("Will reuse '%s' for Syslinux v5\n", ldlinux_c32); fclose(fd); } else { - PrintStatus(0, FALSE, "Missing '%s' file", ldlinux_c32); + PrintStatus(0, FALSE, lmprintf(MSG_506, ldlinux_c32)); safe_sprintf(msgbox, sizeof(msgbox), "Syslinux v5.0 or later requires a '%s' file to be installed.\n" "Because this file is more than 100 KB in size, and always present on Syslinux v5+ ISO images, " "it is not embedded in " APPLICATION_NAME ".\n\n" @@ -1445,7 +1445,7 @@ void InitDialog(HWND hDlg) static void PrintStatus2000(const char* str, BOOL val) { - PrintStatus(2000, FALSE, "%s %s.", str, (val)?"enabled":"disabled"); + PrintStatus(2000, FALSE, (lmprintf((val)?MSG_550:MSG_551, str))); } @@ -1457,7 +1457,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA DRAWITEMSTRUCT* pDI; POINT Point; RECT DialogRect, DesktopRect; - int nDeviceIndex, fs, bt, i, nWidth, nHeight; + int nDeviceIndex, fs, bt, i, nWidth, nHeight, nb_devices; static DWORD DeviceNum = 0, LastRefresh = 0; char tmp[128]; static UINT uBootChecked = BST_CHECKED, uQFChecked; @@ -1541,7 +1541,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA // Operation may have completed in the meantime if (format_thid != NULL) { FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_CANCELLED; - PrintStatus(0, FALSE, "Cancelling - Please wait..."); + PrintStatus(0, FALSE, lmprintf(MSG_501)); uprintf("Cancelling (from main app)\n"); // Start a timer to detect blocking operations during ISO file extraction if (iso_blocking_status >= 0) { @@ -1608,8 +1608,8 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA case IDC_DEVICE: if (HIWORD(wParam) != CBN_SELCHANGE) break; - PrintStatus(0, TRUE, "%d device%s found.", ComboBox_GetCount(hDeviceList), - (ComboBox_GetCount(hDeviceList)!=1)?"s":""); + nb_devices = ComboBox_GetCount(hDeviceList); + PrintStatus(0, TRUE, lmprintf((nb_devices==1)?MSG_508:MSG_509, nb_devices)); PopulateProperties(ComboBox_GetCurSel(hDeviceList)); SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE<<16) | IDC_FILESYSTEM, ComboBox_GetCurSel(hFileSystem)); @@ -1752,7 +1752,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA case IDC_ENABLE_FIXED_DISKS: if ((HIWORD(wParam)) == BN_CLICKED) { enable_fixed_disks = !enable_fixed_disks; - PrintStatus2000("Fixed disks detection", enable_fixed_disks); + PrintStatus2000(lmprintf(MSG_553), enable_fixed_disks); GetUSBDevices(0); } break; @@ -1845,16 +1845,16 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA SendMessage(hProgress, PBM_SETPOS, (MAX_PROGRESS+1), 0); SendMessage(hProgress, PBM_SETRANGE, 0, (MAX_PROGRESS<<16) & 0xFFFF0000); SetTaskbarProgressState(TASKBAR_NOPROGRESS); - PrintStatus(0, FALSE, "DONE"); + PrintStatus(0, FALSE, lmprintf(MSG_510)); } else if (SCODE_CODE(FormatStatus) == ERROR_CANCELLED) { SendMessage(hProgress, PBM_SETSTATE, (WPARAM)PBST_PAUSED, 0); SetTaskbarProgressState(TASKBAR_PAUSED); - PrintStatus(0, FALSE, "Cancelled"); - Notification(MSG_INFO, NULL, "Cancelled", "Operation cancelled by the user."); + PrintStatus(0, FALSE, lmprintf(MSG_511)); + Notification(MSG_INFO, NULL, lmprintf(MSG_511), "Operation cancelled by the user."); } else { SendMessage(hProgress, PBM_SETSTATE, (WPARAM)PBST_ERROR, 0); SetTaskbarProgressState(TASKBAR_ERROR); - PrintStatus(0, FALSE, "FAILED"); + PrintStatus(0, FALSE, lmprintf(MSG_512)); Notification(MSG_ERROR, NULL, "Error", "Error: %s", StrError(FormatStatus)); } FormatStatus = 0; @@ -2061,7 +2061,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine // the target USB drive. If this is enabled, the size check is disabled. if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'S')) { size_check = !size_check; - PrintStatus2000("Size checks", size_check); + PrintStatus2000(lmprintf(MSG_552), size_check); GetUSBDevices(0); continue; } @@ -2071,20 +2071,20 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine // drive instead of an USB key. If this is enabled, Rufus will allow fixed disk formatting. if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'F')) { enable_fixed_disks = !enable_fixed_disks; - PrintStatus2000("Fixed disks detection", enable_fixed_disks); + PrintStatus2000(lmprintf(MSG_553), enable_fixed_disks); GetUSBDevices(0); continue; } // Alt-L => Force Large FAT32 format to be used on < 32 GB drives if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'L')) { force_large_fat32 = !force_large_fat32; - PrintStatus2000("Force large FAT32 usage", force_large_fat32); + PrintStatus2000(lmprintf(MSG_554), force_large_fat32); continue; } // Alt-D => Delete the NoDriveTypeAutorun key on exit (useful if the app crashed) // This key is used to disable Windows popup messages when an USB drive is plugged in. if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'D')) { - PrintStatus(2000, FALSE, "NoDriveTypeAutorun will be deleted on exit."); + PrintStatus(2000, FALSE, lmprintf(MSG_555)); existing_key = FALSE; continue; } @@ -2095,13 +2095,12 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine // it back during the bad block check. if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'K')) { detect_fakes = !detect_fakes; - PrintStatus2000("Fake drive detection", detect_fakes); + PrintStatus2000(lmprintf(MSG_556), detect_fakes); continue; } // Alt-R => Remove all the registry keys created by Rufus if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'R')) { - PrintStatus(2000, FALSE, "Application registry key %s deleted.", - DeleteRegistryKey(REGKEY_HKCU, COMPANY_NAME "\\" APPLICATION_NAME)?"successfully":"could not be"); + PrintStatus(2000, FALSE, lmprintf(DeleteRegistryKey(REGKEY_HKCU, COMPANY_NAME "\\" APPLICATION_NAME)?MSG_548:MSG_549)); // Also try to delete the upper key (company name) if it's empty (don't care about the result) DeleteRegistryKey(REGKEY_HKCU, COMPANY_NAME); continue; diff --git a/src/rufus.h b/src/rufus.h index aed1ea6c..8b27430f 100644 --- a/src/rufus.h +++ b/src/rufus.h @@ -283,7 +283,7 @@ extern enum WindowsVersion DetectWindowsVersion(void); extern const char* PrintWindowsVersion(enum WindowsVersion version); extern const char *WindowsErrorString(void); extern void DumpBufferHex(void *buf, size_t size); -extern void PrintStatus(unsigned int duration, BOOL debug, const char *format, ...); +extern void PrintStatus(unsigned int duration, BOOL debug, const char* message); extern void UpdateProgress(int op, float percent); extern const char* StrError(DWORD error_code); extern char* GuidToString(const GUID* guid); diff --git a/src/stdfn.c b/src/stdfn.c index 7b1f21a6..93201efd 100644 --- a/src/stdfn.c +++ b/src/stdfn.c @@ -26,6 +26,8 @@ #include "msapi_utf8.h" #include "rufus.h" +#include "resource.h" +#include "localization.h" // Must be in the same order as enum WindowsVersion static const char* WindowsVersionName[WINDOWS_MAX] = { @@ -232,7 +234,7 @@ BOOL FileIO(BOOL save, char* path, char** buffer, DWORD* size) goto out; } - PrintStatus(0, TRUE, "%s '%s'", save?"Saved":"Opened", path); + PrintStatus(0, TRUE, save?lmprintf(MSG_516, path):lmprintf(MSG_515, path)); ret = TRUE; out: diff --git a/src/stdio.c b/src/stdio.c index 2d0df293..f43225c9 100644 --- a/src/stdio.c +++ b/src/stdio.c @@ -51,7 +51,7 @@ void _uprintf(const char *format, ...) p += (n < 0)?sizeof(buf)-3:n; - while((p>buf) && (isspace((unsigned char)p[-1]))) + while((p>buf) && (isspaceU(p[-1]))) *--p = '\0'; *p++ = '\r'; @@ -146,23 +146,9 @@ static void CALLBACK PrintStatusTimeout(HWND hwnd, UINT uMsg, UINT_PTR idEvent, KillTimer(hMainDialog, TID_MESSAGE); } -void PrintStatus(unsigned int duration, BOOL debug, const char *format, ...) +void PrintStatus(unsigned int duration, BOOL debug, const char* message) { - char *p = szStatusMessage; - va_list args; - int n; - - va_start(args, format); - n = safe_vsnprintf(p, sizeof(szStatusMessage)-1, format, args); // room for NUL - va_end(args); - - p += (n < 0)?sizeof(szStatusMessage)-1:n; - - while((p>szStatusMessage) && (isspace(p[-1]))) - *--p = '\0'; - - *p = '\0'; - + safe_strcpy(szStatusMessage, sizeof(szStatusMessage), message); if (debug) uprintf("%s\n", szStatusMessage); diff --git a/src/stdlg.c b/src/stdlg.c index f4d6a322..954a41b7 100644 --- a/src/stdlg.c +++ b/src/stdlg.c @@ -1193,10 +1193,10 @@ INT_PTR CALLBACK NewVersionCallback(HWND hDlg, UINT message, WPARAM wParam, LPAR memset(&pi, 0, sizeof(pi)); si.cb = sizeof(si); if (!CreateProcessU(NULL, tmp, NULL, NULL, FALSE, 0, NULL, filepath, &si, &pi)) { - PrintStatus(0, FALSE, "Failed to launch new application"); + PrintStatus(0, FALSE, lmprintf(MSG_514)); uprintf("Failed to launch new application: %s\n", WindowsErrorString()); } else { - PrintStatus(0, FALSE, "Launching new application..."); + PrintStatus(0, FALSE, lmprintf(MSG_513)); PostMessage(hDlg, WM_COMMAND, (WPARAM)IDCLOSE, 0); PostMessage(hMainDialog, WM_CLOSE, 0, 0); } diff --git a/src/syslinux.c b/src/syslinux.c index f01f7984..b064c9fc 100644 --- a/src/syslinux.c +++ b/src/syslinux.c @@ -28,6 +28,7 @@ #include "rufus.h" #include "resource.h" +#include "localization.h" #include "syslinux.h" #include "syslxfs.h" @@ -91,7 +92,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter) int dt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)); BOOL use_v5 = (dt == DT_SYSLINUX_V5) || ((dt == DT_ISO) && (iso_report.has_syslinux_v5)); - PrintStatus(0, TRUE, "Installing Syslinux v%d...", use_v5?5:4); + PrintStatus(0, TRUE, lmprintf(MSG_534, use_v5?5:4)); ldlinux_path[0] = drive_letter; -- GitLab