Skip to content

Commit

Permalink
Attempt to fix localization not working
Browse files Browse the repository at this point in the history
  • Loading branch information
Coolthulhu committed Sep 29, 2020
1 parent 44aa6dc commit 7379d28
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions lang/CMakeLists.txt
Expand Up @@ -22,13 +22,13 @@ add_custom_target (
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)

# Generate cataclysm-dda.pot
# Generate cataclysm-bn.pot
add_custom_target (
translations
COMMAND xgettext --default-domain="cataclysm-dda"
--sort-by-file
--add-comments="~"
--output="${CMAKE_SOURCE_DIR}/lang/po/cataclysm-dda.pot"
--output="${CMAKE_SOURCE_DIR}/lang/po/cataclysm-bn.pot"
--keyword="_"
--keyword="pgettext:1c,2"
--keyword="ngettext:1,2"
Expand Down Expand Up @@ -77,7 +77,7 @@ foreach (LANG ${LANGUAGES})
add_custom_command (
TARGET translations_prepare
PRE_BUILD
COMMAND msgen ${CMAKE_SOURCE_DIR}/lang/po/cataclysm-dda.pot --output-file=${CMAKE_SOURCE_DIR}/lang/po/en.po
COMMAND msgen ${CMAKE_SOURCE_DIR}/lang/po/cataclysm-bn.pot --output-file=${CMAKE_SOURCE_DIR}/lang/po/en.po
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
ENDIF (${LANG} STREQUAL en)
Expand Down
8 changes: 4 additions & 4 deletions src/translations.cpp
Expand Up @@ -219,7 +219,7 @@ void set_language()
// This is because of our hacky libintl-lite bindtextdomain() implementation.
auto env = getenv( "LANGUAGE" );
locale_dir = std::string( PATH_INFO::base_path() + "lang/mo/" + ( env ? env : "none" ) +
"/LC_MESSAGES/cataclysm-dda.mo" );
"/LC_MESSAGES/cataclysm-bn.mo" );
#elif (defined(__linux__) || (defined(MACOSX) && !defined(TILES)))
if( !PATH_INFO::base_path().empty() ) {
locale_dir = PATH_INFO::base_path() + "share/locale";
Expand All @@ -231,9 +231,9 @@ void set_language()
#endif

const char *locale_dir_char = locale_dir.c_str();
bindtextdomain( "cataclysm-dda", locale_dir_char );
bind_textdomain_codeset( "cataclysm-dda", "UTF-8" );
textdomain( "cataclysm-dda" );
bindtextdomain( "cataclysm-bn", locale_dir_char );
bind_textdomain_codeset( "cataclysm-bn", "UTF-8" );
textdomain( "cataclysm-bn" );

reload_names();

Expand Down

0 comments on commit 7379d28

Please sign in to comment.