1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[ui] fix some unwanted display of LTR or RTL strings

* Some English messages could appear RTL in the log
* Folder paths with RTL strings could appear scrambled in the UI
This commit is contained in:
Pete Batard 2018-06-07 22:30:53 +01:00
parent 4ad249338f
commit 645184f11e
3 changed files with 18 additions and 8 deletions

View file

@ -380,7 +380,7 @@ char* lmprintf(uint32_t msg_id, ...)
if (format == NULL) {
safe_sprintf(buf[buf_id], LOC_MESSAGE_SIZE-1, "MSG_%03d UNTRANSLATED", msg_id - MSG_000);
} else {
if (right_to_left_mode) {
if (right_to_left_mode && (msg_table != default_msg_table)) {
if (is_rtf) {
safe_strcpy(&buf[buf_id][pos], LOC_MESSAGE_SIZE - 1, "\\rtlch");
pos += 6;
@ -391,7 +391,7 @@ char* lmprintf(uint32_t msg_id, ...)
va_start(args, msg_id);
safe_vsnprintf(&buf[buf_id][pos], LOC_MESSAGE_SIZE- 1 - 2*pos, format, args);
va_end(args);
if (right_to_left_mode) {
if (right_to_left_mode && (msg_table != default_msg_table)) {
safe_strcat(buf[buf_id], LOC_MESSAGE_SIZE - 1, POP_DIRECTIONAL_FORMATTING);
if (is_rtf)
safe_strcat(buf[buf_id], LOC_MESSAGE_SIZE - 1, "\\ltrch");

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.1.1311"
CAPTION "Rufus 3.1.1312"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -389,8 +389,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,1,1311,0
PRODUCTVERSION 3,1,1311,0
FILEVERSION 3,1,1312,0
PRODUCTVERSION 3,1,1312,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -407,13 +407,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.1.1311"
VALUE "FileVersion", "3.1.1312"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2018 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.1.1311"
VALUE "ProductVersion", "3.1.1312"
END
END
BLOCK "VarFileInfo"

View file

@ -463,6 +463,7 @@ BOOL FileIO(BOOL save, char* path, char** buffer, DWORD* size)
HANDLE handle;
BOOL r;
BOOL ret = FALSE;
char* ltr_path;
// Change the owner from admin to regular user
sid = GetSID();
@ -505,7 +506,16 @@ BOOL FileIO(BOOL save, char* path, char** buffer, DWORD* size)
goto out;
}
PrintInfoDebug(0, save?MSG_216:MSG_215, path);
// Ensure that the path is always displayed LTR
// Use of sizeof gets us the extra char needed for NUL terminator
ltr_path = malloc(safe_strlen(path) + sizeof(LEFT_TO_RIGHT_EMBEDDING) + sizeof(POP_DIRECTIONAL_FORMATTING));
if (ltr_path == NULL) {
PrintInfoDebug(0, save ? MSG_216 : MSG_215, path);
} else {
sprintf(ltr_path, "%s%s%s", LEFT_TO_RIGHT_EMBEDDING, path, POP_DIRECTIONAL_FORMATTING);
PrintInfoDebug(0, save ? MSG_216 : MSG_215, ltr_path);
free(ltr_path);
}
ret = TRUE;
out: