1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-24 06:31:02 +00:00

cataclysm-dda{,-git}: fix locale directory

PREFIX/share/locale should be searched for translations not only on Linux.
This commit is contained in:
Mitsuhiro Nakamura 2018-01-22 19:45:12 +09:00
parent 7287a9e91d
commit d77ce49c75
4 changed files with 44 additions and 0 deletions

View file

@ -18,6 +18,8 @@ stdenv.mkDerivation rec {
buildInputs = [ ncurses lua SDL2 SDL2_image SDL2_ttf SDL2_mixer freetype gettext ]
++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa ];
patches = [ ./patches/fix_locale_dir.patch ];
postPatch = ''
patchShebangs .
sed -i Makefile \

View file

@ -17,6 +17,8 @@ stdenv.mkDerivation rec {
buildInputs = [ ncurses lua SDL2 SDL2_image SDL2_ttf SDL2_mixer freetype gettext ]
++ stdenv.lib.optionals stdenv.isDarwin [ CoreFoundation Cocoa ];
patches = [ ./patches/fix_locale_dir_git.patch ];
postPatch = ''
patchShebangs .
sed -i Makefile \

View file

@ -0,0 +1,20 @@
diff --git a/src/translations.cpp b/src/translations.cpp
index 6520cfe..49f7b2c 100644
--- a/src/translations.cpp
+++ b/src/translations.cpp
@@ -72,15 +72,11 @@ void set_language(bool reload_options)
// Step 2. Bind to gettext domain.
const char *locale_dir;
-#ifdef __linux__
if (!FILENAMES["base_path"].empty()) {
locale_dir = std::string(FILENAMES["base_path"] + "share/locale").c_str();
} else {
locale_dir = "lang/mo";
}
-#else
- locale_dir = "lang/mo";
-#endif // __linux__
bindtextdomain("cataclysm-dda", locale_dir);
bind_textdomain_codeset("cataclysm-dda", "UTF-8");

View file

@ -0,0 +1,20 @@
diff --git a/src/translations.cpp b/src/translations.cpp
index 3a86291..e6c5f84 100644
--- a/src/translations.cpp
+++ b/src/translations.cpp
@@ -176,15 +176,11 @@ void set_language()
// Step 2. Bind to gettext domain.
std::string locale_dir;
-#if (defined __linux__ || (defined MACOSX && !defined TILES))
if( !FILENAMES["base_path"].empty() ) {
locale_dir = FILENAMES["base_path"] + "share/locale";
} else {
locale_dir = "lang/mo";
}
-#else
- locale_dir = "lang/mo";
-#endif // __linux__
const char *locale_dir_char = locale_dir.c_str();
bindtextdomain( "cataclysm-dda", locale_dir_char );