mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-31 02:14:09 +03:00
Add localization "foundation" (many code changes)
This commit adds most of the code changes necessary for making the game translatable, but does not yet "unhardcode" nearly all of the strings (except in a few cases where it was hard to separate added loc::gettexts from foundational code changes, or all the localization- related menus which were also added by this commit.) This commit is part of rewritten history of the localization branch. The original (unsquashed) commit history can be found here: https://github.com/Dav999-v/VVVVVV/tree/localization-orig
This commit is contained in:
committed by
Misa Elizabeth Kai
parent
35d92e8e64
commit
ec611ffa9d
@@ -18,6 +18,8 @@
|
||||
#include "Graphics.h"
|
||||
#include "GraphicsUtil.h"
|
||||
#include "KeyPoll.h"
|
||||
#include "Localization.h"
|
||||
#include "LocalizationStorage.h"
|
||||
#include "Map.h"
|
||||
#include "Script.h"
|
||||
#include "UtilityClass.h"
|
||||
@@ -81,6 +83,24 @@ static bool compare_nocase (std::string first, std::string second)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* translate_title and translate_creator are used to display default title/author
|
||||
* as being translated, while they're actually stored in English in the level file.
|
||||
* This way we translate "Untitled Level" and "Unknown" without
|
||||
* spreading around translations in level files posted online! */
|
||||
std::string translate_title(const std::string& title)
|
||||
{
|
||||
if (title == "Untitled Level")
|
||||
return loc::gettext("Untitled Level");
|
||||
return title;
|
||||
}
|
||||
|
||||
std::string translate_creator(const std::string& creator)
|
||||
{
|
||||
if (creator == "Unknown")
|
||||
return loc::gettext("Unknown");
|
||||
return creator;
|
||||
}
|
||||
|
||||
static void levelZipCallback(const char* filename)
|
||||
{
|
||||
if (!FILESYSTEM_isFile(filename))
|
||||
@@ -228,6 +248,9 @@ static void levelMetaDataCallback(const char* filename)
|
||||
|
||||
if (cl.getLevelMetaData(filename_, temp))
|
||||
{
|
||||
temp.title = translate_title(temp.title);
|
||||
temp.creator = translate_creator(temp.creator);
|
||||
|
||||
cl.ListOfMetaData.push_back(temp);
|
||||
}
|
||||
}
|
||||
@@ -318,7 +341,7 @@ void customlevelclass::reset(void)
|
||||
mapwidth=5;
|
||||
mapheight=5;
|
||||
|
||||
title="Untitled Level";
|
||||
title="Untitled Level"; // Already translatable
|
||||
creator="Unknown";
|
||||
|
||||
levmusic=0;
|
||||
@@ -1288,6 +1311,8 @@ next:
|
||||
ed.gethooks();
|
||||
#endif
|
||||
|
||||
loc::loadtext_custom(_path.c_str());
|
||||
|
||||
version=2;
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user