mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
add an internationalization constant
gather all ENGLISH|GERMAN|CHINESE etc preprocessor hell into a single library, so to restrict the number of targets that need to be built 8x this still has UB/EDITOR definitions so that still needs to be dealt with before we can build it only 8 times
This commit is contained in:
@@ -54,6 +54,7 @@ include_directories(
|
||||
"${CMAKE_SOURCE_DIR}/Multiplayer"
|
||||
"${CMAKE_SOURCE_DIR}/Editor"
|
||||
"${CMAKE_SOURCE_DIR}/Console"
|
||||
"${CMAKE_SOURCE_DIR}/i18n/include"
|
||||
)
|
||||
|
||||
# external libraries
|
||||
@@ -85,6 +86,7 @@ Editor
|
||||
Console
|
||||
Tactical
|
||||
ModularizedTacticalAI
|
||||
i18n
|
||||
)
|
||||
foreach(lib IN LISTS Ja2_Libs)
|
||||
add_subdirectory(${lib})
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
set(i18nSrc
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/language.cpp"
|
||||
PARENT_SCOPE
|
||||
)
|
||||
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
namespace i18n {
|
||||
enum class Lang
|
||||
{
|
||||
en,
|
||||
de,
|
||||
ru,
|
||||
nl,
|
||||
pl,
|
||||
fr,
|
||||
it,
|
||||
zh
|
||||
};
|
||||
}
|
||||
|
||||
extern const i18n::Lang g_lang;
|
||||
@@ -0,0 +1,24 @@
|
||||
#include <language.hpp>
|
||||
|
||||
/* FIXME: The ugliest of ugly hacks. Getting rid of this and letting language
|
||||
* (ideally text and voice separately) be set in the options menu would be
|
||||
* ideal. */
|
||||
const i18n::Lang g_lang{
|
||||
#if defined(ENGLISH)
|
||||
i18n::Lang::en
|
||||
#elif defined(CHINESE)
|
||||
i18n::Lang::zh
|
||||
#elif defined(DUTCH)
|
||||
i18n::Lang::nl
|
||||
#elif defined(FRENCH)
|
||||
i18n::Lang::fr
|
||||
#elif defined(GERMAN)
|
||||
i18n::Lang::de
|
||||
#elif defined(ITALIAN)
|
||||
i18n::Lang::it
|
||||
#elif defined(POLISH)
|
||||
i18n::Lang::pl
|
||||
#elif defined(RUSSIAN)
|
||||
i18n::Lang::ru
|
||||
#endif
|
||||
};
|
||||
Reference in New Issue
Block a user