Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include game language in debug game report #38863

Merged
merged 2 commits into from
Mar 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1260,11 +1260,21 @@ std::string game_info::game_report()
os_version = "<unknown>";
}
std::stringstream report;

std::string lang = get_option<std::string>( "USE_LANG" );
std::string lang_translated;
for( const options_manager::id_and_option &vItem : options_manager::lang_options ) {
if( vItem.first == lang ) {
lang_translated = vItem.second.translated();
}
}

report <<
"- OS: " << operating_system() << "\n" <<
" - OS Version: " << os_version << "\n" <<
"- Game Version: " << game_version() << " [" << bitness() << "]\n" <<
"- Graphics Version: " << graphics_version() << "\n" <<
"- Game Language: " << lang_translated << " [" << lang << "]\n" <<
"- Mods loaded: [\n " << mods_loaded() << "\n]\n";

return report.str();
Expand Down
40 changes: 21 additions & 19 deletions src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,26 @@ bool tile_iso;
std::map<std::string, std::string> TILESETS; // All found tilesets: <name, tileset_dir>
std::map<std::string, std::string> SOUNDPACKS; // All found soundpacks: <name, soundpack_dir>

std::vector<options_manager::id_and_option> options_manager::lang_options = {
{ "", translate_marker( "System language" ) },
// Note: language names are in their own language and are *not* translated at all.
// Note: Somewhere in Github PR was better link to msdn.microsoft.com with language names.
// http://en.wikipedia.org/wiki/List_of_language_names
{ "en", no_translation( R"(English)" ) },
{ "de", no_translation( R"(Deutsch)" ) },
{ "es_AR", no_translation( R"(Español (Argentina))" ) },
{ "es_ES", no_translation( R"(Español (España))" ) },
{ "fr", no_translation( R"(Français)" ) },
{ "hu", no_translation( R"(Magyar)" ) },
{ "ja", no_translation( R"(日本語)" ) },
{ "ko", no_translation( R"(한국어)" ) },
{ "pl", no_translation( R"(Polski)" ) },
{ "pt_BR", no_translation( R"(Português (Brasil))" )},
{ "ru", no_translation( R"(Русский)" ) },
{ "zh_CN", no_translation( R"(中文 (天朝))" ) },
{ "zh_TW", no_translation( R"(中文 (台灣))" ) },
};

options_manager &get_options()
{
static options_manager single_instance;
Expand Down Expand Up @@ -1307,25 +1327,7 @@ void options_manager::add_options_interface()

// TODO: scan for languages like we do for tilesets.
add( "USE_LANG", "interface", translate_marker( "Language" ),
translate_marker( "Switch Language." ), {
{ "", translate_marker( "System language" ) },
// Note: language names are in their own language and are *not* translated at all.
// Note: Somewhere in Github PR was better link to msdn.microsoft.com with language names.
// http://en.wikipedia.org/wiki/List_of_language_names
{ "en", no_translation( R"(English)" ) },
{ "de", no_translation( R"(Deutsch)" ) },
{ "es_AR", no_translation( R"(Español (Argentina))" ) },
{ "es_ES", no_translation( R"(Español (España))" ) },
{ "fr", no_translation( R"(Français)" ) },
{ "hu", no_translation( R"(Magyar)" ) },
{ "ja", no_translation( R"(日本語)" ) },
{ "ko", no_translation( R"(한국어)" ) },
{ "pl", no_translation( R"(Polski)" ) },
{ "pt_BR", no_translation( R"(Português (Brasil))" )},
{ "ru", no_translation( R"(Русский)" ) },
{ "zh_CN", no_translation( R"(中文 (天朝))" ) },
{ "zh_TW", no_translation( R"(中文 (台灣))" ) },
}, "" );
translate_marker( "Switch Language." ), options_manager::lang_options, "" );

add_empty_line();

Expand Down
1 change: 1 addition & 0 deletions src/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class options_manager
: std::pair<std::string, translation>( first, second ) {
}
};
static std::vector<id_and_option> lang_options;
private:
static std::vector<id_and_option> build_tilesets_list();
static std::vector<id_and_option> build_soundpacks_list();
Expand Down