Merge lp:~aber/widelands/0x0000000000000000 into lp:widelands

Proposed by David Allwicher
Status: Merged
Merged at revision: 5867
Proposed branch: lp:~aber/widelands/0x0000000000000000
Merge into: lp:widelands
Diff against target: 32 lines (+12/-5)
1 file modified
src/i18n.cc (+12/-5)
To merge this branch: bzr merge lp:~aber/widelands/0x0000000000000000
Reviewer Review Type Date Requested Status
Tino Approve
Review via email: mp+50681@code.launchpad.net

Description of the change

I don't know if this code is semantically equivalent, but we need to make sure we don't access 0x0000000000000000.
So, i'm still not able to make a new widelands package. :'(
The problem is, if you start from the console, the console is your parent process and you have a different environment. So I did not notice this at first.

To post a comment you must log in.
Revision history for this message
Tino (tino79) wrote :

Applied and checked on windows.
Compiles fine.
Packaged&installed Widelands still shows all languages and detects system language correctly.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/i18n.cc'
2--- src/i18n.cc 2011-02-16 18:51:00 +0000
3+++ src/i18n.cc 2011-02-22 18:52:38 +0000
4@@ -116,16 +116,23 @@
5 * Code inspired by wesnoth.org
6 */
7 void init_locale() {
8+ env_locale = std::string();
9 #ifdef _WIN32
10- env_locale = "";
11 locale = "English";
12 SETLOCALE(LC_ALL, "English");
13 #else
14 // first, save environment variable
15- env_locale = getenv("LANG");
16- if (env_locale.empty())
17- env_locale = getenv("LANGUAGE");
18-
19+ char * lang;
20+ lang = getenv("LANG");
21+ if (lang != NULL) {
22+ env_locale = lang;
23+ }
24+ if (env_locale.empty()) {
25+ lang = getenv("LANGUAGE");
26+ if (lang != NULL) {
27+ env_locale = lang;
28+ }
29+ }
30 locale = "C";
31 SETLOCALE(LC_ALL, "C");
32 SETLOCALE(LC_MESSAGES, "");

Subscribers

People subscribed via source and target branches

to status/vote changes: