mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-06-28 23:48:30 +02:00
If you've never set a language before (<lang_set> is not 1), then the language screen will show up before the title screen. Selecting the language will then make the title screen show up. If no language files are present, the old logic for handling this was to simply show the language screen at startup anyway, and let it display the error message that language files are missing, as a warning that the game is not packaged correctly. However, this logic has two flaws: - If the user has ever had language files and set a language before (in a VVVVVV on that computer), the warning element is gone because the language screen is not shown in that case - the game is simply in English - If the user has never set a language before, and then goes to the language screen later via the menu, they will be sent to the title screen, even if they were in-game. The main menu will also be broken. The new way is to not show the language screen at startup if language files are missing, and to change the logic so that you will only be sent to the title screen if you actually haven't seen the title screen yet. I will also add a proper warning that fonts or language files are missing by adding a message in the bottom left corner (in place of the MMMMMM installed message).
100 lines
3.4 KiB
C++
100 lines
3.4 KiB
C++
#ifndef LOCALIZATION_H
|
|
#define LOCALIZATION_H
|
|
|
|
#include <stdint.h>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
/* The translator menu will appear in any of the following circumstances:
|
|
* - The "lang" folder is NOT next to data.zip, but it is found in "desktop_version" within which the game is running
|
|
* - The command line argument "-translator" is passed
|
|
* - ALWAYS_SHOW_TRANSLATOR_MENU is defined
|
|
*/
|
|
// #define ALWAYS_SHOW_TRANSLATOR_MENU
|
|
|
|
namespace loc
|
|
{
|
|
|
|
struct LangMeta
|
|
{
|
|
bool active; // = true, language is shown in the list
|
|
std::string code;
|
|
std::string nativename;
|
|
std::string credit;
|
|
std::string action_hint;
|
|
std::string gamepad_hint;
|
|
bool autowordwrap; // = true; enable automatic wordwrapping
|
|
bool toupper; // = true; enable automatic full-caps for menu options
|
|
bool toupper_i_dot; // = false; enable Turkish i mapping when uppercasing
|
|
bool toupper_lower_escape_char; // = false; enable ~ to mark lowercase letters for uppercasing
|
|
std::string menu_select;
|
|
std::string menu_select_tight;
|
|
uint8_t font_idx;
|
|
};
|
|
|
|
struct TextboxFormat
|
|
{
|
|
const char* text;
|
|
unsigned short wraplimit; // = 36*8-pad_left-pad_right; no effect if tt or !langmeta.autowordwrap
|
|
unsigned short wraplimit_raw; // original value of wraplimit, only used for language file sync
|
|
bool tt; // teletype, don't auto-wordwrap
|
|
bool centertext; // whether the text should be centered inside the box
|
|
unsigned char pad_left; // pad with X characters
|
|
unsigned char pad_right;
|
|
unsigned short padtowidth; // pad to X pixels (0 to disable)
|
|
};
|
|
|
|
extern bool lang_set;
|
|
extern bool pre_title_lang_menu;
|
|
|
|
extern std::string lang;
|
|
extern std::string lang_custom;
|
|
extern std::string new_level_font;
|
|
extern LangMeta langmeta;
|
|
extern std::vector<LangMeta> languagelist;
|
|
extern int languagelist_curlang;
|
|
extern bool show_translator_menu;
|
|
extern size_t limitscheck_current_overflow;
|
|
extern std::vector<std::string> testable_script_ids;
|
|
|
|
extern int n_untranslated_roomnames;
|
|
extern int n_unexplained_roomnames;
|
|
extern int n_untranslated_roomnames_custom;
|
|
extern int n_unexplained_roomnames_custom;
|
|
extern int n_untranslated_roomnames_area[9];
|
|
|
|
enum n_untranslated_index
|
|
{
|
|
UNTRANSLATED_STRINGS = 0,
|
|
UNTRANSLATED_NUMBERS,
|
|
UNTRANSLATED_STRINGS_PLURAL,
|
|
UNTRANSLATED_CUTSCENES,
|
|
UNTRANSLATED_ROOMNAMES_SPECIAL,
|
|
COUNT_UNTRANSLATED_INDEX
|
|
};
|
|
extern int n_untranslated[COUNT_UNTRANSLATED_INDEX];
|
|
|
|
|
|
const LangMeta* get_langmeta(void);
|
|
|
|
const char* gettext(const char* eng);
|
|
const char* gettext_case(const char* eng, char textcase);
|
|
const char* gettext_plural(const char* eng_plural, const char* eng_singular, int count);
|
|
void gettext_plural_fill(char* buf, size_t buf_len, const char* eng_plural, const char* eng_singular, const char* args_index, ...);
|
|
std::string getnumber(int n);
|
|
const TextboxFormat* gettext_cutscene(const std::string& script_id, const std::string& eng, char textcase);
|
|
const char* get_roomname_explanation(bool custom_level, int roomx, int roomy);
|
|
const char* get_roomname_translation(bool custom_level, int roomx, int roomy);
|
|
const char* gettext_roomname(bool custom_level, int roomx, int roomy, const char* eng, bool special);
|
|
const char* gettext_roomname_special(const char* eng);
|
|
|
|
bool is_cutscene_translated(const std::string& script_id);
|
|
|
|
uint32_t toupper_ch(uint32_t ch);
|
|
std::string toupper(const std::string& lower);
|
|
std::string remove_toupper_escape_chars(const std::string& _s);
|
|
|
|
} /* namespace loc */
|
|
|
|
#endif /* LOCALIZATION_H */
|