[loc] report if an external loc file is used, in the UI log

* Also avoid using LPTSTR in lieu of LPWSTR (even if they do resolve to the exact
  same thing) and force the use of app_dir when looking for a local .loc file.
* Closes #2193
This commit is contained in:
Pete Batard 2023-03-04 16:21:25 +00:00
parent cb561e7176
commit d78a556e4e
No known key found for this signature in database
GPG Key ID: 38E0CF5E69EDD671
3 changed files with 12 additions and 11 deletions

View File

@ -1,7 +1,7 @@
/*
* Rufus: The Reliable USB Formatting Utility
* Localization functions, a.k.a. "Everybody is doing it wrong but me!"
* Copyright © 2013-2017 Pete Batard <pete@akeo.ie>
* Copyright © 2013-2023 Pete Batard <pete@akeo.ie>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -627,7 +627,7 @@ const char* get_name_from_id(int id)
* pack having been installed.
*/
static BOOL found_lang;
static BOOL CALLBACK EnumUILanguagesProc(LPTSTR lpUILanguageString, LONG_PTR lParam)
static BOOL CALLBACK EnumUILanguagesProc(LPWSTR lpUILanguageString, LONG_PTR lParam)
{
wchar_t* wlang = (wchar_t*)lParam;
if (wcscmp(wlang, lpUILanguageString) == 0)

View File

@ -3636,8 +3636,9 @@ skip_args_processing:
// Init localization
init_localization();
// Seek for a loc file in the current directory
if (GetFileAttributesU(rufus_loc) == INVALID_FILE_ATTRIBUTES) {
// Seek for a loc file in the application directory
static_sprintf(loc_file, "%s\\%s", app_dir, rufus_loc);
if (GetFileAttributesU(loc_file) == INVALID_FILE_ATTRIBUTES) {
uprintf("loc file not found in current directory - embedded one will be used");
loc_data = (BYTE*)GetResource(hMainInstance, MAKEINTRESOURCEA(IDR_LC_RUFUS_LOC), _RT_RCDATA, "embedded.loc", &loc_size, FALSE);
@ -3661,9 +3662,9 @@ skip_args_processing:
uprintf("localization: extracted data to '%s'", loc_file);
safe_closehandle(hFile);
} else {
static_sprintf(loc_file, "%s\\%s", app_dir, rufus_loc);
external_loc_file = TRUE;
uprintf("using external loc file '%s'", loc_file);
// We do want to report if an external loc file is being used, in the UI log
ubprintf("Using external loc file '%s'", loc_file);
}
if ( (!get_supported_locales(loc_file))

View File

@ -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.22.1985"
CAPTION "Rufus 3.22.1986"
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,22,1985,0
PRODUCTVERSION 3,22,1985,0
FILEVERSION 3,22,1986,0
PRODUCTVERSION 3,22,1986,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -411,13 +411,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.22.1985"
VALUE "FileVersion", "3.22.1986"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2023 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-3.22.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.22.1985"
VALUE "ProductVersion", "3.22.1986"
END
END
BLOCK "VarFileInfo"