1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 17:49:43 +01:00

Make language sync support creating blank language files

Two translators thus far have tried to populate initial language files
by creating a blank folder and then using the in-game sync option. For
example, see #1078.

That is not how the sync option was intended to be used, but it's
really close to getting everything, so I decided to just complete the
support by making sure numbers.xml is copied from English, and making
sure meta.xml is filled in with English text and not text from an
arbitrary language. Also, minor detail on plural form 1 being set to 1
by default if reset, so strings_plural.xml is fully consistent too.
This commit is contained in:
Dav999 2023-12-08 02:05:24 +01:00 committed by Misa Elizabeth Kai
parent 66ba557c4d
commit 6377fd5e73
2 changed files with 16 additions and 0 deletions

View file

@ -177,6 +177,17 @@ static void sync_lang_file(const std::string& langcode)
FILESYSTEM_saveTiXml2Document((langcode + "/strings.xml").c_str(), doc); FILESYSTEM_saveTiXml2Document((langcode + "/strings.xml").c_str(), doc);
} }
if (!load_lang_doc("numbers", doc, langcode))
{
/* If numbers.xml doesn't exist _at all_, then simply copy it from English,
* so that you can make a new translation simply by making a folder and syncing. */
if (load_lang_doc("numbers", doc, "en"))
{
FILESYSTEM_saveTiXml2Document((langcode + "/numbers.xml").c_str(), doc);
}
}
if (load_lang_doc("strings_plural", doc, "en")) if (load_lang_doc("strings_plural", doc, "en"))
{ {
/* Form 255 is technically invalid, but we have to account for it */ /* Form 255 is technically invalid, but we have to account for it */

View file

@ -59,6 +59,10 @@ static void loadmeta(LangMeta& meta, const std::string& langcode = lang)
{ {
meta.active = true; meta.active = true;
meta.code = langcode; meta.code = langcode;
meta.nativename = langcode;
meta.credit = "";
meta.action_hint = "Press Space, Z, or V to select";
meta.gamepad_hint = "Press {button} to select";
meta.autowordwrap = true; meta.autowordwrap = true;
meta.toupper = true; meta.toupper = true;
meta.toupper_i_dot = false; meta.toupper_i_dot = false;
@ -238,6 +242,7 @@ void resettext(bool final_shutdown)
number[i] = ""; number[i] = "";
} }
SDL_zeroa(number_plural_form); SDL_zeroa(number_plural_form);
number_plural_form[1] = 1;
SDL_zeroa(translation_roomnames); SDL_zeroa(translation_roomnames);
SDL_zeroa(explanation_roomnames); SDL_zeroa(explanation_roomnames);