{effects,scripts,plugins}: Use kwin translation domain

It makes it easier to handle translations when the plugins are stored in
the same directory.
This commit is contained in:
Vlad Zahorodnii 2023-04-06 10:41:04 +03:00
parent 64dca07d48
commit 27b27696e8
18 changed files with 32 additions and 37 deletions

View file

@ -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

View file

@ -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)

View file

@ -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

View file

@ -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"
}

View file

@ -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"
}

View file

@ -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

View file

@ -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 {

View file

@ -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

View file

@ -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"

View file

@ -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)
}
}

View file

@ -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()
}
}

View file

@ -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"
}

View file

@ -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.

View file

@ -1,2 +1 @@
add_definitions(-DTRANSLATION_DOMAIN=\"kwin_clients\")
add_subdirectory(aurorae)

View file

@ -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

View file

@ -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

View file

@ -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"
}

View file

@ -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