diff options
author | 2016-02-19 15:58:46 +0100 | |
---|---|---|
committer | 2016-02-19 15:58:46 +0100 | |
commit | cc1ca5eb93eb828a945e0c5ff8166b46387ed2eb (patch) | |
tree | 19d3742581f657e99052cfb34509fca3cea507f3 | |
parent | 288ac7f9490d170e6e2ce1c267ae32eafd1f423e (diff) |
Doing some preps for internationalization (nw)
-rw-r--r-- | makefile | 6 | ||||
-rw-r--r-- | src/emu/ui/auditmenu.cpp | 2 | ||||
-rw-r--r-- | src/emu/ui/barcode.cpp | 6 | ||||
-rw-r--r-- | src/emu/ui/cheatopt.cpp | 22 | ||||
-rw-r--r-- | src/emu/ui/ctrlmenu.cpp | 4 | ||||
-rw-r--r-- | src/emu/ui/custmenu.cpp | 24 | ||||
-rw-r--r-- | src/emu/ui/mainmenu.cpp | 50 | ||||
-rw-r--r-- | src/osd/osdcomm.h | 4 |
8 files changed, 64 insertions, 54 deletions
@@ -1374,3 +1374,9 @@ cppcheck: shaders: $(SILENT) $(MAKE) -C $(SRC)/osd/modules/render/bgfx rebuild + +.PHONY: translation + +translation: + $(SILENT) echo Generating mame.po + $(SILENT) find src -iname "*.cpp" | xargs xgettext --from-code=ASCII -k_ --default-domain=mame diff --git a/src/emu/ui/auditmenu.cpp b/src/emu/ui/auditmenu.cpp index 8b98f0d70a2..97d84568118 100644 --- a/src/emu/ui/auditmenu.cpp +++ b/src/emu/ui/auditmenu.cpp @@ -108,7 +108,7 @@ void ui_menu_audit::handle() if (m_first) { - machine().ui().draw_text_box(container, "Audit in progress...", JUSTIFY_CENTER, 0.5f, 0.5f, UI_GREEN_COLOR); + machine().ui().draw_text_box(container, _("Audit in progress..."), JUSTIFY_CENTER, 0.5f, 0.5f, UI_GREEN_COLOR); m_first = false; return; } diff --git a/src/emu/ui/barcode.cpp b/src/emu/ui/barcode.cpp index fece584c641..5b3b15d7ad0 100644 --- a/src/emu/ui/barcode.cpp +++ b/src/emu/ui/barcode.cpp @@ -69,11 +69,11 @@ void ui_menu_barcode_reader::populate() new_barcode = m_barcode_buffer; } - item_append("New Barcode:", new_barcode, 0, ITEMREF_NEW_BARCODE); + item_append(_("New Barcode:"), new_barcode, 0, ITEMREF_NEW_BARCODE); // finish up the menu item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); - item_append("Enter Code", nullptr, 0, ITEMREF_ENTER_BARCODE); + item_append(_("Enter Code"), nullptr, 0, ITEMREF_ENTER_BARCODE); customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; } @@ -115,7 +115,7 @@ void ui_menu_barcode_reader::handle() std::string tmp_file(m_barcode_buffer); //printf("code %s\n", m_barcode_buffer); if (!current_device()->is_valid(tmp_file.length())) - machine().ui().popup_time(5, "Barcode length invalid!"); + machine().ui().popup_time(5, _("Barcode length invalid!")); else { current_device()->write_code(tmp_file.c_str(), tmp_file.length()); diff --git a/src/emu/ui/cheatopt.cpp b/src/emu/ui/cheatopt.cpp index a2b9ccffd6c..1d13f8e8c94 100644 --- a/src/emu/ui/cheatopt.cpp +++ b/src/emu/ui/cheatopt.cpp @@ -75,7 +75,7 @@ void ui_menu_cheat::handle() case IPT_UI_DOWN: string = curcheat->comment(); if (string != nullptr && string[0] != 0) - machine().popmessage("Cheat Comment:\n%s", string); + machine().popmessage(_("Cheat Comment:\n%s"), string); break; } } @@ -88,7 +88,7 @@ void ui_menu_cheat::handle() /* display the reloaded cheats */ reset(UI_MENU_RESET_REMEMBER_REF); - machine().popmessage("All cheats reloaded"); + machine().popmessage(_("All cheats reloaded")); } /* handle autofire menu */ @@ -119,7 +119,7 @@ void ui_menu_cheat::populate() std::string subtext; // add the autofire menu - item_append("Autofire Settings", nullptr, 0, (void *)ITEMREF_CHEATS_AUTOFIRE_SETTINGS); + item_append(_("Autofire Settings"), nullptr, 0, (void *)ITEMREF_CHEATS_AUTOFIRE_SETTINGS); /* add a separator */ item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); @@ -137,10 +137,10 @@ void ui_menu_cheat::populate() item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); /* add a reset all option */ - item_append("Reset All", nullptr, 0, (void *)ITEMREF_CHEATS_RESET_ALL); + item_append(_("Reset All"), nullptr, 0, (void *)ITEMREF_CHEATS_RESET_ALL); /* add a reload all cheats option */ - item_append("Reload All", nullptr, 0, (void *)ITEMREF_CHEATS_RELOAD_ALL); + item_append(_("Reload All"), nullptr, 0, (void *)ITEMREF_CHEATS_RELOAD_ALL); } } @@ -256,7 +256,7 @@ void ui_menu_autofire::populate() /* add autofire toggle item */ bool autofire_toggle = machine().ioport().get_autofire_toggle(); - item_append("Autofire Status", (autofire_toggle ? "Disabled" : "Enabled"), + item_append(_("Autofire Status"), (autofire_toggle ? _("Disabled") : _("Enabled")), (autofire_toggle ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW), (void *)ITEMREF_AUTOFIRE_STATUS); /* iterate over the input ports and add autofire toggle items */ @@ -282,13 +282,13 @@ void ui_menu_autofire::populate() if (!autofire_toggle) { // item is enabled and can be switched to values on/off - item_append(field->name(), (settings.autofire ? "On" : "Off"), + item_append(field->name(), (settings.autofire ? _("On") : _("Off")), (settings.autofire ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW), (void *)field); } else { // item is disabled - item_append(field->name(), (settings.autofire ? "On" : "Off"), + item_append(field->name(), (settings.autofire ? _("On") : _("Off")), MENU_FLAG_DISABLE | MENU_FLAG_INVERT, nullptr); } } @@ -299,7 +299,7 @@ void ui_menu_autofire::populate() if (menu_items==0) { item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); - item_append("No buttons found on this machine!", nullptr, MENU_FLAG_DISABLE, nullptr); + item_append(_("No buttons found on this machine!"), nullptr, MENU_FLAG_DISABLE, nullptr); } /* add a separator */ @@ -310,11 +310,11 @@ void ui_menu_autofire::populate() snprintf(temp_text, ARRAY_LENGTH(temp_text), "%d = %.2f Hz", value, (float)refresh/value); if (!autofire_toggle) { - item_append("Autofire Delay", temp_text, MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)ITEMREF_AUTOFIRE_DELAY); + item_append(_("Autofire Delay"), temp_text, MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)ITEMREF_AUTOFIRE_DELAY); } else { - item_append("Autofire Delay", temp_text, MENU_FLAG_DISABLE | MENU_FLAG_INVERT, nullptr); + item_append(_("Autofire Delay"), temp_text, MENU_FLAG_DISABLE | MENU_FLAG_INVERT, nullptr); } /* add a separator */ diff --git a/src/emu/ui/ctrlmenu.cpp b/src/emu/ui/ctrlmenu.cpp index 5d006693faf..74b35abd8e3 100644 --- a/src/emu/ui/ctrlmenu.cpp +++ b/src/emu/ui/ctrlmenu.cpp @@ -103,7 +103,7 @@ void ui_menu_controller_mapping::custom_render(void *selectedref, float top, flo float width, maxwidth = origx2 - origx1; ui_manager &mui = machine().ui(); - mui.draw_text_full(container, "Device Mapping", 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, + mui.draw_text_full(container, _("Device Mapping"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; maxwidth = MAX(maxwidth, width); @@ -123,7 +123,7 @@ void ui_menu_controller_mapping::custom_render(void *selectedref, float top, flo y1 += UI_BOX_TB_BORDER; // draw the text within it - mui.draw_text_full(container, "Device Mapping", x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, + mui.draw_text_full(container, _("Device Mapping"), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); } diff --git a/src/emu/ui/custmenu.cpp b/src/emu/ui/custmenu.cpp index 27cdf2c17c4..3a50f4bfc03 100644 --- a/src/emu/ui/custmenu.cpp +++ b/src/emu/ui/custmenu.cpp @@ -153,7 +153,7 @@ void ui_menu_custom_filter::populate() { // add main filter UINT32 arrow_flags = get_arrow_flags((int)FILTER_ALL, (int)FILTER_UNAVAILABLE, custfltr::main); - item_append("Main filter", main_filters::text[custfltr::main], arrow_flags, (void *)(FPTR)MAIN_FILTER); + item_append(_("Main filter"), main_filters::text[custfltr::main], arrow_flags, (void *)(FPTR)MAIN_FILTER); // add other filters for (int x = 1; x <= custfltr::numother; x++) @@ -162,7 +162,7 @@ void ui_menu_custom_filter::populate() // add filter items arrow_flags = get_arrow_flags((int)FILTER_UNAVAILABLE + 1, (int)FILTER_LAST - 1, custfltr::other[x]); - item_append("Other filter", main_filters::text[custfltr::other[x]], arrow_flags, (void *)(FPTR)(OTHER_FILTER + x)); + item_append(_("Other filter"), main_filters::text[custfltr::other[x]], arrow_flags, (void *)(FPTR)(OTHER_FILTER + x)); if (m_added) selected = item.size() - 2; @@ -189,10 +189,10 @@ void ui_menu_custom_filter::populate() item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); if (custfltr::numother > 0) - item_append("Remove last filter", nullptr, 0, (void *)(FPTR)REMOVE_FILTER); + item_append(_("Remove last filter"), nullptr, 0, (void *)(FPTR)REMOVE_FILTER); if (custfltr::numother < MAX_CUST_FILTER - 2) - item_append("Add filter", nullptr, 0, (void *)(FPTR)ADD_FILTER); + item_append(_("Add filter"), nullptr, 0, (void *)(FPTR)ADD_FILTER); item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; @@ -207,7 +207,7 @@ void ui_menu_custom_filter::custom_render(void *selectedref, float top, float bo ui_manager &mui = machine().ui(); // get the size of the text - mui.draw_text_full(container, "Select custom filters:", 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, + mui.draw_text_full(container, _("Select custom filters:"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; float maxwidth = MAX(width, origx2 - origx1); @@ -227,7 +227,7 @@ void ui_menu_custom_filter::custom_render(void *selectedref, float top, float bo y1 += UI_BOX_TB_BORDER; // draw the text within it - mui.draw_text_full(container, "Select custom filters:", x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, + mui.draw_text_full(container, _("Select custom filters:"), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); } @@ -438,7 +438,7 @@ void ui_menu_swcustom_filter::populate() { // add main filter UINT32 arrow_flags = get_arrow_flags((int)UI_SW_ALL, (int)UI_SW_UNAVAILABLE, sw_custfltr::main); - item_append("Main filter", sw_filters::text[sw_custfltr::main], arrow_flags, (void *)(FPTR)MAIN_FILTER); + item_append(_("Main filter"), sw_filters::text[sw_custfltr::main], arrow_flags, (void *)(FPTR)MAIN_FILTER); // add other filters for (int x = 1; x <= sw_custfltr::numother; x++) @@ -447,7 +447,7 @@ void ui_menu_swcustom_filter::populate() // add filter items arrow_flags = get_arrow_flags((int)UI_SW_UNAVAILABLE + 1, (int)UI_SW_LAST - 1, sw_custfltr::other[x]); - item_append("Other filter", sw_filters::text[sw_custfltr::other[x]], arrow_flags, (void *)(FPTR)(OTHER_FILTER + x)); + item_append(_("Other filter"), sw_filters::text[sw_custfltr::other[x]], arrow_flags, (void *)(FPTR)(OTHER_FILTER + x)); if (m_added) selected = item.size() - 2; @@ -501,10 +501,10 @@ void ui_menu_swcustom_filter::populate() item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); if (sw_custfltr::numother > 0) - item_append("Remove last filter", nullptr, 0, (void *)(FPTR)REMOVE_FILTER); + item_append(_("Remove last filter"), nullptr, 0, (void *)(FPTR)REMOVE_FILTER); if (sw_custfltr::numother < MAX_CUST_FILTER - 2) - item_append("Add filter", nullptr, 0, (void *)(FPTR)ADD_FILTER); + item_append(_("Add filter"), nullptr, 0, (void *)(FPTR)ADD_FILTER); item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); @@ -520,7 +520,7 @@ void ui_menu_swcustom_filter::custom_render(void *selectedref, float top, float ui_manager &mui = machine().ui(); // get the size of the text - mui.draw_text_full(container, "Select custom filters:", 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, + mui.draw_text_full(container, _("Select custom filters:"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; float maxwidth = MAX(width, origx2 - origx1); @@ -540,7 +540,7 @@ void ui_menu_swcustom_filter::custom_render(void *selectedref, float top, float y1 += UI_BOX_TB_BORDER; // draw the text within it - mui.draw_text_full(container, "Select custom filters:", x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, + mui.draw_text_full(container, _("Select custom filters:"), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); } diff --git a/src/emu/ui/mainmenu.cpp b/src/emu/ui/mainmenu.cpp index bd1ac36ee48..b65500f70f5 100644 --- a/src/emu/ui/mainmenu.cpp +++ b/src/emu/ui/mainmenu.cpp @@ -52,109 +52,109 @@ void ui_menu_main::populate() std::string menu_text; /* add input menu items */ - item_append("Input (general)", nullptr, 0, (void *)INPUT_GROUPS); + item_append(_("Input (general)"), nullptr, 0, (void *)INPUT_GROUPS); - strprintf(menu_text, "Input (this %s)", emulator_info::get_capstartgamenoun()); + strprintf(menu_text, _("Input (this %s)"), emulator_info::get_capstartgamenoun()); item_append(menu_text.c_str(), nullptr, 0, (void *)INPUT_SPECIFIC); /* add optional input-related menus */ if (machine().ioport().has_analog()) - item_append("Analog Controls", nullptr, 0, (void *)ANALOG); + item_append(_("Analog Controls"), nullptr, 0, (void *)ANALOG); if (machine().ioport().has_dips()) - item_append("Dip Switches", nullptr, 0, (void *)SETTINGS_DIP_SWITCHES); + item_append(_("Dip Switches"), nullptr, 0, (void *)SETTINGS_DIP_SWITCHES); if (machine().ioport().has_configs()) { - strprintf(menu_text, "%s Configuration", emulator_info::get_capstartgamenoun()); + strprintf(menu_text, _("%s Configuration"), emulator_info::get_capstartgamenoun()); item_append(menu_text.c_str(), nullptr, 0, (void *)SETTINGS_DRIVER_CONFIG); } /* add bookkeeping menu */ - item_append("Bookkeeping Info", nullptr, 0, (void *)BOOKKEEPING); + item_append(_("Bookkeeping Info"), nullptr, 0, (void *)BOOKKEEPING); /* add game info menu */ - strprintf(menu_text, "%s Information", emulator_info::get_capstartgamenoun()); + strprintf(menu_text, _("%s Information"), emulator_info::get_capstartgamenoun()); item_append(menu_text.c_str(), nullptr, 0, (void *)GAME_INFO); image_interface_iterator imgiter(machine().root_device()); if (imgiter.first() != nullptr) { /* add image info menu */ - item_append("Image Information", nullptr, 0, (void *)IMAGE_MENU_IMAGE_INFO); + item_append(_("Image Information"), nullptr, 0, (void *)IMAGE_MENU_IMAGE_INFO); /* add file manager menu */ - item_append("File Manager", nullptr, 0, (void *)IMAGE_MENU_FILE_MANAGER); + item_append(_("File Manager"), nullptr, 0, (void *)IMAGE_MENU_FILE_MANAGER); /* add tape control menu */ cassette_device_iterator cassiter(machine().root_device()); if (cassiter.first() != nullptr) - item_append("Tape Control", nullptr, 0, (void *)TAPE_CONTROL); + item_append(_("Tape Control"), nullptr, 0, (void *)TAPE_CONTROL); } pty_interface_iterator ptyiter(machine().root_device()); if (ptyiter.first() != nullptr) { - item_append("Pseudo terminals", nullptr, 0, (void *)PTY_INFO); + item_append(_("Pseudo terminals"), nullptr, 0, (void *)PTY_INFO); } if (machine().ioport().has_bioses()) - item_append("Bios Selection", nullptr, 0, (void *)BIOS_SELECTION); + item_append(_("Bios Selection"), nullptr, 0, (void *)BIOS_SELECTION); slot_interface_iterator slotiter(machine().root_device()); if (slotiter.first() != nullptr) { /* add slot info menu */ - item_append("Slot Devices", nullptr, 0, (void *)SLOT_DEVICES); + item_append(_("Slot Devices"), nullptr, 0, (void *)SLOT_DEVICES); } barcode_reader_device_iterator bcriter(machine().root_device()); if (bcriter.first() != nullptr) { /* add slot info menu */ - item_append("Barcode Reader", nullptr, 0, (void *)BARCODE_READ); + item_append(_("Barcode Reader"), nullptr, 0, (void *)BARCODE_READ); } network_interface_iterator netiter(machine().root_device()); if (netiter.first() != nullptr) { /* add image info menu */ - item_append("Network Devices", nullptr, 0, (void*)NETWORK_DEVICES); + item_append(_("Network Devices"), nullptr, 0, (void*)NETWORK_DEVICES); } /* add keyboard mode menu */ if (machine().ioport().has_keyboard() && machine().ioport().natkeyboard().can_post()) - item_append("Keyboard Mode", nullptr, 0, (void *)KEYBOARD_MODE); + item_append(_("Keyboard Mode"), nullptr, 0, (void *)KEYBOARD_MODE); /* add sliders menu */ - item_append("Slider Controls", nullptr, 0, (void *)SLIDERS); + item_append(_("Slider Controls"), nullptr, 0, (void *)SLIDERS); /* add video options menu */ - item_append("Video Options", nullptr, 0, (machine().render().target_by_index(1) != nullptr) ? (void *)VIDEO_TARGETS : (void *)VIDEO_OPTIONS); + item_append(_("Video Options"), nullptr, 0, (machine().render().target_by_index(1) != nullptr) ? (void *)VIDEO_TARGETS : (void *)VIDEO_OPTIONS); /* add crosshair options menu */ if (machine().crosshair().get_usage()) - item_append("Crosshair Options", nullptr, 0, (void *)CROSSHAIR); + item_append(_("Crosshair Options"), nullptr, 0, (void *)CROSSHAIR); /* add cheat menu */ if (machine().options().cheat()) - item_append("Cheat", nullptr, 0, (void *)CHEAT); + item_append(_("Cheat"), nullptr, 0, (void *)CHEAT); // add dats menu if (machine().ui().options().enabled_dats() && machine().datfile().has_data(&machine().system())) - item_append("External DAT View", nullptr, 0, (void *)EXTERNAL_DATS); + item_append(_("External DAT View"), nullptr, 0, (void *)EXTERNAL_DATS); item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); /* add favorite menu */ if (!machine().favorite().isgame_favorite()) - item_append("Add To Favorites", nullptr, 0, (void *)ADD_FAVORITE); + item_append(_("Add To Favorites"), nullptr, 0, (void *)ADD_FAVORITE); else - item_append("Remove From Favorites", nullptr, 0, (void *)REMOVE_FAVORITE); + item_append(_("Remove From Favorites"), nullptr, 0, (void *)REMOVE_FAVORITE); item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); -// menu_text.assign("Quit from ").append(emulator_info::get_capstartgamenoun()); +// menu_text.assign(_("Quit from ")).append(emulator_info::get_capstartgamenoun()); // item_append(menu_text.c_str(), nullptr, 0, (void *)QUIT_GAME); /* add reset and exit menus */ - strprintf(menu_text, "Select New %s", emulator_info::get_capstartgamenoun()); + strprintf(menu_text, _("Select New %s"), emulator_info::get_capstartgamenoun()); item_append(menu_text.c_str(), nullptr, 0, (void *)SELECT_GAME); } diff --git a/src/osd/osdcomm.h b/src/osd/osdcomm.h index c4c5501f2e0..d6c9d4f3cbb 100644 --- a/src/osd/osdcomm.h +++ b/src/osd/osdcomm.h @@ -94,6 +94,10 @@ using FPTR = UINT64; using FPTR = UINT32; #endif +/*************************************************************************** + FOR FUTURE LOCALIZATION +***************************************************************************/ +#define _(String) String /*************************************************************************** |