Skip to content

Commit

Permalink
Log locale info to help debug i18n
Browse files Browse the repository at this point in the history
In each of the three places where the global locale is changed, log the
results of that change to the debug log.
  • Loading branch information
jbytheway committed May 1, 2020
1 parent 384377e commit d106065
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,9 @@ int main( int argc, char *argv[] )
}
#endif

DebugLog( D_INFO, DC_ALL ) << "[main] C locale set to " << setlocale( LC_ALL, nullptr );
DebugLog( D_INFO, DC_ALL ) << "[main] C++ locale set to " << std::locale().name();

#if defined(TILES)
SDL_version compiled;
SDL_VERSION( &compiled );
Expand Down
3 changes: 3 additions & 0 deletions src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3130,4 +3130,7 @@ void options_manager::update_global_locale()
} catch( std::runtime_error &e ) {
std::locale::global( std::locale() );
}

DebugLog( D_INFO, DC_ALL ) << "[options] C locale set to " << setlocale( LC_ALL, nullptr );
DebugLog( D_INFO, DC_ALL ) << "[options] C++ locale set to " << std::locale().name();
}
2 changes: 2 additions & 0 deletions src/translations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ void set_language()
if( setlocale( LC_ALL, ".1252" ) == nullptr ) {
DebugLog( D_WARNING, D_MAIN ) << "Error while setlocale(LC_ALL, '.1252').";
}
DebugLog( D_INFO, DC_ALL ) << "[translations] C locale set to " << setlocale( LC_ALL, nullptr );
DebugLog( D_INFO, DC_ALL ) << "[translations] C++ locale set to " << std::locale().name();
#endif

// Step 2. Bind to gettext domain.
Expand Down

0 comments on commit d106065

Please sign in to comment.