summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuigi Toscano <luigi.toscano@tiscali.it>2016-12-11 16:15:05 (GMT)
committerLuigi Toscano <luigi.toscano@tiscali.it>2016-12-11 16:16:48 (GMT)
commit3c56cb0a133f61a6cfbb034ab3eb483783c33740 (patch)
tree4b2082dbdfca8637e3550bf44ffb0e0ced8a6828
parent2955361d13eaccf13c6b20116e1061f6f3885f70 (diff)
Reenable translations after the KF5 port
- explicitly link to KI18n; - set the application domain for the application (kio) and the libraries (plugins, kcm); - use ki18n_wrap_ui instead of qt5_wrap_ui to enable translations for UI files; - extract the message of the lame plugin (existing strings but not extracted for translation), fix a porting TODO. CCMAIL: release-team@kde.org CCMAIL: xiangzhai83@gmail.com
-rw-r--r--CMakeLists.txt1
-rw-r--r--audiocd.cpp2
-rw-r--r--kcmaudiocd/CMakeLists.txt5
-rw-r--r--kcmaudiocd/kcmaudiocd.cpp2
-rw-r--r--plugins/flac/CMakeLists.txt5
-rw-r--r--plugins/flac/Messages.sh3
-rw-r--r--plugins/flac/encoderflac.cpp2
-rw-r--r--plugins/lame/CMakeLists.txt5
-rw-r--r--plugins/vorbis/CMakeLists.txt5
9 files changed, 23 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index baf25d8..292a6ff 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,6 +14,7 @@ set(KF5_DEP_VERSION "5.24.0") # handled by release scripts
find_package(KF5 ${KF5_DEP_VERSION} REQUIRED COMPONENTS
Config
KDELibs4Support
+ I18n
DocTools
KIO
CompactDisc
diff --git a/audiocd.cpp b/audiocd.cpp
index a20e79f..926308d 100644
--- a/audiocd.cpp
+++ b/audiocd.cpp
@@ -55,6 +55,7 @@ extern "C"
#include <klocale.h>
#include <QRegExp>
#include <QHash>
+#include <KLocalizedString>
// CDDB
#include <KCddb/Client>
#include <KCompactDisc/KCompactDisc>
@@ -67,6 +68,7 @@ using namespace AudioCD;
int kdemain(int argc, char ** argv)
{
+ KLocalizedString::setApplicationDomain("kio_audiocd");
// KApplication uses libkcddb which needs a valid kapp pointer
// GUIenabled must be true as libkcddb sometimes wants to communicate
// with the user
diff --git a/kcmaudiocd/CMakeLists.txt b/kcmaudiocd/CMakeLists.txt
index de7caeb..0a6e11e 100644
--- a/kcmaudiocd/CMakeLists.txt
+++ b/kcmaudiocd/CMakeLists.txt
@@ -1,3 +1,5 @@
+add_definitions(-DTRANSLATION_DOMAIN=\"kcmaudiocd\")
+
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/../plugins
${CMAKE_BINARY_DIR}/kioslave/audiocd/kcmaudiocd
@@ -7,11 +9,12 @@ include_directories(
set(kcm_audiocd_PART_SRCS kcmaudiocd.cpp)
-qt5_wrap_ui(kcm_audiocd_PART_SRCS audiocdconfig.ui)
+ki18n_wrap_ui(kcm_audiocd_PART_SRCS audiocdconfig.ui)
add_library(kcm_audiocd ${kcm_audiocd_PART_SRCS})
target_link_libraries(kcm_audiocd
+ KF5::I18n
KF5::KDELibs4Support
audiocdplugins
)
diff --git a/kcmaudiocd/kcmaudiocd.cpp b/kcmaudiocd/kcmaudiocd.cpp
index 923f4f9..bc7cec7 100644
--- a/kcmaudiocd/kcmaudiocd.cpp
+++ b/kcmaudiocd/kcmaudiocd.cpp
@@ -22,7 +22,7 @@
#include <kconfig.h>
#include <klineedit.h>
-#include <klocale.h>
+#include <klocalizedstring.h>
#include <kcomponentdata.h>
#include <QCheckBox>
#include <qslider.h>
diff --git a/plugins/flac/CMakeLists.txt b/plugins/flac/CMakeLists.txt
index 73bfc9e..453a1ea 100644
--- a/plugins/flac/CMakeLists.txt
+++ b/plugins/flac/CMakeLists.txt
@@ -1,3 +1,5 @@
+add_definitions(-DTRANSLATION_DOMAIN=\"audiocd_encoder_flac\")
+
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/.. ${FLAC_INCLUDE_DIR} )
########### next target ###############
@@ -7,7 +9,7 @@ add_definitions(-DHAVE_LIBFLAC)
set(audiocd_encoder_flac_PART_SRCS encoderflac.cpp )
-qt5_wrap_ui(audiocd_encoder_flac_PART_SRCS encoderflacconfig.ui)
+ki18n_wrap_ui(audiocd_encoder_flac_PART_SRCS encoderflacconfig.ui)
kconfig_add_kcfg_files(audiocd_encoder_flac_PART_SRCS audiocd_flac_encoder.kcfgc)
@@ -16,6 +18,7 @@ set_target_properties(audiocd_encoder_flac PROPERTIES PREFIX "${CMAKE_SHARED_LIB
target_link_libraries(audiocd_encoder_flac
${FLAC_LIBRARIES}
+ KF5::I18n
KF5::Cddb
audiocdplugins
)
diff --git a/plugins/flac/Messages.sh b/plugins/flac/Messages.sh
new file mode 100644
index 0000000..a08fa6b
--- /dev/null
+++ b/plugins/flac/Messages.sh
@@ -0,0 +1,3 @@
+#! /bin/sh
+$EXTRACTRC *.ui *.kcfg >> rc.cpp
+$XGETTEXT *.cpp -o $podir/audiocd_encoder_flac.pot
diff --git a/plugins/flac/encoderflac.cpp b/plugins/flac/encoderflac.cpp
index f04cea2..148f209 100644
--- a/plugins/flac/encoderflac.cpp
+++ b/plugins/flac/encoderflac.cpp
@@ -120,8 +120,6 @@ QWidget* EncoderFLAC::getConfigureWidget(KConfigSkeleton** manager) const {
return NULL;
#else
(*manager) = Settings::self();
- // TODO: https://community.kde.org/Frameworks/Porting_Notes
- //KGlobal::locale()->insertCatalog( QLatin1String( "audiocd_encoder_flac" ));
return new EncoderFLACConfig();
#endif
}
diff --git a/plugins/lame/CMakeLists.txt b/plugins/lame/CMakeLists.txt
index b378423..87f578c 100644
--- a/plugins/lame/CMakeLists.txt
+++ b/plugins/lame/CMakeLists.txt
@@ -1,3 +1,5 @@
+add_definitions(-DTRANSLATION_DOMAIN=\"audiocd_encoder_lame\")
+
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
FIND_PROGRAM(LAME_EXECUTABLE NAMES lame)
@@ -10,7 +12,7 @@ endif(NOT LAME_EXECUTABLE)
set(audiocd_encoder_lame_PART_SRCS encoderlame.cpp )
-qt5_wrap_ui(audiocd_encoder_lame_PART_SRCS encoderlameconfig.ui)
+ki18n_wrap_ui(audiocd_encoder_lame_PART_SRCS encoderlameconfig.ui)
kconfig_add_kcfg_files(audiocd_encoder_lame_PART_SRCS audiocd_lame_encoder.kcfgc)
@@ -18,6 +20,7 @@ add_library(audiocd_encoder_lame ${audiocd_encoder_lame_PART_SRCS})
set_target_properties(audiocd_encoder_lame PROPERTIES PREFIX "${CMAKE_SHARED_LIBRARY_PREFIX}")
target_link_libraries(audiocd_encoder_lame
+ KF5::I18n
KF5::Cddb
audiocdplugins
)
diff --git a/plugins/vorbis/CMakeLists.txt b/plugins/vorbis/CMakeLists.txt
index fad3845..8a07e93 100644
--- a/plugins/vorbis/CMakeLists.txt
+++ b/plugins/vorbis/CMakeLists.txt
@@ -1,10 +1,12 @@
+add_definitions(-DTRANSLATION_DOMAIN=\"audiocd_encoder_vorbis\")
+
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/.. ${OGGVORBIS_INCLUDE_DIR} ${VORBIS_INCLUDE_DIR})
########### next target ###############
set(audiocd_encoder_vorbis_PART_SRCS encodervorbis.cpp)
-qt5_wrap_ui(audiocd_encoder_vorbis_PART_SRCS encodervorbisconfig.ui)
+ki18n_wrap_ui(audiocd_encoder_vorbis_PART_SRCS encodervorbisconfig.ui)
kconfig_add_kcfg_files(audiocd_encoder_vorbis_PART_SRCS audiocd_vorbis_encoder.kcfgc)
@@ -13,6 +15,7 @@ set_target_properties(audiocd_encoder_vorbis PROPERTIES PREFIX "${CMAKE_SHARED_L
target_link_libraries(audiocd_encoder_vorbis
${OGGVORBIS_LIBRARIES}
+ KF5::I18n
KF5::Cddb
audiocdplugins
)