git.iko.soy/typeable/nixpkgs
on master help sign in
cataclysm-dda{,-git}: fix locale directory

PREFIX/share/locale should be searched for translations not only on Linux.

commitd77ce49c757cf3fab9cabc465509c728afdb31f9 authorMitsuhiro Nakamura <m.nacamura@gmail.com> dateMon 22 Jan 2018, 19:45 (9 years ago) parent7287a9e
4 files changed+44
pkgs/games/cataclysm-dda/default.nix+2 pkgs/games/cataclysm-dda/git.nix+2 pkgs/games/cataclysm-dda/patches/fix_locale_dir.patch+20 pkgs/games/cataclysm-dda/patches/fix_locale_dir_git.patch+20
pkgs/games/cataclysm-dda/default.nix+2
@@ -18,6 +18,8 @@ stdenv.mkDerivation rec {
1818 buildInputs = [ ncurses lua SDL2 SDL2_image SDL2_ttf SDL2_mixer freetype gettext ]
1919 ++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa ];
2020
21+ patches = [ ./patches/fix_locale_dir.patch ];
22+
2123 postPatch = ''
2224 patchShebangs .
2325 sed -i Makefile \
pkgs/games/cataclysm-dda/git.nix+2
@@ -17,6 +17,8 @@ stdenv.mkDerivation rec {
1717 buildInputs = [ ncurses lua SDL2 SDL2_image SDL2_ttf SDL2_mixer freetype gettext ]
1818 ++ stdenv.lib.optionals stdenv.isDarwin [ CoreFoundation Cocoa ];
1919
20+ patches = [ ./patches/fix_locale_dir_git.patch ];
21+
2022 postPatch = ''
2123 patchShebangs .
2224 sed -i Makefile \
pkgs/games/cataclysm-dda/patches/fix_locale_dir.patchnew file+20
@@ -0,0 +1,20 @@
1+diff --git a/src/translations.cpp b/src/translations.cpp
2+index 6520cfe..49f7b2c 100644
3+--- a/src/translations.cpp
4++++ b/src/translations.cpp
5+@@ -72,15 +72,11 @@ void set_language(bool reload_options)
6+
7+ // Step 2. Bind to gettext domain.
8+ const char *locale_dir;
9+-#ifdef __linux__
10+ if (!FILENAMES["base_path"].empty()) {
11+ locale_dir = std::string(FILENAMES["base_path"] + "share/locale").c_str();
12+ } else {
13+ locale_dir = "lang/mo";
14+ }
15+-#else
16+- locale_dir = "lang/mo";
17+-#endif // __linux__
18+
19+ bindtextdomain("cataclysm-dda", locale_dir);
20+ bind_textdomain_codeset("cataclysm-dda", "UTF-8");
pkgs/games/cataclysm-dda/patches/fix_locale_dir_git.patchnew file+20
@@ -0,0 +1,20 @@
1+diff --git a/src/translations.cpp b/src/translations.cpp
2+index 3a86291..e6c5f84 100644
3+--- a/src/translations.cpp
4++++ b/src/translations.cpp
5+@@ -176,15 +176,11 @@ void set_language()
6+
7+ // Step 2. Bind to gettext domain.
8+ std::string locale_dir;
9+-#if (defined __linux__ || (defined MACOSX && !defined TILES))
10+ if( !FILENAMES["base_path"].empty() ) {
11+ locale_dir = FILENAMES["base_path"] + "share/locale";
12+ } else {
13+ locale_dir = "lang/mo";
14+ }
15+-#else
16+- locale_dir = "lang/mo";
17+-#endif // __linux__
18+
19+ const char *locale_dir_char = locale_dir.c_str();
20+ bindtextdomain( "cataclysm-dda", locale_dir_char );