I18N: Switch to getting categories by index instead of by string lookup

Also gets rid of the shared_ptr usage, and generally makes things nicer.

Needed for later config refactorings, good to get in early.
This commit is contained in:
Henrik Rydgård committed 2023-04-07 10:35:01 +02:00
1 parent 07b8b6f35a
commit ee6234ecb6
65 files changed
+535 -516

No files matched your search

+8 -8
View File
@@ -479,7 +479,7 @@ namespace SaveState
return StringFromFormat("%s (%c)", title.c_str(), slotChar);
}
if (detectSlot(UNDO_STATE_EXTENSION)) {
auto sy = GetI18NCategory("System");
auto sy = GetI18NCategory(I18NCat::SYSTEM);
// Allow the number to be positioned where it makes sense.
std::string undo = sy->T("undo %c");
return title + " (" + StringFromFormat(undo.c_str(), slotChar) + ")";
@@ -500,7 +500,7 @@ namespace SaveState
}
// The file can't be loaded - let's note that.
auto sy = GetI18NCategory("System");
auto sy = GetI18NCategory(I18NCat::SYSTEM);
return filename.GetFilename() + " " + sy->T("(broken)");
}
@@ -582,7 +582,7 @@ namespace SaveState
Load(fn, slot, callback, cbUserData);
}
} else {
auto sy = GetI18NCategory("System");
auto sy = GetI18NCategory(I18NCat::SYSTEM);
if (callback)
callback(Status::FAILURE, sy->T("Failed to load state. Error in the file system."), cbUserData);
}
@@ -591,7 +591,7 @@ namespace SaveState
bool UndoLoad(const Path &gameFilename, Callback callback, void *cbUserData)
{
if (g_Config.sStateLoadUndoGame != GenerateFullDiscId(gameFilename)) {
auto sy = GetI18NCategory("System");
auto sy = GetI18NCategory(I18NCat::SYSTEM);
if (callback)
callback(Status::FAILURE, sy->T("Error: load undo state is from a different game"), cbUserData);
return false;
@@ -602,7 +602,7 @@ namespace SaveState
Load(fn, LOAD_UNDO_SLOT, callback, cbUserData);
return true;
} else {
auto sy = GetI18NCategory("System");
auto sy = GetI18NCategory(I18NCat::SYSTEM);
if (callback)
callback(Status::FAILURE, sy->T("Failed to load state for load undo. Error in the file system."), cbUserData);
return false;
@@ -641,7 +641,7 @@ namespace SaveState
SaveScreenshot(shot, Callback(), 0);
Save(fn.WithExtraExtension(".tmp"), slot, renameCallback, cbUserData);
} else {
auto sy = GetI18NCategory("System");
auto sy = GetI18NCategory(I18NCat::SYSTEM);
if (callback)
callback(Status::FAILURE, sy->T("Failed to save state. Error in the file system."), cbUserData);
}
@@ -857,7 +857,7 @@ namespace SaveState
}
static Status TriggerLoadWarnings(std::string &callbackMessage) {
auto sc = GetI18NCategory("Screen");
auto sc = GetI18NCategory(I18NCat::SCREEN);
if (g_Config.bHideStateWarnings)
return Status::SUCCESS;
@@ -913,7 +913,7 @@ namespace SaveState
std::string callbackMessage;
std::string title;
auto sc = GetI18NCategory("Screen");
auto sc = GetI18NCategory(I18NCat::SCREEN);
const char *i18nLoadFailure = sc->T("Load savestate failed", "");
const char *i18nSaveFailure = sc->T("Save State Failed", "");
if (strlen(i18nLoadFailure) == 0)