summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLubos Dolezel <lubos@dolezel.info>2015-06-02 20:39:38 +0200
committerLubos Dolezel <lubos@dolezel.info>2015-06-02 20:39:38 +0200
commit51b5c517de53e867c0bcadba1d9736f73e264b1b (patch)
tree474b67346edbb8a64bf9af9b6aaea7074d8a9c52
parent264f02e1c2bd3039944c3f4978f01550716fc078 (diff)
downloadtwinkle-51b5c517de53e867c0bcadba1d9736f73e264b1b.tar
twinkle-51b5c517de53e867c0bcadba1d9736f73e264b1b.tar.gz
twinkle-51b5c517de53e867c0bcadba1d9736f73e264b1b.tar.lz
twinkle-51b5c517de53e867c0bcadba1d9736f73e264b1b.tar.xz
twinkle-51b5c517de53e867c0bcadba1d9736f73e264b1b.zip
Localization now builds, installs and loads
-rw-r--r--src/gui/CMakeLists.txt11
-rw-r--r--src/gui/main.cpp7
2 files changed, 17 insertions, 1 deletions
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
index 27eaf71..38b6c8c 100644
--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@ -35,6 +35,15 @@ qt4_wrap_ui(
qt4_add_resources(twinkle_QRC icons.qrc)
+qt4_add_translation(twinkle_LANG
+ lang/twinkle_cs.ts
+ lang/twinkle_de.ts
+ lang/twinkle_fr.ts
+ lang/twinkle_nl.ts
+ lang/twinkle_ru.ts
+ lang/twinkle_sv.ts
+)
+
qt4_wrap_cpp(twinkle_MOC
gui.h
dtmfform.h
@@ -130,6 +139,7 @@ set(TWINKLE_GUI-SRCS
${twinkle_UIS}
${twinkle_QRC}
${twinkle_MOC}
+ ${twinkle_LANG}
)
add_executable(twinkle ${TWINKLE_GUI-SRCS})
@@ -139,3 +149,4 @@ target_link_libraries(twinkle -lpthread -lresolv ${LibMagic_LIBRARY} ${LIBXML2_L
${Boost_LIBRARIES} Qt4::QtGui Qt4::Qt3Support ${ALSA_LIBRARY})
install(TARGETS twinkle DESTINATION bin)
+install(FILES ${twinkle_LANG} DESTINATION share/twinkle/lang)
diff --git a/src/gui/main.cpp b/src/gui/main.cpp
index cd0ad5b..2a89d5d 100644
--- a/src/gui/main.cpp
+++ b/src/gui/main.cpp
@@ -35,6 +35,7 @@
#include <cstdlib>
#include <cstring>
#include <ctime>
+#include <QtDebug>
#include <unistd.h>
#include "address_book.h"
@@ -513,7 +514,11 @@ QApplication *create_user_interface(bool cli_mode, int argc, char **argv, QTrans
// Do not report to memman as the translator will be deleted
// automatically when the QApplication is deleted.
qtranslator = new QTranslator(0);
- qtranslator->load(QString("twinkle_") + QTextCodec::locale(),
+
+ QString langName = QLocale::system().name().left(2);
+
+ qDebug() << "Language name:" << langName;
+ qtranslator->load(QString("twinkle_") + langName,
QString(sys_config->get_dir_lang().c_str()));
qa->installTranslator(qtranslator);