diff --git a/ksmserver/CMakeLists.txt b/ksmserver/CMakeLists.txt index 06902dc6d..a6e789fb2 100644 --- a/ksmserver/CMakeLists.txt +++ b/ksmserver/CMakeLists.txt @@ -1,5 +1,7 @@ project(ksmserver) +add_definitions(-DTRANSLATION_DOMAIN=\"ksmserver\") + add_subdirectory( tests ) # if(NOT WIN32) diff --git a/ksmserver/client.h b/ksmserver/client.h index 996c5ccc2..3f41d586d 100644 --- a/ksmserver/client.h +++ b/ksmserver/client.h @@ -28,7 +28,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // needed to avoid clash with INT8 defined in X11/Xmd.h on solaris #define QT_CLEAN_NAMESPACE 1 -#include #include #include "server.h" diff --git a/ksmserver/legacy.cpp b/ksmserver/legacy.cpp index cd21632c3..bb102a8ab 100644 --- a/ksmserver/legacy.cpp +++ b/ksmserver/legacy.cpp @@ -44,7 +44,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -#include +#include #include #include #include diff --git a/ksmserver/main.cpp b/ksmserver/main.cpp index 7b28c3b8b..75ca4682b 100644 --- a/ksmserver/main.cpp +++ b/ksmserver/main.cpp @@ -33,14 +33,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -#include -#include #include #include #include -#include -#include +#include #include +#include #include #include #include "server.h" @@ -135,47 +133,47 @@ void checkComposite() void sanity_check( int argc, char* argv[] ) { QString msg; - QByteArray path = getenv("HOME"); - QByteArray readOnly = getenv("KDE_HOME_READONLY"); + QByteArray path = qgetenv("HOME"); + const QByteArray readOnly = qgetenv("KDE_HOME_READONLY"); if (path.isEmpty()) { - msg = QLatin1String("$HOME not set!"); + msg = i18n("$HOME not set!"); } if (msg.isEmpty() && access(path.data(), W_OK)) { if (errno == ENOENT) - msg = QStringLiteral("$HOME directory (%1) does not exist."); + msg = i18n("$HOME directory (%1) does not exist."); else if (readOnly.isEmpty()) - msg = QStringLiteral("No write access to $HOME directory (%1)."); + msg = i18n("No write access to $HOME directory (%1)."); } if (msg.isEmpty() && access(path.data(), R_OK)) { if (errno == ENOENT) - msg = QStringLiteral("$HOME directory (%1) does not exist."); + msg = i18n("$HOME directory (%1) does not exist."); else - msg = QStringLiteral("No read access to $HOME directory (%1)."); + msg = i18n("No read access to $HOME directory (%1)."); } if (msg.isEmpty() && readOnly.isEmpty() && !writeTest(path)) { if (errno == ENOSPC) - msg = QStringLiteral("$HOME directory (%1) is out of disk space."); + msg = i18n("$HOME directory (%1) is out of disk space."); else - msg = QStringLiteral("Writing to the $HOME directory (%1) failed with\n " - "the error '")+QString::fromLocal8Bit(strerror(errno))+QStringLiteral("'"); + msg = i18n("Writing to the $HOME directory (%2) failed with " + "the error '%1'", QString::fromLocal8Bit(strerror(errno))); } if (msg.isEmpty()) { path = getenv("ICEAUTHORITY"); if (path.isEmpty()) { - path = getenv("HOME"); + path = qgetenv("HOME"); path += "/.ICEauthority"; } if (access(path.data(), W_OK) && (errno != ENOENT)) - msg = QStringLiteral("No write access to '%1'."); + msg = i18n("No write access to '%1'."); else if (access(path.data(), R_OK) && (errno != ENOENT)) - msg = QStringLiteral("No read access to '%1'."); + msg = i18n("No read access to '%1'."); } if (msg.isEmpty()) { @@ -185,10 +183,10 @@ void sanity_check( int argc, char* argv[] ) if (!writeTest(path)) { if (errno == ENOSPC) - msg = QStringLiteral("Temp directory (%1) is out of disk space."); + msg = i18n("Temp directory (%1) is out of disk space."); else - msg = QStringLiteral("Writing to the temp directory (%1) failed with\n " - "the error '")+QString::fromLocal8Bit(strerror(errno))+QStringLiteral("'"); + msg = i18n("Writing to the temp directory (%2) failed with\n " + "the error '%1'", QString::fromLocal8Bit(strerror(errno))); } } if (msg.isEmpty() && (path != "/tmp")) @@ -197,36 +195,35 @@ void sanity_check( int argc, char* argv[] ) if (!writeTest(path)) { if (errno == ENOSPC) - msg = QStringLiteral("Temp directory (%1) is out of disk space."); + msg = i18n("Temp directory (%1) is out of disk space."); else - msg = QStringLiteral("Writing to the temp directory (%1) failed with\n " - "the error '")+QString::fromLocal8Bit(strerror(errno))+QStringLiteral("'"); + msg = i18n("Writing to the temp directory (%2) failed with\n " + "the error '%1'", QString::fromLocal8Bit(strerror(errno))); } } if (msg.isEmpty()) { path += "/.ICE-unix"; if (access(path.data(), W_OK) && (errno != ENOENT)) - msg = QStringLiteral("No write access to '%1'."); + msg = i18n("No write access to '%1'."); else if (access(path.data(), R_OK) && (errno != ENOENT)) - msg = QStringLiteral("No read access to '%1'."); + msg = i18n("No read access to '%1'."); } if (!msg.isEmpty()) { - const char *msg_pre = - "The following installation problem was detected\n" - "while trying to start KDE:" + msg = msg.arg(QFile::decodeName(path)); + const QString msg_pre = + i18n("The following installation problem was detected\n" + "while trying to start KDE:") + "\n\n "; - const char *msg_post = "\n\nKDE is unable to start.\n"; - fputs(msg_pre, stderr); - fprintf(stderr, "%s", qPrintable(msg.arg(QFile::decodeName(path)))); - fputs(msg_post, stderr); + const QString msg_post = i18n("\n\nKDE is unable to start.\n"); + fputs(msg_pre.toUtf8().constData(), stderr); + fprintf(stderr, "%s", msg.toUtf8().constData()); + fputs(msg_post.toUtf8().constData(), stderr); QApplication a(argc, argv); - QString qmsg = QString::fromLatin1(msg_pre) + - msg.arg(QFile::decodeName(path)) + - QString::fromLatin1(msg_post); - KMessageBox::error(0, qmsg, QStringLiteral("KDE Workspace installation problem!")); + const QString qmsg = msg_pre + msg + msg_post; + KMessageBox::error(0, qmsg, i18n("Plasma Workspace installation problem!")); exit(255); } } @@ -250,7 +247,7 @@ extern "C" Q_DECL_EXPORT int kdemain( int argc, char* argv[] ) a->setQuitOnLastWindowClosed(false); // #169486 QCommandLineParser parser; - parser.setApplicationDescription(QString::fromLatin1(description)); + parser.setApplicationDescription(i18n(description)); parser.addHelpOption(); parser.addVersionOption(); diff --git a/ksmserver/screenlocker/CMakeLists.txt b/ksmserver/screenlocker/CMakeLists.txt index 43609aac1..5378a10df 100644 --- a/ksmserver/screenlocker/CMakeLists.txt +++ b/ksmserver/screenlocker/CMakeLists.txt @@ -1,3 +1,6 @@ +remove_definitions(-DTRANSLATION_DOMAIN=\"ksmserver\") +add_definitions(-DTRANSLATION_DOMAIN=\"kscreenlocker\") + add_definitions(-DKDE_DEFAULT_DEBUG_AREA=1223) add_subdirectory(kcheckpass) add_subdirectory(greeter) diff --git a/ksmserver/screenlocker/greeter/CMakeLists.txt b/ksmserver/screenlocker/greeter/CMakeLists.txt index 667fbc445..483701713 100644 --- a/ksmserver/screenlocker/greeter/CMakeLists.txt +++ b/ksmserver/screenlocker/greeter/CMakeLists.txt @@ -1,3 +1,6 @@ +remove_definitions(-DTRANSLATION_DOMAIN=\"kscreenlocker\") +add_definitions(-DTRANSLATION_DOMAIN=\"kscreenlocker_greet\") + include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${KCheckPass_SOURCE_DIR}/kcheckpass diff --git a/ksmserver/screenlocker/greeter/fallbacktheme/Greeter.qml b/ksmserver/screenlocker/greeter/fallbacktheme/Greeter.qml index c779cf33b..8616819a2 100644 --- a/ksmserver/screenlocker/greeter/fallbacktheme/Greeter.qml +++ b/ksmserver/screenlocker/greeter/fallbacktheme/Greeter.qml @@ -102,7 +102,7 @@ Item { AccelButton { id: switchUser - label: i18n("&Switch Users") + label: i18nd("kscreenlocker_greet", "&Switch Users") iconSource: "fork" visible: switchUserEnabled onClicked: switchUserClicked() @@ -110,7 +110,7 @@ Item { AccelButton { id: unlock - label: i18n("Un&lock") + label: i18nd("kscreenlocker_greet", "Un&lock") iconSource: "object-unlocked" enabled: !authenticator.graceLocked onClicked: authenticator.tryUnlock(password.text) @@ -147,7 +147,7 @@ Item { Connections { target: authenticator onFailed: { - root.notification = i18n("Unlocking failed"); + root.notification = i18nd("kscreenlocker_greet", "Unlocking failed"); } onGraceLockedChanged: { if (!authenticator.graceLocked) { diff --git a/ksmserver/screenlocker/greeter/fallbacktheme/SessionSwitching.qml b/ksmserver/screenlocker/greeter/fallbacktheme/SessionSwitching.qml index 8c481ea15..8f10eeb96 100644 --- a/ksmserver/screenlocker/greeter/fallbacktheme/SessionSwitching.qml +++ b/ksmserver/screenlocker/greeter/fallbacktheme/SessionSwitching.qml @@ -52,7 +52,7 @@ Item { delegate: PlasmaComponents.ListItem { content: PlasmaComponents.Label { - text: i18nc("thesession name and the location where the session is running (what vt)", "%1 (%2)", session, location) + text: i18ndc("kscreenlocker_greet", "thesession name and the location where the session is running (what vt)", "%1 (%2)", session, location) } } highlight: PlasmaComponents.Highlight { @@ -73,7 +73,7 @@ Item { PlasmaComponents.Label { id: explainText - text: i18n("The current session will be hidden " + + text: i18nd("kscreenlocker_greet", "The current session will be hidden " + "and a new login screen or an existing session will be displayed.\n" + "An F-key is assigned to each session; " + "F%1 is usually assigned to the first session, " + @@ -98,7 +98,7 @@ Item { AccelButton { id: activateSession - label: i18n("Activate") + label: i18nd("kscreenlocker_greet", "Activate") iconSource: "fork" onClicked: { sessions.activateSession(userSessionsView.currentIndex); @@ -107,7 +107,7 @@ Item { } AccelButton { id: newSession - label: i18n("Start New Session") + label: i18nd("kscreenlocker_greet", "Start New Session") iconSource: "fork" visible: sessions.startNewSessionSupported onClicked: { @@ -117,7 +117,7 @@ Item { } AccelButton { id: cancelSession - label: i18n("Cancel") + label: i18nd("kscreenlocker_greet", "Cancel") iconSource: "dialog-cancel" onClicked: cancel() } diff --git a/ksmserver/screenlocker/greeter/main.cpp b/ksmserver/screenlocker/greeter/main.cpp index 44ea2552f..c708a2f9b 100644 --- a/ksmserver/screenlocker/greeter/main.cpp +++ b/ksmserver/screenlocker/greeter/main.cpp @@ -50,6 +50,8 @@ static void signalHandler(int signum) int main(int argc, char* argv[]) { + KLocalizedString::setApplicationDomain("kscreenlocker_greet"); + ScreenLocker::UnlockApp app(argc, argv); QCoreApplication::setApplicationName(QStringLiteral("kscreenlocker_greet")); QCoreApplication::setApplicationVersion(QStringLiteral("0.1")); @@ -69,7 +71,7 @@ int main(int argc, char* argv[]) QStringLiteral("milliseconds"), QStringLiteral("0")); QCommandLineOption nolockOption(QStringLiteral("nolock"), - i18n("Don't show any lock user interface.")); + i18n("Don't show any lock user interface.")); parser.addOption(testingOption); parser.addOption(immediateLockOption); diff --git a/ksmserver/server.cpp b/ksmserver/server.cpp index dc2a3e5c7..a2cd6e6b6 100644 --- a/ksmserver/server.cpp +++ b/ksmserver/server.cpp @@ -73,7 +73,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include #include -#include #include #include #include @@ -612,8 +611,6 @@ KSMServer::KSMServer( const QString& windowManager, bool _only_local, bool locks , logoutEffectWidget( NULL ) { #ifdef COMPILE_SCREEN_LOCKER - KGlobal::locale()->insertCatalog(QLatin1String( "libkworkspace" )); - ScreenLocker::KSldApp::self(); if (lockscreen) { ScreenLocker::KSldApp::self()->lock(ScreenLocker::EstablishLock::Immediate); diff --git a/ksmserver/server.h b/ksmserver/server.h index 55a74104b..d58b61095 100644 --- a/ksmserver/server.h +++ b/ksmserver/server.h @@ -44,9 +44,9 @@ extern "C" { #include #include -#include #include #include +#include #include #include #include diff --git a/ksmserver/startup.cpp b/ksmserver/startup.cpp index c19483089..b8a642f05 100644 --- a/ksmserver/startup.cpp +++ b/ksmserver/startup.cpp @@ -29,7 +29,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************/ -#include #include #include #include @@ -58,17 +57,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #endif -#include #include #include -#include -#include #include -#include -#include #include #include +#include #include #include "global.h" diff --git a/ksmserver/themes/contour/main.qml b/ksmserver/themes/contour/main.qml index 05ed42bf0..e788b80ab 100644 --- a/ksmserver/themes/contour/main.qml +++ b/ksmserver/themes/contour/main.qml @@ -70,8 +70,8 @@ PlasmaCore.FrameSvgItem { running = false sleepButton.clicked(null) } - automaticallyDoLabel.text = i18np("Sleeping in 1 second", - "Sleeping in %1 seconds", automaticallyDoSeconds) + automaticallyDoLabel.text = i18ndp("ksmserver", "Sleeping in 1 second", + "Sleeping in %1 seconds", automaticallyDoSeconds) --automaticallyDoSeconds; } } @@ -103,7 +103,7 @@ PlasmaCore.FrameSvgItem { id: lockScreenButton iconSource: "system-lock-screen" iconSize: shutdownUi.iconSize - text: i18n("Lock") + text: i18nd("ksmserver", "Lock") font.pixelSize: 1.5*automaticallyDoLabel.font.pixelSize onClicked: { @@ -117,7 +117,7 @@ PlasmaCore.FrameSvgItem { id: sleepButton iconSource: "system-suspend" iconSize: shutdownUi.iconSize - text: i18n("Sleep") + text: i18n("ksmserver", "Sleep") font.pixelSize: 1.5*automaticallyDoLabel.font.pixelSize onClicked: { @@ -137,7 +137,7 @@ PlasmaCore.FrameSvgItem { id: shutdownButton iconSource: "system-shutdown" iconSize: shutdownUi.iconSize - text: i18n("Turn off") + text: i18nd("ksmserver", "Turn off") font.pixelSize: 1.5*automaticallyDoLabel.font.pixelSize onClicked: {