Merge pull request #5650 from maron2000/add_translation

Making more messages in dialog boxes to be translatable
This commit is contained in:
Jonathan Campbell 2025-04-23 20:36:09 -07:00 committed by GitHub
commit 4102710e01
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 229 additions and 46 deletions

View File

@ -4385,4 +4385,62 @@ Do you want to change the current code page to %d now?
.
:PROGRAM_CHANGING_CODEPAGE
Changing code page
.
:IMAGEMOUNT_CHANGE_DOSVER
Mounting this type of disk images requires a reported DOS version of %s or higher.
Do you want to auto - change the reported DOS version to %s now and mount the disk image ?
.
:MENU_DRIVE_NOTEXIST
Drive does not exist or is mounted from disk image.
.
:MENU_SAVE_IMAGE_FAILED
Failed to save disk image.
.
:MENU_JP_CPONLY
This function is only available for the Japanese code page (932).
.
:MENU_CN_CPONLY
This function is only available for the Chinese code pages (936 or 950).
.
:MENU_GLIDE_ERROR
Glide passthrough cannot be enabled. Check the Glide wrapper installation.
.
:MENU_HIGH_INTENSITY_ERROR
High intensity is not supported for the current video mode.
.
:MENU_SAVE_FILE_ERROR
Cannot save to the file: %s
.
:MENU_INT2F_SUCCESS
The INT 2Fh hook has been successfully set.
.
:MENU_INT2F_ALREADY_SET
The INT 2Fh hook was already set up.
.
:QUIT_DISABLED
Quitting from DOSBox-X with this is currently disabled.
.
:QUIT_CONFIRM
This will quit from DOSBox-X.\nAre you sure?
.
:QUIT_GUEST_DISABLED
You cannot quit DOSBox-X while running a guest system.
.
:QUIT_GUEST_CONFIRM
You are currently running a guest system.
Are you sure to quit anyway now?
.
:QUIT_FILE_OPEN_DISABLED
You cannot quit DOSBox-X while one or more files are open.
.
:QUIT_FILE_OPEN_CONFIRM
It may be unsafe to quit from DOSBox-X right now
because one or more files are currently open.\nAre you sure to quit anyway now?
.
:QUIT_PROGRAM_DISABLED
You cannot quit DOSBox-X while running a program or game.
.
:QUIT_PROGRAM_CONFIRM
You are currently running a program or game.
Are you sure to quit anyway now?
.

View File

@ -3914,7 +3914,7 @@ EMS ブロックを割り当てました (%uKB)
:PROGRAM_LOADFIX_EMS_ALLOCERROR
EMS ブロックを割り当てることができませんでした。
.
PROGRAM_LOADFIX_NOEMS
:PROGRAM_LOADFIX_NOEMS
EMS は有効ではありません。
.
:PROGRAM_LOADFIX_XMS_ALLOC
@ -4404,4 +4404,62 @@ C ドライブはすでにマウントされていますが、続けますか?
.
:PROGRAM_CHANGING_CODEPAGE
コードページの変更
.
:IMAGEMOUNT_CHANGE_DOSVER
この形式のイメージをマウントするためには DOS バージョンが %s 以上である必要があります。DOS バージョンを %s へ変更してイメージをマウントしますか ?
.
:MENU_DRIVE_NOTEXIST
ドライブが存在しないか、イメージがマウントされています。
.
:MENU_SAVE_IMAGE_FAILED
ディスク・イメージが保存できませんでした。.
.
:MENU_JP_CPONLY
この機能は日本語のコードページ (932) のみに使われます。
.
:MENU_CN_CPONLY
この機能は中国語のコードページ (936 または 950) のみに使われます。
.
:MENU_GLIDE_ERROR
Glide パススルーを設定できませんでした。Glide ラッパーが正しくインストールされているか確認して下さい。
.
:MENU_HIGH_INTENSITY_ERROR
現在のビデオ・モードでは強調表示はサポートされていません。.
.
:MENU_SAVE_FILE_ERROR
指定のファイルに保存できませんでした: %s
.
:MENU_INT2F_SUCCESS
INT 2Fh フックを設定しました。
.
:MENU_INT2F_ALREADY_SET
INT 2Fh フックは設定済みです。
.
:QUIT_DISABLED
現在ここから DOSBox-X を終了できません。
.
:QUIT_CONFIRM
DOSBox-X を終了してよろしいですか?
.
:QUIT_GUEST_DISABLED
ゲストシステムを実行中は DOSBox-X を終了できません。
.
:QUIT_GUEST_CONFIRM
ゲストシステムを実行中です。
終了してもよろしいですか?
.
:QUIT_FILE_OPEN_DISABLED
ファイルを一つ以上開いているため DOSBox-X を終了できません。
.
:QUIT_FILE_OPEN_CONFIRM
ファイルを一つ以上開いているため、DOSBox-X を終了させることは
安全ではないかもしれません。
終了してもよろしいですか?
.
:QUIT_PROGRAM_DISABLED
プログラムまたはゲームの実行中は DOSBox-X を終了できません。
.
:QUIT_PROGRAM_CONFIRM
プログラムまたはゲームを実行中です。
終了してもよろしいですか?
.

View File

@ -10085,6 +10085,8 @@ void DOS_SetupPrograms(void) {
#endif
" \033[32;1m-examples: Show some usage examples.\033[0m"
);
MSG_Add("IMAGEMOUNT_CHANGE_DOSVER", "Mounting this type of disk images requires a reported DOS version of %s or higher.\n"
"Do you want to auto - change the reported DOS version to %s now and mount the disk image ? ");
MSG_Add("PROGRAM_IMGMAKE_EXAMPLE",
"Some usage examples of IMGMAKE:\n\n"
" \033[32;1mIMGMAKE -t fd\033[0m - create a 1.44MB floppy image \033[33;1mIMGMAKE.IMG\033[0m\n"
@ -10430,7 +10432,25 @@ void DOS_SetupPrograms(void) {
MSG_Add("PROGRAM_ASK_CHCP","Drive %c: may require code page %d to be properly accessed.\n\n"
"Do you want to change the current code page to %d now?\n");
MSG_Add("PROGRAM_CHANGING_CODEPAGE","Changing code page");
MSG_Add("MENU_DRIVE_NOTEXIST", "Drive does not exist or is mounted from disk image.");
MSG_Add("MENU_SAVE_IMAGE_FAILED","Failed to save disk image.");
MSG_Add("MENU_JP_CPONLY","This function is only available for the Japanese code page (932).");
MSG_Add("MENU_CN_CPONLY","This function is only available for the Chinese code pages (936 or 950).");
MSG_Add("MENU_GLIDE_ERROR","Glide passthrough cannot be enabled. Check the Glide wrapper installation.");
MSG_Add("MENU_HIGH_INTENSITY_ERROR", "High intensity is not supported for the current video mode.");
MSG_Add("MENU_SAVE_FILE_ERROR","Cannot save to the file: %s");
MSG_Add("MENU_INT2F_SUCCESS","The INT 2Fh hook has been successfully set.");
MSG_Add("MENU_INT2F_ALREADY_SET","The INT 2Fh hook was already set up.");
MSG_Add("QUIT_DISABLED","Quitting from DOSBox-X with this is currently disabled.");
MSG_Add("QUIT_CONFIRM","This will quit from DOSBox-X.\nAre you sure?");
MSG_Add("QUIT_GUEST_DISABLED","You cannot quit DOSBox-X while running a guest system.");
MSG_Add("QUIT_GUEST_CONFIRM", "You are currently running a guest system.\nAre you sure to quit anyway now?");
MSG_Add("QUIT_FILE_OPEN_DISABLED","You cannot quit DOSBox-X while one or more files are open.");
MSG_Add("QUIT_FILE_OPEN_CONFIRM", "It may be unsafe to quit from DOSBox-X right now\n"
"because one or more files are currently open.\nAre you sure to quit anyway now?");
MSG_Add("QUIT_PROGRAM_DISABLED","You cannot quit DOSBox-X while running a program or game.");
MSG_Add("QUIT_PROGRAM_CONFIRM","You are currently running a program or game.\nAre you sure to quit anyway now?");
const Section_prop * dos_section=static_cast<Section_prop *>(control->GetSection("dos"));
hidefiles = dos_section->Get_string("drive z hide files");

View File

@ -59,6 +59,7 @@ extern bool CodePageHostToGuestUTF16(char *d/*CROSS_LEN*/,const uint16_t *s/*CRO
extern bool wild_match(const char* haystack, char* needle);
bool systemmessagebox(char const * aTitle, char const * aMessage, char const * aDialogType, char const * aIconType, int aDefaultButton);
extern bool dos_kernel_disabled;
std::string formatString(const char* format, ...);
int PC98AutoChoose_FAT(const std::vector<_PC98RawPartition> &parts,imageDisk *loadedDisk) {
for (size_t i=0;i < parts.size();i++) {
@ -107,7 +108,9 @@ int MBRAutoChoose_FAT(const std::vector<partTable::partentry_t> &parts,imageDisk
}
else if (pe.parttype == 0x0E/*FAT16B LBA*/) {
if (use_ver_maj < 7 && prompt1) {
if (fat32setver == 1 || (fat32setver == -1 && systemmessagebox("Mounting LBA disk image","Mounting this type of disk images requires a reported DOS version of 7.0 or higher. Do you want to auto-change the reported DOS version to 7.0 now and mount the disk image?","yesno", "question", 1))) {
std::string dos_ver = "7.0";
std::string drive_warn = formatString(MSG_Get("IMAGEMOUNT_CHANGE_DOSVER"), dos_ver.c_str(), dos_ver.c_str());
if (fat32setver == 1 || (fat32setver == -1 && systemmessagebox("Mounting LBA disk image", drive_warn.c_str(), "yesno", "question", 1))) {
use_ver_maj = dos.version.major = 7;
use_ver_min = dos.version.minor = 0;
dos_ver_menu(false);
@ -127,7 +130,9 @@ int MBRAutoChoose_FAT(const std::vector<partTable::partentry_t> &parts,imageDisk
}
else if (pe.parttype == 0x0B || pe.parttype == 0x0C) { /* FAT32 types */
if ((use_ver_maj < 7 || (use_ver_maj == 7 && use_ver_min < 10)) && prompt2) {
if (fat32setver == 1 || (fat32setver == -1 && systemmessagebox("Mounting FAT32 disk image","Mounting this type of disk images requires a reported DOS version of 7.10 or higher. Do you want to auto-change the reported DOS version to 7.10 now and mount the disk image?","yesno", "question", 1))) {
std::string dos_ver = "7.10";
std::string drive_warn = formatString(MSG_Get("IMAGEMOUNT_CHANGE_DOSVER"), dos_ver.c_str(), dos_ver.c_str());
if (fat32setver == 1 || (fat32setver == -1 && systemmessagebox("Mounting FAT32 disk image",drive_warn.c_str(), "yesno", "question", 1))) {
use_ver_maj = dos.version.major = 7;
use_ver_min = dos.version.minor = 10;
dos_ver_menu(true);

View File

@ -97,6 +97,7 @@ size_t GetGameState_Run(void);
void DBCSSBCS_mapper_shortcut(bool pressed);
void AutoBoxDraw_mapper_shortcut(bool pressed);
extern std::string langname, GetDOSBoxXPath(bool withexe=false);
std::string formatString(const char* format, ...);
void* GetSetSDLValue(int isget, std::string& target, void* setval) {
if (target == "wait_on_error") {
@ -467,7 +468,7 @@ bool drive_saveimg_menu_callback(DOSBoxMenu * const menu,DOSBoxMenu::item * cons
return false;
if (drive < 0 || drive>=DOS_DRIVES) return false;
if (!Drives[drive] || dynamic_cast<fatDrive*>(Drives[drive])) {
systemmessagebox("Error", "Drive does not exist or is mounted from disk image.", "ok","error", 1);
systemmessagebox(MSG_Get("ERROR"), MSG_Get("MENU_DRIVE_NOTEXIST"), "ok","error", 1);
return false;
}
@ -486,7 +487,7 @@ bool drive_saveimg_menu_callback(DOSBoxMenu * const menu,DOSBoxMenu::item * cons
for (int i=0; i<MAX_DISK_IMAGES; i++)
if (imageDiskList[i] && imageDiskList[i]->ffdd && imageDiskList[i]->drvnum == drive) {
if (!saveDiskImage(imageDiskList[i], lTheSaveFileName)) systemmessagebox("Error", "Failed to save disk image.", "ok","error", 1);
if (!saveDiskImage(imageDiskList[i], lTheSaveFileName)) systemmessagebox(MSG_Get("ERROR"), MSG_Get("MENU_SAVE_IMAGE_FAILED"), "ok","error", 1);
chdir(Temp_CurrentDir);
return true;
}
@ -494,7 +495,7 @@ bool drive_saveimg_menu_callback(DOSBoxMenu * const menu,DOSBoxMenu::item * cons
Section_prop *sec = static_cast<Section_prop *>(control->GetSection("dosbox"));
uint32_t freeMB = sec->Get_int("convert fat free space"), timeout = sec->Get_int("convert fat timeout");
imageDisk *imagedrv = new imageDisk(Drives[drive], drive, freeMB, timeout);
if (!saveDiskImage(imagedrv, lTheSaveFileName)) systemmessagebox("Error", "Failed to save disk image.", "ok","error", 1);
if (!saveDiskImage(imagedrv, lTheSaveFileName)) systemmessagebox(MSG_Get("ERROR"), MSG_Get("MENU_SAVE_IMAGE_FAILED"), "ok","error", 1);
if (imagedrv) delete imagedrv;
if(chdir(Temp_CurrentDir) == -1) {
@ -1644,7 +1645,7 @@ bool ttf_halfwidth_katakana_callback(DOSBoxMenu * const menu,DOSBoxMenu::item *
(void)menu;//UNUSED
(void)menuitem;//UNUSED
if (!isDBCSCP()||dos.loaded_codepage!=932) {
systemmessagebox("Warning", "This function is only available for the Japanese code page (932).", "ok","warning", 1);
systemmessagebox("Warning", MSG_Get("MENU_JP_CPONLY"), "ok","warning", 1);
return true;
}
halfwidthkana=!halfwidthkana;
@ -1659,7 +1660,7 @@ bool ttf_extend_charset_callback(DOSBoxMenu * const menu,DOSBoxMenu::item * cons
(void)menu;//UNUSED
(void)menuitem;//UNUSED
if (!isDBCSCP()||(dos.loaded_codepage!=936&&dos.loaded_codepage!=950&&dos.loaded_codepage!=951)) {
systemmessagebox("Warning", "This function is only available for the Chinese code pages (936 or 950).", "ok","warning", 1);
systemmessagebox("Warning", MSG_Get("MENU_CN_CPONLY"), "ok","warning", 1);
return true;
}
if (dos.loaded_codepage==936) {
@ -1938,7 +1939,7 @@ bool glide_menu_callback(DOSBoxMenu * const menu,DOSBoxMenu::item * const menuit
if (addovl) VFILE_RegisterBuiltinFileBlob(bfb_GLIDE2X_OVL, "/SYSTEM/");
else {
VFILE_Remove("GLIDE2X.OVL","SYSTEM");
if (!glideon) systemmessagebox("Warning", "Glide passthrough cannot be enabled. Check the Glide wrapper installation.", "ok","warning", 1);
if (!glideon) systemmessagebox("Warning", MSG_Get("MENU_GLIDE_ERROR"), "ok","warning", 1);
}
mainMenu.get_item("3dfx_glide").check(addovl).refresh_item(mainMenu);
return true;
@ -2159,7 +2160,7 @@ bool intensity_menu_callback(DOSBoxMenu * const menu,DOSBoxMenu::item * const me
const char *mname = menuitem->get_name().c_str();
uint16_t oldax=reg_ax, oldbx=reg_bx;
if (IS_PC98_ARCH||machine==MCH_CGA||(CurMode->mode>7&&CurMode->mode!=0x0019&&CurMode->mode!=0x0043&&CurMode->mode!=0x0054&&CurMode->mode!=0x0055&&CurMode->mode!=0x0064)) {
systemmessagebox("Warning", "High intensity is not supported for the current video mode.", "ok","warning", 1);
systemmessagebox("Warning", MSG_Get("MENU_HIGH_INTENSITY_ERROR"), "ok","warning", 1);
return true;
}
if (!strcmp(mname, "text_background"))
@ -2432,7 +2433,8 @@ bool save_logas_menu_callback(DOSBoxMenu * const menu,DOSBoxMenu::item * const m
if (lTheSaveFileName==NULL) return false;
#if C_DEBUG
bool savetologfile(const char *name);
if (!savetologfile(lTheSaveFileName)) systemmessagebox("Warning", ("Cannot save to the file: "+std::string(lTheSaveFileName)).c_str(), "ok","warning", 1);
std::string str = formatString(MSG_Get("MENU_SAVE_FILE_ERROR"), lTheSaveFileName);
if (!savetologfile(lTheSaveFileName)) systemmessagebox("Warning", str.c_str(), "ok", "warning", 1);
#endif
if(chdir(Temp_CurrentDir) == -1) {
LOG(LOG_GUI, LOG_ERROR)("save_logas_menu_callback failed to change directories.");
@ -2873,9 +2875,9 @@ bool int2fhook_menu_callback(DOSBoxMenu * const xmenu, DOSBoxMenu::item * const
if (int2fdbg_hook_callback == 0) {
void Int2fhook();
Int2fhook();
systemmessagebox("Success", "The INT 2Fh hook has been successfully set.", "ok","info", 1);
systemmessagebox("Success", MSG_Get("MENU_INT2F_SUCCESS"), "ok","info", 1);
} else
systemmessagebox("Warning", "The INT 2Fh hook was already set up.", "ok","warning", 1);
systemmessagebox("Warning", MSG_Get("MENU_INT2F_ALREADY_SET"), "ok","warning", 1);
#endif
return true;

View File

@ -1126,35 +1126,35 @@ bool CheckQuit(void) {
if (sdl.desktop.fullscreen) GFX_SwitchFullScreen();
if (warn == "true") {
if (!quit) {
systemmessagebox("Quit DOSBox-X warning","Quitting from DOSBox-X with this is currently disabled.","ok", "warning", 1);
systemmessagebox("Quit DOSBox-X warning", MSG_Get("QUIT_DISABLED"),"ok", "warning", 1);
return false;
} else
return systemmessagebox("Quit DOSBox-X warning","This will quit from DOSBox-X.\nAre you sure?","yesno", "question", 1);
return systemmessagebox("Quit DOSBox-X warning", MSG_Get("QUIT_CONFIRM"),"yesno", "question", 1);
} else if (warn == "false")
return true;
if (dos_kernel_disabled&&strcmp(RunningProgram, "DOSBOX-X")) {
if (!quit) {
systemmessagebox("Quit DOSBox-X warning","You cannot quit DOSBox-X while running a guest system.","ok", "warning", 1);
systemmessagebox("Quit DOSBox-X warning", MSG_Get("QUIT_GUEST_DISABLED"),"ok", "warning", 1);
return false;
} else
return systemmessagebox("Quit DOSBox-X warning","You are currently running a guest system.\nAre you sure to quit anyway now?","yesno", "question", 1);
return systemmessagebox("Quit DOSBox-X warning", MSG_Get("QUIT_GUEST_CONFIRM"),"yesno", "question", 1);
}
if (warn == "autofile")
for (uint8_t handle = 0; handle < DOS_FILES; handle++) {
if (Files[handle] && (Files[handle]->GetName() == NULL || strcmp(Files[handle]->GetName(), "CON")) && (Files[handle]->GetInformation()&DeviceInfoFlags::Device) == 0) {
if (!quit) {
systemmessagebox("Quit DOSBox-X warning","You cannot quit DOSBox-X while one or more files are open.","ok", "warning", 1);
systemmessagebox("Quit DOSBox-X warning", MSG_Get("QUIT_FILE_OPEN_DISABLED"),"ok", "warning", 1);
return false;
} else
return systemmessagebox("Quit DOSBox-X warning","It may be unsafe to quit from DOSBox-X right now\nbecause one or more files are currently open.\nAre you sure to quit anyway now?","yesno", "question", 1);
return systemmessagebox("Quit DOSBox-X warning", MSG_Get("QUIT_FILE_OPEN_CONFIRM"),"yesno", "question", 1);
}
}
else if (RunningProgram&&strcmp(RunningProgram, "DOSBOX-X")&&strcmp(RunningProgram, "COMMAND")&&strcmp(RunningProgram, "4DOS")) {
if (!quit) {
systemmessagebox("Quit DOSBox-X warning","You cannot quit DOSBox-X while running a program or game.","ok", "warning", 1);
systemmessagebox("Quit DOSBox-X warning",MSG_Get("QUIT_PROGRAM_DISABLED"),"ok", "warning", 1);
return false;
} else
return systemmessagebox("Quit DOSBox-X warning","You are currently running a program or game.\nAre you sure to quit anyway now?","yesno", "question", 1);
return systemmessagebox("Quit DOSBox-X warning", MSG_Get("QUIT_PROGRAM_CONFIRM"),"yesno", "question", 1);
}
#endif
return true;

View File

@ -2393,6 +2393,14 @@ bool isDBCSCP() {
return !IS_PC98_ARCH && (IS_JEGA_ARCH||IS_DOSV||dos.loaded_codepage==932||dos.loaded_codepage==936||dos.loaded_codepage==949||dos.loaded_codepage==950||dos.loaded_codepage==951) && enable_dbcs_tables;
}
#ifdef __cplusplus
extern "C" {
#endif
bool tfd_isDBCSCP(void) { return isDBCSCP(); }
#ifdef __cplusplus
}
#endif
#if 0//not used
bool isDBCSLB(uint8_t chr) {
for (int i=0; i<6; i++) lead[i] = 0;

View File

@ -159,6 +159,21 @@ bool isKanji2(uint8_t chr) {
else
return (chr >= 0x40 && chr <= 0x7e) || (del_flag && chr == 0x7f) || (chr >= 0x80 && chr <= 0xfc);
}
#ifdef __cplusplus
extern "C" {
#endif
bool tfd_isKanji1(uint8_t chr) {
return isKanji1(chr);
}
bool tfd_isKanji2(uint8_t chr) {
return isKanji2(chr);
}
#ifdef __cplusplus
}
#endif
static inline int Hex2Int(const char *p) {
if (*p <= '9')

View File

@ -437,37 +437,55 @@ static void wipefile(char const * aFilename)
}
}
#include <stdint.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
bool tfd_isDBCSCP(void);
bool tfd_isKanji1(uint8_t chr);
bool tfd_isKanji2(uint8_t chr);
#ifdef __cplusplus
}
#endif
int tfd_quoteDetected(char const * aString)
{
char const * p;
if(!aString)
return 0;
if (!aString) return 0;
const char* p = aString;
bool is_dbcscp = tfd_isDBCSCP();
while(*p != '\0')
{
// Skip if the current character is the second byte of a DBCS character
if(is_dbcscp && tfd_isKanji1(*p) && tfd_isKanji2(*(p + 1)))
{
p += 2; // Skip both bytes of the DBCS character
continue;
}
p = aString;
if ( strchr(p, '\''))
{
return 1;
}
// Check for single-byte quote characters
if(*p == '\'' || *p == '\"' || *p == '`')
{
return 1;
}
if ( strchr(p, '\"'))
{
return 1;
}
// Check for '$' followed by '(', '_', or an alphabetic character
if(*p == '$')
{
p++;
if(*p == '(' || *p == '_' || isalpha(*p))
{
return 1;
}
// If not followed by the specified characters, continue checking
}
if ( strchr(p, '`'))
{
return 1;
}
p++;
}
p = aString;
while ((p = strchr(p, '$')))
{
p ++ ;
if ( ( * p == '(' ) || ( * p == '_' ) || isalpha( * p) ) return 1 ;
}
return 0;
return 0;
}
@ -2871,7 +2889,6 @@ static void writeUtf8( char const * aUtf8String )
(void)WriteConsoleW(lConsoleHandle, lTmpWChar, (DWORD) wcslen(lTmpWChar), &lNum, NULL);
}
int tinyfd_messageBox(
char const * aTitle, /* NULL or "" */
char const * aMessage, /* NULL or "" may contain \n and \t */