diff --git a/code/localization/localize.cpp b/code/localization/localize.cpp index 78868daf554..a9e7973ea6d 100644 --- a/code/localization/localize.cpp +++ b/code/localization/localize.cpp @@ -78,6 +78,9 @@ typedef struct { SCP_unordered_map Xstr_table_map; bool Xstr_inited = false; +// Distinct from Xstr_inited. FRED and qtfred set Xstr_inited without parsing so that XSTR works without actually localizing anything. +static bool Xstr_tables_parsed = false; + // table/mission externalization stuff -------------------- #define PARSE_TEXT_BUF_SIZE PARSE_BUF_SIZE @@ -190,26 +193,28 @@ void lcl_init(int lang_init) // initialize encryption encrypt_init(); - // set up the first language (which should be English) - Lcl_languages.push_back(Lcl_builtin_languages[0]); + if (Lcl_languages.empty()) { + // set up the first language (which should be English) + Lcl_languages.push_back(Lcl_builtin_languages[0]); - // check string.tbl to see which languages we support - try - { - parse_stringstbl_quick("strings.tbl"); - } - catch (const parse::ParseException& e) - { - mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", "strings.tbl", e.what())); - } + // check string.tbl to see which languages we support + try + { + parse_stringstbl_quick("strings.tbl"); + } + catch (const parse::ParseException& e) + { + mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", "strings.tbl", e.what())); + } - parse_modular_table(NOX("*-lcl.tbm"), parse_stringstbl_quick); + parse_modular_table(NOX("*-lcl.tbm"), parse_stringstbl_quick); - // if we only have one language at this point, we need to setup the builtin languages as we might be dealing with an old style strings.tbl - // which doesn't support anything beyond the builtin languages. Note, we start at i = 1 because we added the first language above. - if (!No_built_in_languages && (static_cast(Lcl_languages.size()) == 1)) { - for (int i=1; i(Lcl_languages.size()) == 1)) { + for (int i=1; i