From d836126c754957cb572622adbfd4f6859f1293ee Mon Sep 17 00:00:00 2001 From: Thomas Geymayer <tomgey@gmail.com> Date: Wed, 30 Jul 2014 23:53:16 +0200 Subject: [PATCH] Better fallback for missing menu and splash translations. --- src/GUI/menubar.cxx | 4 ++-- src/Viewer/splash.cxx | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/GUI/menubar.cxx b/src/GUI/menubar.cxx index 444795fd5..40191e37b 100644 --- a/src/GUI/menubar.cxx +++ b/src/GUI/menubar.cxx @@ -26,8 +26,8 @@ FGMenuBar::getLocalizedLabel(SGPropertyNode* node) if (translated) return translated; - // return default - return node->getStringValue("label"); + // return default with fallback to name + return node->getStringValue("label", name); } // end of menubar.cxx diff --git a/src/Viewer/splash.cxx b/src/Viewer/splash.cxx index 5452aac64..03995c44f 100644 --- a/src/Viewer/splash.cxx +++ b/src/Viewer/splash.cxx @@ -395,12 +395,14 @@ void fgSplashProgress( const char *identifier ) { fgSetString("/sim/startup/splash-progress-spinner", spin_status); - const char* text = ""; + std::string text; if (identifier[0] != 0) { - std::string id = std::string("splash/") + identifier; - text = globals->get_locale()->getLocalizedString(id.c_str(), - "sys", "<incomplete language resource>"); + std::string id = std::string("splash/") + identifier; + text = globals->get_locale()->getLocalizedString(id.c_str(), "sys", ""); + + if( text.empty() ) + text = "<incomplete language resource>: " + id; } if (!strcmp(identifier,"downloading-scenery")) { @@ -414,9 +416,8 @@ void fgSplashProgress( const char *identifier ) { return; } - if (!strcmp(fgGetString("/sim/startup/splash-progress-text"), text)) { - return; - } + if( fgGetString("/sim/startup/splash-progress-text") == text ) + return; SG_LOG( SG_VIEW, SG_INFO, "Splash screen progress " << identifier ); fgSetString("/sim/startup/splash-progress-text", text);