mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[loc] add random request for translator help where needed
* This will randomly produce a message for users of a translation that hasn't been updated in a while requesting help and pointing them to: http://rufus.akeo.ie/translate * Closes #435 * Also fix a WDK compilation issue with strtoll
This commit is contained in:
parent
474e136e52
commit
26af32b522
7 changed files with 48 additions and 12 deletions
|
@ -457,7 +457,6 @@ 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;
|
||||
pattern_fill(buffer, pattern[pat_idx], blocks_at_once * block_size);
|
||||
uprintf("%sUsing offset %d for fake device check\n", bb_prefix, id_offset);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
11
src/parser.c
11
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; i<ARRAYSIZE(LT); i++) {
|
||||
if (safe_strcmp(last_lcmd->txt[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.
|
||||
|
|
21
src/rufus.c
21
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; i<ARRAYSIZE(lost_translators); i++)
|
||||
if (strcmp(selected_locale->txt[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]);
|
||||
|
|
|
@ -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);
|
||||
|
|
16
src/rufus.rc
16
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"
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue