Allow the language ini path to be overridden for translation testing purposes.

This commit is contained in:
The Dax 2014-02-12 18:31:54 -05:00
parent 474890b450
commit 72546b83a7
2 changed files with 22 additions and 2 deletions

View File

@ -36,6 +36,7 @@
#include "Core/MIPS/JitCommon/JitCommon.h"
#include "Core/HLE/sceUtility.h"
#include "Common/CPUDetect.h"
#include "Common/FileUtil.h"
#include "ui_atlas.h"
@ -320,7 +321,18 @@ void NewLanguageScreen::OnCompleted(DialogResult result) {
g_Config.sLanguageIni = code;
if (i18nrepo.LoadIni(g_Config.sLanguageIni)) {
bool iniLoadedSuccessfully = false;
// Allow the lang directory to be overridden for testing purposes (e.g. Android, where it's hard to
// test new languages without recompiling the entire app, which is a hassle).
const std::string langOverridePath = g_Config.memCardDirectory + "PSP/SYSTEM/lang/";
// If we run into the unlikely case that "lang" is actually a file, just use the built-in translations.
if (!File::Exists(langOverridePath) || !File::IsDirectory(langOverridePath))
iniLoadedSuccessfully = i18nrepo.LoadIni(g_Config.sLanguageIni);
else
iniLoadedSuccessfully = i18nrepo.LoadIni(g_Config.sLanguageIni, langOverridePath);
if (iniLoadedSuccessfully) {
// Dunno what else to do here.
if (langValuesMapping.find(code) == langValuesMapping.end()) {
// Fallback to English

View File

@ -383,8 +383,16 @@ void NativeInit(int argc, const char *argv[],
if (!gfxLog)
logman->SetLogLevel(LogTypes::G3D, LogTypes::LERROR);
#endif
// Allow the lang directory to be overridden for testing purposes (e.g. Android, where it's hard to
// test new languages without recompiling the entire app, which is a hassle).
const std::string langOverridePath = g_Config.memCardDirectory + "PSP/SYSTEM/lang/";
// If we run into the unlikely case that "lang" is actually a file, just use the built-in translations.
if (!File::Exists(langOverridePath) || !File::IsDirectory(langOverridePath))
i18nrepo.LoadIni(g_Config.sLanguageIni);
else
i18nrepo.LoadIni(g_Config.sLanguageIni, langOverridePath);
i18nrepo.LoadIni(g_Config.sLanguageIni);
I18NCategory *d = GetI18NCategory("DesktopUI");
// Note to translators: do not translate this/add this to PPSSPP-lang's files.
// It's intended to be custom for every user.