[audiocd-kio/Applications/16.12] /: Reenable translations after the KF5 port

Luigi Toscano null at kde.org
Sun Dec 11 16:16:58 UTC 2016


Git commit 3c56cb0a133f61a6cfbb034ab3eb483783c33740 by Luigi Toscano.
Committed on 11/12/2016 at 16:16.
Pushed by ltoscano into branch 'Applications/16.12'.

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 at kde.org
CCMAIL: xiangzhai83 at gmail.com

M  +1    -0    CMakeLists.txt
M  +2    -0    audiocd.cpp
M  +4    -1    kcmaudiocd/CMakeLists.txt
M  +1    -1    kcmaudiocd/kcmaudiocd.cpp
M  +4    -1    plugins/flac/CMakeLists.txt
A  +3    -0    plugins/flac/Messages.sh
M  +0    -2    plugins/flac/encoderflac.cpp
M  +4    -1    plugins/lame/CMakeLists.txt
M  +4    -1    plugins/vorbis/CMakeLists.txt

https://commits.kde.org/audiocd-kio/3c56cb0a133f61a6cfbb034ab3eb483783c33740

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
 )


More information about the release-team mailing list