Port to KF5 KI18n translation system

Summary:
To understand these changes best read the section "Connecting Calls to Catalogs" at
http://api.kde.org/frameworks-api/frameworks5-apidocs/ki18n/html/prg_guide.html#link_cat

Instead of adding
    #define TRANSLATION_DOMAIN "foolib"
to lots of files, many projects simply use -DTRANSLATION_DOMAIN="foolib" with all sources,
this seems most simple here as well at the respective places in the hierarchy, usually at
the same place as the respective Message.sh script.

While for the actual app it is recommended to call
    KLocalizedString::setApplicationDomain("fooapp");
instead of using the TRANSLATION_DOMAIN var, Calligra code has source files for plugins/parts
and apps not cleanly separated. So using TRANSLATION_DOMAIN for all code, including app code,
again seems most simple. Exceptions from this rule done for the few simple util apps though.

Projects: #calligra:_3.0

Maniphest Tasks: T449

Differential Revision: https://phabricator.kde.org/D131
parent 92f33475
project(krita)
add_definitions(-DTRANSLATION_DOMAIN=\"krita\")
kde_enable_exceptions()
# To avoid the confusion of an endless stream of Eigen warnings.
......
......@@ -37,6 +37,8 @@ int main( int argc, char **argv )
QString calligraVersion(CALLIGRA_VERSION_STRING);
QString version;
KLocalizedString::setApplicationDomain( "crashhandler" );
#ifdef CALLIGRA_GIT_SHA1_STRING
QString gitVersion(CALLIGRA_GIT_SHA1_STRING);
version = QString("%1 (git %2)").arg(calligraVersion).arg(gitVersion).toLatin1();
......@@ -66,8 +68,6 @@ int main( int argc, char **argv )
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
KGlobal::locale()->insertCatalog("crashhandler");
KApplication app;
QStringList arguments = args->allArguments();
......
<?xml version="1.0"?>
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui name="Krita" version="50">
<kpartgui name="Krita" version="50" translationDomain="krita">
<MenuBar>
<Menu name="file"><text>&amp;File</text>
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui library="kritabigbrother" version="3">
<kpartgui library="kritabigbrother" version="3" translationDomain="krita">
<MenuBar>
<Menu name="tools"><text>&amp;Tools</text>
<Menu name="Recording"><text>Recording</text>
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui library="kritaclonesarray" version="9">
<kpartgui library="kritaclonesarray" version="9" translationDomain="krita">
<MenuBar>
<Menu name="Layer">
<text>La&amp;yer</text>
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui library="kritacolorrange" version="1">
<kpartgui library="kritacolorrange" version="1" translationDomain="krita">
<MenuBar>
<Menu name="Select"><text>Select</text>
<Separator/>
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui library="kritacolorspaceconversion" version="1">
<kpartgui library="kritacolorspaceconversion" version="1" translationDomain="krita">
<MenuBar>
<Menu name="Image"><text>&amp;Image</text>
<Action name="imagecolorspaceconversion"/>
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui library="kritagmic" version="8">
<kpartgui library="kritagmic" version="8" translationDomain="krita">
<MenuBar>
<Menu name="Layer">
<text>La&amp;yer</text>
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui library="kritahistogram" version="6">
<kpartgui library="kritahistogram" version="6" translationDomain="krita">
<MenuBar>
<Menu name="Layer"><text>&amp;Layer</text>
<Action name="histogram" group="layer_properties_merge"/>
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui library="kritaimagesize" version="7">
<kpartgui library="kritaimagesize" version="7" translationDomain="krita">
<MenuBar>
<Menu name="Image"><text>Image</text>
<Action name="imagesize" group="image_transform_merge"/>
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui library="kritaimagesize" version="6">
<kpartgui library="kritaimagesize" version="6" translationDomain="krita">
<MenuBar>
<Menu name="Image"><text>Image</text>
<Action name="imagesplit"/>
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui library="kritaimagesize" version="6">
<kpartgui library="kritaimagesize" version="6" translationDomain="krita">
<MenuBar>
<Menu name="Layer"><text>&amp;Layer</text>
<Action name="layersplit"/>
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui library="kritametadataeditor" version="2">
<kpartgui library="kritametadataeditor" version="2" translationDomain="krita">
<MenuBar>
<Menu name="Layer"><text>La&amp;yer</text>
<Action name="EditLayerMetaData" group="layer_properties_merge"/>
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui library="kritamodifyselection" version="6">
<kpartgui library="kritamodifyselection" version="6" translationDomain="krita">
<MenuBar>
<Menu name="Select"><text>&amp;Select</text>
<Action name="featherselection"/>
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui library="kritaoffsetimage" version="8">
<kpartgui library="kritaoffsetimage" version="8" translationDomain="krita">
<MenuBar>
<Menu name="Image">
<text>&amp;Image</text>
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui library="kritaresourcemanager" version="8">
<kpartgui library="kritaresourcemanager" version="8" translationDomain="krita">
<MenuBar>
<Menu name="edit"><text>&amp;Edit</text>
<Menu name="resources"><text>&amp;Resources</text>
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui library="kritarotateimage" version="8">
<kpartgui library="kritarotateimage" version="8" translationDomain="krita">
<MenuBar>
<Menu name="Image"><text>&amp;Image</text>
<Menu name="Rotate" group="image_transform_merge"><text>&amp;Rotate</text>
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui library="kritaseparatechannels" version="6">
<kpartgui library="kritaseparatechannels" version="6" translationDomain="krita">
<MenuBar>
<Menu name="Image"><text>Image</text>
<Separator/>
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui library="kritashearimage" version="7">
<kpartgui library="kritashearimage" version="7" translationDomain="krita">
<MenuBar>
<Menu name="Image"><text>&amp;Image</text>
<Action name="shearimage" group="image_transform_merge"/>
......
<?xml version="1.0"?>
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui name="Krita" version="50">
<kpartgui name="Krita" version="50" translationDomain="krita">
<MenuBar>
<Menu name="file"><text>&amp;File</text>
......
......@@ -86,8 +86,6 @@ const KComponentData &KisFactory::componentData()
// Tell the iconloader about share/apps/calligra/icons
KIconLoader::global()->addAppDir("calligra");
KGlobal::locale()->insertCatalog(s_componentData->catalogName());
}
return *s_componentData;
......
add_definitions(-DTRANSLATION_DOMAIN=\"calligra\")
if (SHOULD_BUILD_LIB_CALLIGRA)
add_subdirectory( version )
add_subdirectory( koplugin )
......
......@@ -392,8 +392,6 @@ KoOpenPane *KoPart::createOpenPane(QWidget *parent, const KComponentData &compon
void KoPart::setComponentData(const KComponentData &componentData)
{
d->m_componentData = componentData;
KGlobal::locale()->insertCatalog(componentData.catalogName());
}
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui name="Calligra" version="27">
<kpartgui name="Calligra" version="27" translationDomain="calligra">
<MenuBar>
<Menu name="file" noMerge="1"><text>&amp;File</text>
<Action name="file_new" />
......
......@@ -44,11 +44,6 @@ KoGlobal* KoGlobal::self()
KoGlobal::KoGlobal()
: m_pointSize(-1), m_calligraConfig(0)
{
if (KGlobal::locale()) {
// Install the libcalligra* translations
KGlobal::locale()->insertCatalog("calligra");
}
// When running unittests, there is not necessarily a main component
if (KGlobal::hasMainComponent()) {
// Tell KStandardDirs about the calligra prefix
......
project( artistictextshape )
add_definitions(-DTRANSLATION_DOMAIN=\"calligra_shape_artistictext\")
include_directories(
${CMAKE_SOURCE_DIR}/libs/widgets
${CMAKE_SOURCE_DIR}/libs/main # for KoFontComboBox.h
......
add_definitions(-DTRANSLATION_DOMAIN=\"calligra_shape_chart\")
# To hide all the warnings from embedded 3rd party software like kdchart
if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUC)
add_definitions(-Wno-switch)
......
add_definitions(-DTRANSLATION_DOMAIN=\"kocolorspaces\")
if(LCMS2_FOUND)
add_subdirectory(lcms2)
endif()
......
......@@ -86,7 +86,6 @@ LcmsEnginePlugin::LcmsEnginePlugin(QObject *parent, const QVariantList &)
: QObject(parent)
{
kDebug(31000) << "Initializing the lcms engine plugin";
KGlobal::locale()->insertCatalog("kocolorspaces");
// Set the lmcs error reporting function
cmsSetLogErrorHandler(&lcms2LogErrorHandlerFunction);
......
add_definitions(-DTRANSLATION_DOMAIN=\"calligra_shape_comment\")
include_directories(
${KOTEXT_INCLUDES}
${TEXTLAYOUT_INCLUDES}
......
project( defaulttools )
add_definitions(-DTRANSLATION_DOMAIN=\"calligra-defaulttools\")
include_directories(
${TEXTLAYOUT_INCLUDES} # needed because ConnectionTool.cpp includes TextShape.h to get the id
${CMAKE_SOURCE_DIR}/libs/widgets
......
project(calligradockers)
add_definitions(-DTRANSLATION_DOMAIN=\"calligra-dockers\")
include_directories(
${FLAKE_INCLUDES}
${KOWIDGETS_INCLUDES}
......
add_definitions(-DTRANSLATION_DOMAIN=\"calligra_shape_formular\")
# To hide all the warnings from the generated itex2MML code
if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUC)
add_definitions(-Wno-unused-label)
......
add_definitions(-DTRANSLATION_DOMAIN=\"keximigrate_spreadsheet\")
include_directories(
${CMAKE_SOURCE_DIR}/kexi
......
add_definitions(-DTRANSLATION_DOMAIN=\"calligra_shape_music\")
include_directories(
${FLAKE_INCLUDES}
)
......
add_definitions(-DTRANSLATION_DOMAIN=\"calligra_shape_paths\")
include_directories(
${CMAKE_SOURCE_DIR}/libs/widgets
${FLAKE_INCLUDES}
......
add_definitions(-DTRANSLATION_DOMAIN=\"calligra_shape_picture\")
include_directories( ${FLAKE_INCLUDES} )
########### Flake Plugin library ###############
......
add_definitions(-DTRANSLATION_DOMAIN=\"calligra_shape_plugin\")
include_directories( ${KOMAIN_INCLUDES} )
########### Flake Plugin library ###############
......
add_definitions(-DTRANSLATION_DOMAIN=\"calligra_semanticitem_contact\")
include_directories(
${KORDF_INCLUDES}
)
......
add_definitions(-DTRANSLATION_DOMAIN=\"calligra_semanticitem_event\")
include_directories(
${KORDF_INCLUDES}
)
......
add_definitions(-DTRANSLATION_DOMAIN=\"calligra_semanticitem_location\")
include_directories(
${KORDF_INCLUDES}
)
......
add_definitions(-DTRANSLATION_DOMAIN=\"calligra_shape_template\")
include_directories( ${FLAKE_INCLUDES} )
########### Flake Plugin library ###############
......
add_definitions(-DTRANSLATION_DOMAIN=\"calligra_shape_threed\")
include_directories( ${FLAKE_INCLUDES} )
########### Flake Plugin library ###############
......
project(autocorrection)
add_definitions(-DTRANSLATION_DOMAIN=\"calligra_textediting_autocorrect\")
add_subdirectory( data )
include_directories( ${KOTEXT_INCLUDES} ${KOWIDGETS_INCLUDES} )
......
project(changecase)
add_definitions(-DTRANSLATION_DOMAIN=\"calligra_textediting_changecase\")
include_directories( ${KOTEXT_INCLUDES} )
set(changecase_SRCS
......
project(spellcheck)
add_definitions(-DTRANSLATION_DOMAIN=\"calligra_textediting_spellcheck\")
add_subdirectory( tests )
include_directories( ${TEXTLAYOUT_INCLUDES} ${FLAKE_INCLUDES} )
......
add_definitions(-DTRANSLATION_DOMAIN=\"calligra_textediting_thesaurus\")
include_directories( ${KOTEXT_INCLUDES} )
......
project( textPlugin)
add_definitions(-DTRANSLATION_DOMAIN=\"calligra_shape_text\")
# only build the textdocument inspector in non-release builds
if(NOT RELEASE_BUILD)
set(BUILD_TEXTDOCUMENT_INSPECTOR TRUE)
......
project(textvariables)
add_definitions(-DTRANSLATION_DOMAIN=\"calligra_textinlineobject_variables\")
include_directories(
......
project( vectorshape)
add_definitions(-DTRANSLATION_DOMAIN=\"calligra_shape_vector\")
include_directories(${FLAKE_INCLUDES} ${VECTORIMAGE_INCLUDES})
set ( VectorShape_SRCS
......
add_definitions(-DTRANSLATION_DOMAIN=\"calligra_shape_video\")
include_directories(
${FLAKE_INCLUDES}
${PHONON_INCLUDES}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment