diff --git a/src/badblocks.c b/src/badblocks.c index 7a03c712..c5ac77f3 100644 --- a/src/badblocks.c +++ b/src/badblocks.c @@ -457,8 +457,7 @@ static unsigned int test_rw(HANDLE hDrive, blk_t last_block, size_t block_size, for (pat_idx = 0; pat_idx < nb_passes; pat_idx++) { if (cancel_ops) goto out; - srand((unsigned int)GetTickCount()); - id_offset = rand()* (block_size-sizeof(blk_t)) / RAND_MAX; + id_offset = rand() * (block_size-sizeof(blk_t)) / RAND_MAX; pattern_fill(buffer, pattern[pat_idx], blocks_at_once * block_size); uprintf("%sUsing offset %d for fake device check\n", bb_prefix, id_offset); num_blocks = last_block - 1; diff --git a/src/net.c b/src/net.c index 7168b9b1..ca008da4 100644 --- a/src/net.c +++ b/src/net.c @@ -470,6 +470,8 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param) vvuprintf("Local time: %" PRId64 "\n", local_time); if (local_time < reg_time + update_interval) { vuprintf("Next update check in %" PRId64 " seconds.\n", reg_time + update_interval - local_time); + // This is as good a place as any to ask for translation help + LostTranslatorCheck(); goto out; } } diff --git a/src/parser.c b/src/parser.c index 1f1ad6d1..edb04478 100644 --- a/src/parser.c +++ b/src/parser.c @@ -233,11 +233,13 @@ out: * Parse a localization file, to construct the list of available locales. * The locale file must be UTF-8 with NO BOM. */ +extern char lost_translators[][6]; BOOL get_supported_locales(const char* filename) { FILE* fd = NULL; BOOL r = FALSE; char line[1024]; + char* LT[] = LOST_TRANSLATORS; //just to get the arraysize... size_t i, j, k; loc_cmd *lcmd = NULL, *last_lcmd = NULL; long end_of_block; @@ -346,6 +348,14 @@ BOOL get_supported_locales(const char* filename) "If you are the translator, please update your translation with the changes that intervened between v%d.%d.%d and v%d.%d.%d.\n" "See https://github.com/pbatard/rufus/blob/master/res/localization/ChangeLog.txt", LOC_FRAMEWORK_VERSION, loc_base_minor, lcmd->unum[2], LOC_FRAMEWORK_VERSION, loc_base_minor, loc_base_micro); + } else if (lcmd->unum[2] >= loc_base_micro) { + // Don't bug users about a locale that may already have been upgraded + for (i=0; itxt[0], lost_translators[i]) == 0) { + uprintf("NOTE: This translation appears up to date - Removing it from LOST_TRANSLATORS"); + lost_translators[i][0] = 0; + } + } } version_line_nr = loc_line_nr; } @@ -1221,7 +1231,6 @@ out: return ret; } - /* * Replace all 'c' characters in string 'src' with the subtsring 'rep' * The returned string is allocated and must be freed by the caller. diff --git a/src/rufus.c b/src/rufus.c index 90bcd2fb..11c8822f 100644 --- a/src/rufus.c +++ b/src/rufus.c @@ -111,6 +111,7 @@ static RECT relaunch_rc = { -65536, -65536, 0, 0}; static UINT uBootChecked = BST_CHECKED, uQFChecked = BST_CHECKED, uMBRChecked = BST_UNCHECKED; char ClusterSizeLabel[MAX_CLUSTER_SIZES][64]; char msgbox[1024], msgbox_title[32], *ini_file = NULL; +char lost_translators[][6] = LOST_TRANSLATORS; /* * Globals @@ -902,6 +903,25 @@ static void CALLBACK BlockingTimer(HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD } } +// Randomly nag users about translations that have been left behind +void LostTranslatorCheck(void) +{ + char *p; + char* lang = safe_strdup(selected_locale->txt[1]); + int i, r = rand() * LOST_TRANSLATOR_PROBABILITY / RAND_MAX; + for (i=0; itxt[0], lost_translators[i]) == 0) + break; + if ((r == 0) && (i != ARRAYSIZE(lost_translators)) && (lang != NULL) && ((p = strchr(lang, '(')) != NULL)) { + p[-1] = 0; + safe_sprintf(msgbox, sizeof(msgbox), "Note: The %s translation requires an update, but the original " + "translator is no longer contributing to it...\nIf you can read English and want to help complete " + "this translation, please visit: http://rufus.akeo.ie/translate.", lang); + MessageBoxU(hMainDialog, msgbox, "Translation help needed", MB_OK|MB_ICONINFORMATION); + } + safe_free(lang); +} + // Report the features of the selected ISO images static const char* YesNo(BOOL b) { return (b) ? "Yes" : "No"; @@ -2585,6 +2605,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine uprintf("Failed to enable AutoMount"); } } + srand((unsigned int)GetTickCount()); relaunch: uprintf("localization: using locale '%s'\n", selected_locale->txt[0]); diff --git a/src/rufus.h b/src/rufus.h index 578cdaca..013abef4 100644 --- a/src/rufus.h +++ b/src/rufus.h @@ -33,6 +33,10 @@ #define RUFUS_DEBUG // print debug info to Debug facility /* Features not ready for prime time and that may *DESTROY* your data - USE AT YOUR OWN RISKS! */ // #define RUFUS_TEST +/* Languages for which translators are M.I.A. and we could use help with */ +#define LOST_TRANSLATORS { "ar-SA", "hu-HU", "id-ID", "pt-PT", "es-ES" } // NB: locales MUST be <= 5 chars +/* Probability of getting the M.I.A. translator message. For more on this, see LostTranslatorCheck() */ +#define LOST_TRANSLATOR_PROBABILITY 1000 #define APPLICATION_NAME "Rufus" #define COMPANY_NAME "Akeo Consulting" @@ -421,6 +425,7 @@ extern BOOL WimApplyImage(const char* image, int index, const char* dst); extern BOOL IsHDImage(const char* path); extern BOOL AppendVHDFooter(const char* vhd_path); extern int IsHDD(DWORD DriveIndex, uint16_t vid, uint16_t pid, const char* strid); +extern void LostTranslatorCheck(void); DWORD WINAPI FormatThread(void* param); DWORD WINAPI SaveImageThread(void* param); diff --git a/src/rufus.rc b/src/rufus.rc index c2e98602..ce7bfdb6 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -32,7 +32,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDD_DIALOG DIALOGEX 12, 12, 242, 376 STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Rufus 2.0.0.592" +CAPTION "Rufus 2.0.0.593" FONT 8, "Segoe UI", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "Start",IDC_START,127,339,50,14 @@ -157,7 +157,7 @@ END IDD_DIALOG_XP DIALOGEX 12, 12, 242, 376 STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Rufus 2.0.0.592" +CAPTION "Rufus 2.0.0.593" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "Start",IDC_START,127,339,50,14 @@ -283,7 +283,7 @@ END IDD_DIALOG_RTL DIALOGEX 12, 12, 242, 376 STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL -CAPTION "Rufus 2.0.0.592" +CAPTION "Rufus 2.0.0.593" FONT 8, "Segoe UI", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "Start",IDC_START,127,339,50,14 @@ -415,7 +415,7 @@ END IDD_DIALOG_RTL_XP DIALOGEX 12, 12, 242, 376 STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL -CAPTION "Rufus 2.0.0.592" +CAPTION "Rufus 2.0.0.593" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "Start",IDC_START,127,339,50,14 @@ -671,8 +671,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,0,0,592 - PRODUCTVERSION 2,0,0,592 + FILEVERSION 2,0,0,593 + PRODUCTVERSION 2,0,0,593 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -689,13 +689,13 @@ BEGIN BEGIN VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "2.0.0.592" + VALUE "FileVersion", "2.0.0.593" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2015 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "rufus.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "2.0.0.592" + VALUE "ProductVersion", "2.0.0.593" END END BLOCK "VarFileInfo" diff --git a/src/settings.h b/src/settings.h index b895fa3c..443d4974 100644 --- a/src/settings.h +++ b/src/settings.h @@ -50,7 +50,7 @@ static __inline int64_t ReadIniKey64(const char* key) { int64_t val = 0; char* str = get_token_data_file(key, ini_file); if (str != NULL) { - val = strtoll(str, NULL, 0); + val = _strtoi64(str, NULL, 0); free(str); } return val;