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

Some fixes around localization #1664

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
8 changes: 8 additions & 0 deletions src/celestia/qt/qtappwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,14 @@ void CelestiaAppWindow::init(const CelestiaCommandLineOptions& options)
exit(1);
}

#ifdef ENABLE_NLS
bindtextdomain("celestia", "locale");
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what else we coould be passing here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think that the main file should be rebound. only celestia-data should be.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And only if translations exist there.

bind_textdomain_codeset("celestia", "UTF-8");
bindtextdomain("celestia-data", "locale");
bind_textdomain_codeset("celestia-data", "UTF-8");
textdomain("celestia");
#endif

// Get the config file name
string configFileName;
if (!options.configFileName.isEmpty())
Expand Down
2 changes: 2 additions & 0 deletions src/celestia/sdl/sdlmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -653,11 +653,13 @@ sdlmain(int /* argc */, char ** /* argv */)
{
setlocale(LC_ALL, "");
setlocale(LC_NUMERIC, "C");
#ifdef ENABLE_NLS
bindtextdomain("celestia", LOCALEDIR);
bind_textdomain_codeset("celestia", "UTF-8");
bindtextdomain("celestia-data", LOCALEDIR);
bind_textdomain_codeset("celestia-data", "UTF-8");
textdomain("celestia");
#endif

const char *dataDir = getenv("CELESTIA_DATA_DIR");
if (dataDir == nullptr)
Expand Down