This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot.
commit 25d5d105fdf0aa68509a9627eca3b0588f95c957 Author: krzys-h <krzy...@interia.pl> Date: Fri Oct 31 21:23:10 2014 +0100 Fallback to English files if translated ones are not available --- src/object/level/parserparam.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/object/level/parserparam.cpp b/src/object/level/parserparam.cpp index ee080b2..1f81f0e 100644 --- a/src/object/level/parserparam.cpp +++ b/src/object/level/parserparam.cpp @@ -22,6 +22,7 @@ #include "app/app.h" #include "common/logger.h" +#include "common/resources/resourcemanager.h" #include "object/level/parser.h" #include "object/robotmain.h" @@ -174,10 +175,19 @@ std::string CLevelParserParam::InjectLevelDir(std::string path, const std::strin { newPath = defaultDir + (!defaultDir.empty() ? "/" : "") + newPath; } - //TODO: Fallback to English + + std::string langPath = newPath; std::string langStr(1, CApplication::GetInstancePointer()->GetLanguageChar()); - boost::replace_all(newPath, "%lng%", langStr); - return newPath; + boost::replace_all(langPath, "%lng%", langStr); + if(CResourceManager::Exists(langPath)) + return langPath; + + // Fallback to English if file doesn't exist + boost::replace_all(newPath, "%lng%", "E"); + if(CResourceManager::Exists(newPath)) + return newPath; + + return langPath; // Return current language file if none of the files exist } std::string CLevelParserParam::ToPath(std::string path, const std::string defaultDir) -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git _______________________________________________ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits