[loc] misc. fixes and improvements

* Add support for LCID provision to option -l
* Fix French translation
* Fix memory leak for loc_filename
* Don't delete an external 'rufus.loc' file if present
* Use IETF normalized tags
* Add quick instructions and sample for translators in new_translation.loc
* Improve About dialog
This commit is contained in:
Pete Batard 2013-10-16 20:45:34 +01:00
parent 521e8f00f3
commit 1cdb58462b
7 changed files with 425 additions and 28 deletions

View file

@ -24,12 +24,13 @@ const char* about_blurb_format =
"\\line\n"
"Copyright © 2011-2013 Pete Batard / Akeo\\line\n"
RUFUS_URL "\\line\n"
"%s\\line\n"
"\\fs6 \\line\n"
"\\fs18%s\\line\n"
"\\line\n"
"%s\\line\n"
"https://github.com/pbatard/rufus/issues\\line\n"
"\\line\n"
"{\\b\\fs18 %s}}";
"{\\b %s}}";
const char* additional_copyrights =
"{\\rtf1\\ansi\n"

View file

@ -131,6 +131,7 @@ void init_localization(void) {
void exit_localization(void) {
free_dialog_list();
free_locale_list();
safe_free(loc_filename);
}
/*

View file

@ -22,6 +22,7 @@
#include <windows.h>
#include <stdio.h>
#include <shlobj.h>
#include <ctype.h>
#include <commdlg.h>
#include <shellapi.h>
#include <setupapi.h>

View file

@ -1874,8 +1874,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
#endif
{
const char* old_wait_option = "/W";
int i, opt, option_index = 0, argc = 0, si = 0;
BOOL attached_console = FALSE;
int i, opt, option_index = 0, argc = 0, si = 0, lcid = GetUserDefaultLCID();
BOOL attached_console = FALSE, external_loc_file = FALSE;
BYTE* loc_data;
DWORD loc_size, Size;
char tmp_path[MAX_PATH], loc_file[MAX_PATH] = "", *locale_name = NULL;
@ -1931,8 +1931,11 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
}
break;
case 'l':
// TODO: accept a locale code such as 0x409
locale_name = optarg;
if (isdigitU(optarg[0])) {
lcid = (int)strtol(optarg, NULL, 0);
} else {
locale_name = optarg;
}
break;
case 'w':
wait_for_mutex = atoi(optarg);
@ -1971,11 +1974,12 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
}
} else {
safe_sprintf(loc_file, sizeof(loc_file), "%s\\rufus.loc", app_dir);
external_loc_file = TRUE;
uprintf("using external loc file '%s'", loc_file);
}
if ( (!get_supported_locales(loc_file))
|| ((selected_locale = ((locale_name == NULL)?get_locale_from_lcid(GetUserDefaultLCID()):get_locale_from_name(locale_name))) == NULL) ) {
|| ((selected_locale = ((locale_name == NULL)?get_locale_from_lcid(lcid):get_locale_from_name(locale_name))) == NULL) ) {
uprintf("FATAL: Could not access locale!\n");
MessageBoxU(NULL, "The locale data is missing. This application will now exit.",
"Fatal error", MB_ICONSTOP);
@ -2101,7 +2105,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
}
out:
if (loc_file[0] != 0)
if ((!external_loc_file) && (loc_file[0] != 0))
DeleteFileU(loc_file);
DestroyAllTooltips();
exit_localization();

View file

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 206, 329
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "Rufus v1.4.0.282"
CAPTION "Rufus v1.4.0.283"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Start",IDC_START,94,291,50,14
@ -67,21 +67,21 @@ BEGIN
COMBOBOX IDC_DISK_ID,119,246,73,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Add fixes for old BIOSes (extra partition, align, etc.)",IDC_EXTRA_PARTITION,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,235,181,10
CONTROL "List fixed (non-flash) or unpartitioned USB disks",IDC_ENABLE_FIXED_DISKS,
CONTROL "List non removable or unpartitioned USB disks",IDC_ENABLE_FIXED_DISKS,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,222,181,10
END
IDD_ABOUTBOX DIALOGEX 0, 0, 287, 201
IDD_ABOUTBOX DIALOGEX 0, 0, 287, 204
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About Rufus"
FONT 8, "MS Shell Dlg", 400, 0, 0x0
BEGIN
ICON IDI_ICON,IDC_ABOUT_ICON,11,8,20,20
DEFPUSHBUTTON "OK",IDOK,231,181,50,14,WS_GROUP
PUSHBUTTON "License",IDC_ABOUT_LICENSE,46,181,50,14,WS_GROUP
CONTROL "",IDC_ABOUT_COPYRIGHTS,"RichEdit20W",WS_VSCROLL | 0x804,46,101,235,74,WS_EX_STATICEDGE
CONTROL "",IDC_ABOUT_BLURB,"RichEdit20W",WS_TABSTOP | 0x884,46,7,235,93
PUSHBUTTON "Updates",IDC_ABOUT_UPDATES,100,181,50,14,NOT WS_VISIBLE | WS_GROUP
ICON IDI_ICON,IDC_ABOUT_ICON,11,8,21,20
DEFPUSHBUTTON "OK",IDOK,231,183,50,14,WS_GROUP
PUSHBUTTON "License",IDC_ABOUT_LICENSE,46,183,50,14,WS_GROUP
CONTROL "",IDC_ABOUT_COPYRIGHTS,"RichEdit20W",ES_MULTILINE | ES_READONLY | WS_VSCROLL,46,103,235,74,WS_EX_STATICEDGE
CONTROL "",IDC_ABOUT_BLURB,"RichEdit20W",ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | WS_TABSTOP,46,7,235,95
PUSHBUTTON "Updates",IDC_ABOUT_UPDATES,100,183,50,14,NOT WS_VISIBLE | WS_GROUP
END
IDD_ISO_EXTRACT DIALOGEX 0, 0, 262, 66
@ -284,8 +284,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,4,0,282
PRODUCTVERSION 1,4,0,282
FILEVERSION 1,4,0,283
PRODUCTVERSION 1,4,0,283
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -302,13 +302,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "1.4.0.282"
VALUE "FileVersion", "1.4.0.283"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2013 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "1.4.0.282"
VALUE "ProductVersion", "1.4.0.283"
END
END
BLOCK "VarFileInfo"