Merge branch 'master' into dev

dev-ui
Piotr Dziwinski 2012-12-15 20:23:58 +01:00
commit 72ce040054
12 changed files with 6721 additions and 4901 deletions

View File

@ -42,6 +42,7 @@ find_package(SDL 1.2.10 REQUIRED)
find_package(SDL_image 1.2 REQUIRED)
find_package(SDL_ttf 2.0 REQUIRED)
find_package(PNG 1.2 REQUIRED)
find_package(LTDL 2.4.2 REQUIRED)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
@ -128,8 +129,12 @@ endif()
if(${TESTS})
# Google Test library
set(GTEST_DIR "${colobot_SOURCE_DIR}/lib/gtest")
add_subdirectory(lib/gtest bin/test)
find_path(GTEST_SRC_DIR NAMES src/gtest.cc src/gtest-all.cc PATHS /usr/src/ PATH_SUFFIXES gtest)
if(GTEST_SRC_DIR)
add_subdirectory(${GTEST_SRC_DIR} bin/test)
else()
add_subdirectory(lib/gtest bin/test)
endif()
endif()
# Subdirectory with sources

30
cmake/FindLTDL.cmake Normal file
View File

@ -0,0 +1,30 @@
# Find the native LTDL includes and library
# Copied verbatim from
# http://code.metager.de/source/xref/hshannover/trust/tnc-fhh/shared/cmake_modules/FindLTDL.cmake
# The above version was under GPL-2, this one is under GPL-3, for consistency
# with the rest of the colobot project.
#
# This module defines
# LTDL_INCLUDE_DIR, where to find ltdl.h, etc.
# LTDL_LIBRARY, where to find the LTDL library.
# LTDL_FOUND, If false, do not try to use LTDL.
FIND_PATH(LTDL_INCLUDE_DIR ltdl.h)
FIND_LIBRARY(LTDL_LIBRARY ltdl)
IF (LTDL_INCLUDE_DIR AND LTDL_LIBRARY)
SET(LTDL_FOUND TRUE)
ELSE(LTDL_INCLUDE_DIR AND LTDL_LIBRARY)
SET(LTDL_FOUND FALSE)
ENDIF (LTDL_INCLUDE_DIR AND LTDL_LIBRARY)
IF (LTDL_FOUND)
IF (NOT LTDL_FIND_QUIETLY)
MESSAGE(STATUS "Found LTDL: ${LTDL_LIBRARY}")
ENDIF (NOT LTDL_FIND_QUIETLY)
ELSE (LTDL_FOUND)
IF (LTDL_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find LTDL")
ENDIF (LTDL_FIND_REQUIRED)
ENDIF (LTDL_FOUND)

View File

@ -4,6 +4,8 @@ add_subdirectory(CBot)
# Tools directory is built separately
add_subdirectory(tools)
add_subdirectory(po)
# Tests
if(${TESTS})
add_subdirectory(common/test)
@ -171,7 +173,7 @@ ${PNG_LIBRARIES}
${OPTIONAL_LIBS}
${PLATFORM_LIBS}
${Boost_LIBRARIES}
ltdl
${LTDL_LIBRARY}
CBot
)

View File

@ -132,7 +132,7 @@ CApplication::CApplication()
m_dataPath = "./data";
m_language = LANGUAGE_ENGLISH;
m_language = LANGUAGE_ENV;
m_lowCPU = true;
@ -290,9 +290,14 @@ bool CApplication::Create()
/* Gettext initialization */
std::string locale = "C";
std::string locale = "";
switch (m_language)
{
default:
case LANGUAGE_ENV:
locale = "";
break;
case LANGUAGE_ENGLISH:
locale = "en_US.utf8";
break;
@ -314,7 +319,8 @@ bool CApplication::Create()
langStr += locale;
strcpy(S_LANGUAGE, langStr.c_str());
putenv(S_LANGUAGE);
setlocale(LC_ALL, locale.c_str());
setlocale(LC_ALL, "");
GetLogger()->Debug("Set locale to '%s'\n", locale.c_str());
std::string trPath = m_dataPath + "/" + m_dataDirs[DIR_I18N];
bindtextdomain("colobot", trPath.c_str());

View File

@ -165,6 +165,7 @@ enum Error
*/
enum Language
{
LANGUAGE_ENV = -1,
LANGUAGE_ENGLISH = 0,
LANGUAGE_FRENCH = 1,
LANGUAGE_GERMAN = 2,

View File

@ -9,4 +9,4 @@ include_directories(".")
include_directories("../../")
include_directories("../../../")
target_link_libraries(manager_test ltdl)
target_link_libraries(manager_test ${LTDL_LIBRARY})

24
src/po/CMakeLists.txt Normal file
View File

@ -0,0 +1,24 @@
cmake_minimum_required(VERSION 2.8)
SET(_potFile colobot.pot)
# TODO: Use a finder
SET(XGETTEXT_CMD /usr/bin/xgettext)
find_package(Gettext REQUIRED)
ADD_CUSTOM_COMMAND(OUTPUT ${_potFile}
COMMAND ${XGETTEXT_CMD} ../app/app.cpp --output=${_potFile}
COMMAND ${XGETTEXT_CMD} ../common/restext_strings.c --output=${_potFile} --join-existing --extract-all --no-location
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Extract translatable messages to ${_potFile}"
)
ADD_CUSTOM_TARGET(_${potFile} ${_all}
DEPENDS ${_potFile}
)
FILE(GLOB _poFiles *.po)
GETTEXT_CREATE_TRANSLATIONS(${_potFile} ALL ${_poFiles})

1736
src/po/colobot.pot Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -8,4 +8,4 @@ add_executable(plugin_test plugin_test.cpp ../../../../common/iman.cpp ../../../
include_directories(".")
include_directories("../../../../")
target_link_libraries(plugin_test ltdl)
target_link_libraries(plugin_test ${LTDL_LIBRARY})