From 27b27696e8b751081a0030aec02a7f351597a39d Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 6 Apr 2023 10:41:04 +0300 Subject: [PATCH] {effects,scripts,plugins}: Use kwin translation domain It makes it easier to handle translations when the plugins are stored in the same directory. --- src/Messages.sh | 5 +++-- src/effects/CMakeLists.txt | 4 ++-- src/effects/Messages.sh | 4 ---- src/effects/frozenapp/package/metadata.json | 2 +- src/effects/login/package/metadata.json | 2 +- src/effects/overview/qml/DesktopBar.qml | 4 ++-- src/effects/overview/qml/ScreenView.qml | 2 +- src/effects/private/qml/WindowHeapDelegate.qml | 4 ++-- src/effects/scale/package/metadata.json | 2 +- src/effects/tileseditor/qml/TileDelegate.qml | 10 +++++----- src/effects/tileseditor/qml/main.qml | 6 +++--- src/effects/translucency/package/metadata.json | 2 +- src/effects/windowview/qml/main.qml | 4 ++-- src/plugins/kdecorations/CMakeLists.txt | 1 - src/plugins/kdecorations/Messages.sh | 4 ---- src/plugins/kdecorations/aurorae/src/CMakeLists.txt | 7 +++++++ .../aurorae/themes/plastik/package/metadata.json | 2 +- src/scripts/Messages.sh | 4 ---- 18 files changed, 32 insertions(+), 37 deletions(-) delete mode 100644 src/effects/Messages.sh delete mode 100644 src/plugins/kdecorations/Messages.sh delete mode 100644 src/scripts/Messages.sh diff --git a/src/Messages.sh b/src/Messages.sh index 7545494c7d..e5f5bdad29 100644 --- a/src/Messages.sh +++ b/src/Messages.sh @@ -1,3 +1,4 @@ #! /usr/bin/env bash -$EXTRACTRC *.kcfg *.ui >> rc.cpp -$XGETTEXT *.h *.cpp plugins/nightcolor/*.cpp helpers/killer/*.cpp scene/*.cpp tabbox/*.cpp scripting/*.cpp plugins/krunner-integration/*.cpp -o $podir/kwin.pot +$EXTRACTRC `find . -not -path "./kcms/*" \( -name \*.kcfg -o -name \*.ui \)` >> rc.cpp || exit 11 +$XGETTEXT `find . -not -path "./kcms/*" \( -name \*.cpp -o -name \*.qml \)` -o $podir/kwin.pot +rm -f rc.cpp diff --git a/src/effects/CMakeLists.txt b/src/effects/CMakeLists.txt index 8ff0386d42..c80248378a 100644 --- a/src/effects/CMakeLists.txt +++ b/src/effects/CMakeLists.txt @@ -4,7 +4,7 @@ add_subdirectory(private) function(kwin_add_effect_config name) list(REMOVE_ITEM ARGV ${name}) kcoreaddons_add_plugin(${name} INSTALL_NAMESPACE "kwin/effects/configs" SOURCES ${ARGV}) - target_compile_definitions(${name} PRIVATE -DTRANSLATION_DOMAIN=\"kwin_effects\") + target_compile_definitions(${name} PRIVATE -DTRANSLATION_DOMAIN=\"kwin\") endfunction() # Add a CMake-time check for python3 to avoid failures during build. @@ -28,7 +28,7 @@ endfunction() macro(kwin_add_builtin_effect name) kcoreaddons_add_plugin(${name} STATIC SOURCES ${ARGN} INSTALL_NAMESPACE "kwin/effects/plugins") - target_compile_definitions(${name} PRIVATE -DTRANSLATION_DOMAIN=\"kwin_effects\") + target_compile_definitions(${name} PRIVATE -DTRANSLATION_DOMAIN=\"kwin\") set_property(TARGET ${name} PROPERTY POSITION_INDEPENDENT_CODE ON) kwin_strip_builtin_effect_metadata(${name} metadata.json) install(FILES metadata.json DESTINATION ${KDE_INSTALL_DATADIR}/kwin/builtin-effects/ RENAME ${name}.json) diff --git a/src/effects/Messages.sh b/src/effects/Messages.sh deleted file mode 100644 index 54a16f85e5..0000000000 --- a/src/effects/Messages.sh +++ /dev/null @@ -1,4 +0,0 @@ -#! /usr/bin/env bash -$EXTRACTRC `find . -name \*.ui` >> rc.cpp || exit 11 -$XGETTEXT `find . -name \*.cpp -o -name \*.h -o -name \*.qml` -o $podir/kwin_effects.pot -rm -f rc.cpp diff --git a/src/effects/frozenapp/package/metadata.json b/src/effects/frozenapp/package/metadata.json index 2ef19810cd..98283a96fb 100644 --- a/src/effects/frozenapp/package/metadata.json +++ b/src/effects/frozenapp/package/metadata.json @@ -111,7 +111,7 @@ }, "X-KDE-Ordering": "60", "X-KDE-PluginKeyword": "frozenapp", - "X-KWin-Config-TranslationDomain": "kwin_effects", + "X-KWin-Config-TranslationDomain": "kwin", "X-Plasma-API": "javascript", "X-Plasma-MainScript": "code/main.js" } diff --git a/src/effects/login/package/metadata.json b/src/effects/login/package/metadata.json index 134b088de0..f7669e9c3a 100644 --- a/src/effects/login/package/metadata.json +++ b/src/effects/login/package/metadata.json @@ -112,7 +112,7 @@ }, "X-KDE-Ordering": "40", "X-KDE-PluginKeyword": "login", - "X-KWin-Config-TranslationDomain": "kwin_effects", + "X-KWin-Config-TranslationDomain": "kwin", "X-Plasma-API": "javascript", "X-Plasma-MainScript": "code/main.js" } diff --git a/src/effects/overview/qml/DesktopBar.qml b/src/effects/overview/qml/DesktopBar.qml index be7d117223..e462c122cb 100644 --- a/src/effects/overview/qml/DesktopBar.qml +++ b/src/effects/overview/qml/DesktopBar.qml @@ -184,7 +184,7 @@ Item { anchors.right: parent.right anchors.top: parent.top sourceComponent: PC3.Button { - text: i18nd("kwin_effects", "Delete Virtual Desktop") + text: i18nd("kwin", "Delete Virtual Desktop") icon.name: "delete" display: PC3.AbstractButton.IconOnly @@ -280,7 +280,7 @@ Item { width: bar.desktopWidth height: bar.desktopHeight - text: i18nd("kwin_effects", "Add Virtual Desktop") + text: i18nd("kwin", "Add Virtual Desktop") icon.name: "list-add" display: PC3.AbstractButton.IconOnly opacity: hovered ? 1 : 0.75 diff --git a/src/effects/overview/qml/ScreenView.qml b/src/effects/overview/qml/ScreenView.qml index b1d5fe223a..9f47efbc33 100644 --- a/src/effects/overview/qml/ScreenView.qml +++ b/src/effects/overview/qml/ScreenView.qml @@ -223,7 +223,7 @@ FocusScope { anchors.top: parent.top anchors.horizontalCenter: parent.horizontalCenter visible: container.organized && effect.searchText.length > 0 && heap.count === 0 - text: i18nd("kwin_effects", "No matching windows") + text: i18nd("kwin", "No matching windows") } WindowHeap { diff --git a/src/effects/private/qml/WindowHeapDelegate.qml b/src/effects/private/qml/WindowHeapDelegate.qml index 764c5c7ea8..bbbb0bafa8 100644 --- a/src/effects/private/qml/WindowHeapDelegate.qml +++ b/src/effects/private/qml/WindowHeapDelegate.qml @@ -148,7 +148,7 @@ Item { anchors.fill: thumbSource horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter - text: i18nd("kwin_effects", "Drag Down To Close") + text: i18nd("kwin", "Drag Down To Close") opacity: 1 - thumbSource.opacity visible: !thumb.activeHidden } @@ -449,7 +449,7 @@ Item { visible: thumb.closeButtonVisible && (hoverHandler.hovered || Kirigami.Settings.tabletMode || Kirigami.Settings.hasTransientTouchInput) && thumb.window.closeable && !thumb.activeDragHandler.active LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft - text: i18ndc("kwin_effects", "@info:tooltip as in: 'close this window'", "Close window") + text: i18ndc("kwin", "@info:tooltip as in: 'close this window'", "Close window") icon.name: "window-close" display: PC3.AbstractButton.IconOnly diff --git a/src/effects/scale/package/metadata.json b/src/effects/scale/package/metadata.json index 0c7ac831fc..e478a7de21 100644 --- a/src/effects/scale/package/metadata.json +++ b/src/effects/scale/package/metadata.json @@ -120,7 +120,7 @@ }, "X-KDE-Ordering": "60", "X-KDE-PluginKeyword": "scale", - "X-KWin-Config-TranslationDomain": "kwin_effects", + "X-KWin-Config-TranslationDomain": "kwin", "X-KWin-Exclusive-Category": "toplevel-open-close-animation", "X-Plasma-API": "javascript", "X-Plasma-MainScript": "code/main.js" diff --git a/src/effects/tileseditor/qml/TileDelegate.qml b/src/effects/tileseditor/qml/TileDelegate.qml index 33bf93f3c8..62eb8c167e 100644 --- a/src/effects/tileseditor/qml/TileDelegate.qml +++ b/src/effects/tileseditor/qml/TileDelegate.qml @@ -164,14 +164,14 @@ Item { id: splitButton Layout.fillWidth: true icon.name: "view-split-left-right" - text: i18nd("kwin_effects","Split Horizontally") + text: i18nd("kwin","Split Horizontally") display: parent.compact ? PlasmaComponents.Button.IconOnly : PlasmaComponents.Button.TextBesideIcon onClicked: tile.split(KWinComponents.Tile.Horizontal) } PlasmaComponents.Button { Layout.fillWidth: true icon.name: "view-split-top-bottom" - text: i18nd("kwin_effects","Split Vertically") + text: i18nd("kwin","Split Vertically") display: parent.compact ? PlasmaComponents.Button.IconOnly : PlasmaComponents.Button.TextBesideIcon onClicked: tile.split(KWinComponents.Tile.Vertical) } @@ -179,7 +179,7 @@ Item { Layout.fillWidth: true visible: tile.layoutDirection !== KWinComponents.Tile.Floating icon.name: "window-duplicate" - text: i18nd("kwin_effects","Add Floating Tile") + text: i18nd("kwin","Add Floating Tile") display: parent.compact ? PlasmaComponents.Button.IconOnly : PlasmaComponents.Button.TextBesideIcon onClicked: tile.split(KWinComponents.Tile.Floating) } @@ -188,7 +188,7 @@ Item { visible: tile.canBeRemoved Layout.fillWidth: true icon.name: "edit-delete" - text: i18nd("kwin_effects","Delete") + text: i18nd("kwin","Delete") display: parent.compact ? PlasmaComponents.Button.IconOnly : PlasmaComponents.Button.TextBesideIcon onClicked: { tile.remove(); @@ -208,7 +208,7 @@ Item { } visible: tile.layoutDirection === KWinComponents.Tile.Floating && tile.isLayout icon.name: "window-duplicate" - text: i18nd("kwin_effects","Add Floating Tile") + text: i18nd("kwin","Add Floating Tile") onClicked: tile.split(KWinComponents.Tile.Floating) } } diff --git a/src/effects/tileseditor/qml/main.qml b/src/effects/tileseditor/qml/main.qml index a521685c48..c1731f7a17 100644 --- a/src/effects/tileseditor/qml/main.qml +++ b/src/effects/tileseditor/qml/main.qml @@ -147,7 +147,7 @@ FocusScope { } contentItem: RowLayout { PlasmaComponents.Label { - text: i18nd("kwin_effects","Padding:") + text: i18nd("kwin","Padding:") } PlasmaComponents.SpinBox { from: 0 @@ -157,7 +157,7 @@ FocusScope { } PlasmaComponents.Button { icon.name: "document-open" - text: i18nd("kwin_effects","Load Layout...") + text: i18nd("kwin","Load Layout...") onClicked: loadLayoutDialog.open() // This mouse area is for fitts law MouseArea { @@ -271,7 +271,7 @@ FocusScope { } PlasmaComponents.Button { Layout.alignment: Qt.AlignRight - text: i18nd("kwin_effects","Close") + text: i18nd("kwin","Close") onClicked: loadLayoutDialog.close() } } diff --git a/src/effects/translucency/package/metadata.json b/src/effects/translucency/package/metadata.json index b8a0a5df03..53adca3dc0 100644 --- a/src/effects/translucency/package/metadata.json +++ b/src/effects/translucency/package/metadata.json @@ -111,7 +111,7 @@ }, "X-KDE-Ordering": "50", "X-KDE-PluginKeyword": "translucency", - "X-KWin-Config-TranslationDomain": "kwin_effects", + "X-KWin-Config-TranslationDomain": "kwin", "X-Plasma-API": "javascript", "X-Plasma-MainScript": "code/main.js" } diff --git a/src/effects/windowview/qml/main.qml b/src/effects/windowview/qml/main.qml index d86f6c738f..9f7dddcff9 100644 --- a/src/effects/windowview/qml/main.qml +++ b/src/effects/windowview/qml/main.qml @@ -104,7 +104,7 @@ Item { sourceComponent: PlasmaExtras.PlaceholderMessage { iconName: "edit-none" - text: effect.searchText.length > 0 ? i18nd("kwin_effects", "No Matches") : i18nd("kwin_effects", "No Windows") + text: effect.searchText.length > 0 ? i18nd("kwin", "No Matches") : i18nd("kwin", "No Windows") } } @@ -119,7 +119,7 @@ Item { focus: false // Don't confuse users into thinking it's a full search - placeholderText: i18nd("kwin_effects", "Filter windows…") + placeholderText: i18nd("kwin", "Filter windows…") // Otherwise it's always 100% opaque even while the blurry desktop background's // opacity is changing, which looks weird and is different from what Overview does. diff --git a/src/plugins/kdecorations/CMakeLists.txt b/src/plugins/kdecorations/CMakeLists.txt index 2bce237af0..ea2a682611 100644 --- a/src/plugins/kdecorations/CMakeLists.txt +++ b/src/plugins/kdecorations/CMakeLists.txt @@ -1,2 +1 @@ -add_definitions(-DTRANSLATION_DOMAIN=\"kwin_clients\") add_subdirectory(aurorae) diff --git a/src/plugins/kdecorations/Messages.sh b/src/plugins/kdecorations/Messages.sh deleted file mode 100644 index 15752f19b2..0000000000 --- a/src/plugins/kdecorations/Messages.sh +++ /dev/null @@ -1,4 +0,0 @@ -#! /usr/bin/env bash -$EXTRACTRC `find . -name \*.ui` >> rc.cpp || exit 11 -$XGETTEXT `find . -name \*.cpp` -o $podir/kwin_clients.pot -rm -f rc.cpp diff --git a/src/plugins/kdecorations/aurorae/src/CMakeLists.txt b/src/plugins/kdecorations/aurorae/src/CMakeLists.txt index 8266bc6e13..3d5ea85fc8 100644 --- a/src/plugins/kdecorations/aurorae/src/CMakeLists.txt +++ b/src/plugins/kdecorations/aurorae/src/CMakeLists.txt @@ -18,6 +18,10 @@ set_target_properties(kwin5_aurorae PROPERTIES LIBRARY_OUTPUT_NAME "org.kde.kwin.aurorae" ) +target_compile_definitions(kwin5_aurorae PRIVATE + -DTRANSLATION_DOMAIN=\"kwin\" +) + target_link_libraries(kwin5_aurorae KDecoration2::KDecoration kwineffects @@ -39,6 +43,9 @@ set(decoration_plugin_SRCS add_library(decorationplugin SHARED ${decoration_plugin_SRCS}) set_target_properties(decorationplugin PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/org/kde/kwin/decoration/") +target_compile_definitions(decorationplugin PRIVATE + -DTRANSLATION_DOMAIN=\"kwin\" +) target_link_libraries(decorationplugin KDecoration2::KDecoration KF6::ConfigWidgets diff --git a/src/plugins/kdecorations/aurorae/themes/plastik/package/metadata.json b/src/plugins/kdecorations/aurorae/themes/plastik/package/metadata.json index 0cc5de9b31..aa20ccd5ed 100644 --- a/src/plugins/kdecorations/aurorae/themes/plastik/package/metadata.json +++ b/src/plugins/kdecorations/aurorae/themes/plastik/package/metadata.json @@ -106,6 +106,6 @@ "Name[zh_TW]": "Plastik", "Version": "1.0" }, - "X-KWin-Config-TranslationDomain": "kwin_clients", + "X-KWin-Config-TranslationDomain": "kwin", "X-Plasma-MainScript": "ui/main.qml" } diff --git a/src/scripts/Messages.sh b/src/scripts/Messages.sh deleted file mode 100644 index 6b7f194f43..0000000000 --- a/src/scripts/Messages.sh +++ /dev/null @@ -1,4 +0,0 @@ -#! /usr/bin/env bash -$EXTRACTRC `find . -name \*.rc -o -name \*.ui -o -name \*.kcfg` >> rc.cpp -$XGETTEXT `find . -name \*.qml -o -name \*.cpp` -o $podir/kwin_scripts.pot -rm -f rc.cpp