1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-23 16:25:16 +03:00
This commit is contained in:
Bertrand Songis 2016-03-11 18:29:00 +01:00
parent 44d4e93ad1
commit 086204aed5
2 changed files with 49 additions and 20 deletions

View file

@ -29,6 +29,9 @@ set(COOS_DIR ${THIRDPARTY_DIR}/CoOS)
set(FATFS_DIR ${THIRDPARTY_DIR}/FatFs)
set(RADIO_BIN_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set(GUI_LANGUAGES cz de en es fr it pt sk se pl hu) # TODO add nl
set(TTS_LANGUAGES cz de en es fr it pt sk se pl hu) # TODO add nl
add_subdirectory(translations)
add_subdirectory(bitmaps)
add_subdirectory(lua)
@ -497,12 +500,8 @@ if(ARCH STREQUAL ARM)
add_definitions(-DBOLD_FONT -DBATTGRAPH -DTHRTRACE)
include_directories(targets/${TARGET_DIR} ${THIRDPARTY_DIR})
include_directories(${COOS_DIR} ${COOS_DIR}/kernel ${COOS_DIR}/portable)
foreach(LANGUAGE cz de en es fr it pt sk se pl hu) # TODO add nl
foreach(LANGUAGE ${TTS_LANGUAGES})
set(SRC ${SRC} translations/tts_${LANGUAGE}.cpp)
string(TOUPPER ${LANGUAGE} LANGUAGE_CAPITALIZED )
if(TRANSLATIONS STREQUAL ${LANGUAGE_CAPITALIZED})
add_definitions(-DTRANSLATIONS_${LANGUAGE_CAPITALIZED})
endif()
endforeach()
set(SRC
${SRC}
@ -655,6 +654,13 @@ else()
endif()
endif()
foreach(LANGUAGE ${GUI_LANGUAGES})
string(TOUPPER ${LANGUAGE} LANGUAGE_CAPITALIZED)
if(TRANSLATIONS STREQUAL ${LANGUAGE_CAPITALIZED})
add_definitions(-DTRANSLATIONS_${LANGUAGE_CAPITALIZED} -DTRANSLATIONS="${LANGUAGE_CAPITALIZED}")
endif()
endforeach()
set(SRC ${SRC} debug.cpp)
if(${EEPROM} STREQUAL SDCARD)

View file

@ -50,23 +50,10 @@
#include "lua/lua_exports_taranis.inc"
#endif
#if defined(PCBTARANIS) && defined(REV9E)
#define RADIO "taranisx9e"
#elif defined(PCBTARANIS) && defined(REVPLUS)
#define RADIO "taranisplus"
#elif defined(PCBTARANIS)
#define RADIO "taranis"
#elif defined(PCBHORUS)
#define RADIO "horus"
#elif defined(PCBFLAMENCO)
#define RADIO "flamenco"
#error "Unknown board"
#endif
#if defined(SIMU)
#define RADIO_VERSION RADIO"-simu"
#define RADIO_VERSION FLAVOUR "-simu"
#else
#define RADIO_VERSION RADIO
#define RADIO_VERSION FLAVOUR
#endif
#define FIND_FIELD_DESC 0x01
@ -720,6 +707,40 @@ static int luaGetGeneralSettings(lua_State *L)
return 1;
}
/*luadoc
@function getLanguage()
Returns the radio language
@retval returns the radio language
@status current Introduced in 2.2.0
*/
static int luaGetLanguage(lua_State * L)
{
lua_pushstring(L, TRANSLATIONS);
return 1;
}
/*luadoc
@function getTTSLanguage()
Returns the current TTS language
@retval returns the TTS language
@status current Introduced in 2.2.0
*/
static int luaGetTTSLanguage(lua_State * L)
{
char ttsLanguage[sizeof(g_eeGeneral.ttsLanguage)+1];
memcpy(ttsLanguage, g_eeGeneral.ttsLanguage, sizeof(g_eeGeneral.ttsLanguage));
ttsLanguage[sizeof(g_eeGeneral.ttsLanguage)] = '\0';
lua_pushstring(L, ttsLanguage);
return 1;
}
/*luadoc
@function popupInput(title, event, input, min, max)
@ -820,6 +841,8 @@ const luaL_Reg opentxLib[] = {
{ "getDateTime", luaGetDateTime },
{ "getVersion", luaGetVersion },
{ "getGeneralSettings", luaGetGeneralSettings },
{ "getLanguage", luaGetLanguage },
{ "getTTSLanguage", luaGetTTSLanguage },
{ "getValue", luaGetValue },
{ "getFieldInfo", luaGetFieldInfo },
{ "getFlightMode", luaGetFlightMode },