diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,6 +71,7 @@ Runner Wallet WindowSystem + I18n ) find_package(KF5Akonadi "5.1" CONFIG REQUIRED) diff --git a/Messages.sh b/Messages.sh --- a/Messages.sh +++ b/Messages.sh @@ -1,4 +1,4 @@ #! /usr/bin/env bash -$EXTRACTRC `find . -name \*.rc` >> rc.cpp -$EXTRACT_TR_STRINGS `find . -name \*.h -o -name \*.cpp -o -name \*.ui | grep -v '/tests/'` -o $podir/zanshin_qt.pot +$EXTRACTRC `find . -name '*.ui' -or -name '*.rc' -or -name '*.kcfg'` >> rc.cpp +$XGETTEXT `find . -name '*.cpp' -or -name '*.cc' -or -name '*.h' | grep -v '/tests/'` -o $podir/zanshin.pot rm -f rc.cpp diff --git a/src/akonadi/akonadiconfigdialog.cpp b/src/akonadi/akonadiconfigdialog.cpp --- a/src/akonadi/akonadiconfigdialog.cpp +++ b/src/akonadi/akonadiconfigdialog.cpp @@ -31,6 +31,8 @@ #include #include +#include + #include #include #include @@ -43,11 +45,11 @@ ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent) { - setWindowTitle(tr("Configure")); + setWindowTitle(i18n("Configure")); auto description = new QLabel(this); description->setWordWrap(true); - description->setText(tr("Please select or create a resource which will be used by the application to store and query its TODOs.")); + description->setText(i18n("Please select or create a resource which will be used by the application to store and query its TODOs.")); m_agentInstanceWidget = new Akonadi::AgentInstanceWidget(this); m_agentInstanceWidget->agentFilterProxyModel()->addMimeTypeFilter(QStringLiteral("application/x-vnd.akonadi.calendar.todo")); @@ -58,21 +60,21 @@ auto addAction = new QAction(this); addAction->setObjectName(QStringLiteral("addAction")); - addAction->setText(tr("Add resource")); + addAction->setText(i18n("Add resource")); addAction->setIcon(QIcon::fromTheme(QStringLiteral("list-add"))); connect(addAction, &QAction::triggered, this, &ConfigDialog::onAddTriggered); toolBar->addAction(addAction); auto removeAction = new QAction(this); removeAction->setObjectName(QStringLiteral("removeAction")); - removeAction->setText(tr("Remove resource")); + removeAction->setText(i18n("Remove resource")); removeAction->setIcon(QIcon::fromTheme(QStringLiteral("list-remove"))); connect(removeAction, &QAction::triggered, this, &ConfigDialog::onRemoveTriggered); toolBar->addAction(removeAction); auto configureAction = new QAction(this); configureAction->setObjectName(QStringLiteral("settingsAction")); - configureAction->setText(tr("Configure resource...")); + configureAction->setText(i18n("Configure resource...")); configureAction->setIcon(QIcon::fromTheme(QStringLiteral("configure"))); connect(configureAction, &QAction::triggered, this, &ConfigDialog::onConfigureTriggered); toolBar->addAction(configureAction); @@ -120,8 +122,8 @@ auto list = m_agentInstanceWidget->selectedAgentInstances(); if (!list.isEmpty()) { auto answer = QMessageBox::question(this, - tr("Multiple Agent Deletion"), - tr("Do you really want to delete the selected agent instances?"), + i18n("Multiple Agent Deletion"), + i18n("Do you really want to delete the selected agent instances?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No); if (answer == QMessageBox::Yes) { diff --git a/src/akonadi/akonadimessaging.cpp b/src/akonadi/akonadimessaging.cpp --- a/src/akonadi/akonadimessaging.cpp +++ b/src/akonadi/akonadimessaging.cpp @@ -67,8 +67,8 @@ Utils::mem_fn(&KIdentityManagement::Identity::fullEmailAddr)); const auto defaultIndex = emails.indexOf(identities.defaultIdentity().fullEmailAddr()); const auto email = QInputDialog::getItem(window, - QObject::tr("Choose an identity"), - QObject::tr("Choose the identity to use for the groupware message"), + i18n("Choose an identity"), + i18n("Choose the identity to use for the groupware message"), emails, defaultIndex, false); diff --git a/src/akonadi/akonadinoterepository.cpp b/src/akonadi/akonadinoterepository.cpp --- a/src/akonadi/akonadinoterepository.cpp +++ b/src/akonadi/akonadinoterepository.cpp @@ -24,6 +24,8 @@ #include "akonadinoterepository.h" +#include + #include #include "akonadicollectionfetchjobinterface.h" @@ -96,7 +98,7 @@ && (c.rights() & Akonadi::Collection::CanDeleteItem); }); if (it == collections.constEnd()) { - job->emitError(tr("Could not find a collection to store the note into!")); + job->emitError(i18n("Could not find a collection to store the note into!")); } else { auto col = *it; Q_ASSERT(col.isValid()); diff --git a/src/akonadi/akonaditaskrepository.cpp b/src/akonadi/akonaditaskrepository.cpp --- a/src/akonadi/akonaditaskrepository.cpp +++ b/src/akonadi/akonaditaskrepository.cpp @@ -24,6 +24,8 @@ #include "akonaditaskrepository.h" +#include + #include #include "akonadicollectionfetchjobinterface.h" @@ -66,7 +68,7 @@ && (c.rights() & Akonadi::Collection::CanDeleteItem); }); if (it == collections.constEnd()) { - job->emitError(tr("Could not find a collection to store the task into!")); + job->emitError(i18n("Could not find a collection to store the task into!")); } else { auto col = *it; Q_ASSERT(col.isValid()); @@ -216,8 +218,9 @@ auto relatedUid = m_serializer->relatedUidFromItem(parentItem); while (!relatedUid.isEmpty()) { if (relatedUid == childUid) { - job->emitError(tr("Could not associate '%1', it is an ancestor of '%2'") - .arg(child->title(), parent->title())); + job->emitError(i18n("Could not associate '%1', it is an ancestor of '%2'", + child->title(), + parent->title())); return; } diff --git a/src/presentation/CMakeLists.txt b/src/presentation/CMakeLists.txt --- a/src/presentation/CMakeLists.txt +++ b/src/presentation/CMakeLists.txt @@ -25,4 +25,4 @@ ) add_library(presentation STATIC ${presentation_SRCS}) -target_link_libraries(presentation Qt5::Core Qt5::Gui domain utils) +target_link_libraries(presentation Qt5::Core Qt5::Gui KF5::I18n domain utils) diff --git a/src/presentation/artifacteditormodel.cpp b/src/presentation/artifacteditormodel.cpp --- a/src/presentation/artifacteditormodel.cpp +++ b/src/presentation/artifacteditormodel.cpp @@ -26,6 +26,8 @@ #include +#include + #include "domain/task.h" #include "errorhandler.h" @@ -273,7 +275,7 @@ } const auto job = m_saveFunction(m_artifact); - installHandler(job, tr("Cannot modify task %1").arg(currentTitle)); + installHandler(job, i18n("Cannot modify task %1", currentTitle)); setSaveNeeded(false); } diff --git a/src/presentation/availablenotepagesmodel.cpp b/src/presentation/availablenotepagesmodel.cpp --- a/src/presentation/availablenotepagesmodel.cpp +++ b/src/presentation/availablenotepagesmodel.cpp @@ -27,6 +27,8 @@ #include #include +#include + #include "presentation/availablepagessortfilterproxymodel.h" #include "presentation/noteinboxpagemodel.h" #include "presentation/querytreemodel.h" @@ -117,26 +119,26 @@ auto tag = Domain::Tag::Ptr::create(); tag->setName(name); const auto job = m_tagRepository->create(tag); - installHandler(job, tr("Cannot add tag %1").arg(name)); + installHandler(job, i18n("Cannot add tag %1", name)); } void AvailableNotePagesModel::removeItem(const QModelIndex &index) { QObjectPtr object = index.data(QueryTreeModelBase::ObjectRole).value(); if (auto tag = object.objectCast()) { const auto job = m_tagRepository->remove(tag); - installHandler(job, tr("Cannot remove tag %1").arg(tag->name())); + installHandler(job, i18n("Cannot remove tag %1", tag->name())); } else { Q_ASSERT(false); } } QAbstractItemModel *AvailableNotePagesModel::createPageListModel() { m_inboxObject = QObjectPtr::create(); - m_inboxObject->setProperty("name", tr("Inbox")); + m_inboxObject->setProperty("name", i18n("Inbox")); m_tagsObject = QObjectPtr::create(); - m_tagsObject->setProperty("name", tr("Tags")); + m_tagsObject->setProperty("name", i18n("Tags")); m_rootsProvider = Domain::QueryResultProvider::Ptr::create(); m_rootsProvider->append(m_inboxObject); @@ -234,14 +236,14 @@ foreach (const auto &droppedArtifact, droppedArtifacts) { auto note = droppedArtifact.staticCast(); const auto job = m_tagRepository->associate(tag, note); - installHandler(job, tr("Cannot tag %1 with %2").arg(note->title(), tag->name())); + installHandler(job, i18n("Cannot tag %1 with %2", note->title(), tag->name())); } return true; } else if (object == m_inboxObject) { foreach (const auto &droppedArtifact, droppedArtifacts) { auto note = droppedArtifact.staticCast(); const auto job = m_tagRepository->dissociateAll(note); - installHandler(job, tr("Cannot move %1 to Inbox").arg(note->title())); + installHandler(job, i18n("Cannot move %1 to Inbox", note->title())); } return true; } diff --git a/src/presentation/availablesourcesmodel.cpp b/src/presentation/availablesourcesmodel.cpp --- a/src/presentation/availablesourcesmodel.cpp +++ b/src/presentation/availablesourcesmodel.cpp @@ -26,6 +26,8 @@ #include +#include + #include "domain/datasourcequeries.h" #include "domain/datasourcerepository.h" @@ -112,7 +114,7 @@ source->setSelected(value.toInt() == Qt::Checked); const auto job = m_dataSourceRepository->update(source); - installHandler(job, tr("Cannot modify source %1").arg(source->name())); + installHandler(job, i18n("Cannot modify source %1", source->name())); return true; }; diff --git a/src/presentation/availabletaskpagesmodel.cpp b/src/presentation/availabletaskpagesmodel.cpp --- a/src/presentation/availabletaskpagesmodel.cpp +++ b/src/presentation/availabletaskpagesmodel.cpp @@ -27,6 +27,8 @@ #include #include +#include + #include "domain/contextqueries.h" #include "domain/contextrepository.h" #include "domain/projectqueries.h" @@ -137,15 +139,15 @@ auto project = Domain::Project::Ptr::create(); project->setName(name); const auto job = m_projectRepository->create(project, source); - installHandler(job, tr("Cannot add project %1 in dataSource %2").arg(name, source->name())); + installHandler(job, i18n("Cannot add project %1 in dataSource %2", name, source->name())); } void AvailableTaskPagesModel::addContext(const QString &name) { auto context = Domain::Context::Ptr::create(); context->setName(name); const auto job = m_contextRepository->create(context); - installHandler(job, tr("Cannot add context %1").arg(name)); + installHandler(job, i18n("Cannot add context %1", name)); } void AvailableTaskPagesModel::addTag(const QString &) @@ -158,25 +160,25 @@ QObjectPtr object = index.data(QueryTreeModelBase::ObjectRole).value(); if (auto project = object.objectCast()) { const auto job = m_projectRepository->remove(project); - installHandler(job, tr("Cannot remove project %1").arg(project->name())); + installHandler(job, i18n("Cannot remove project %1", project->name())); } else if (auto context = object.objectCast()) { const auto job = m_contextRepository->remove(context); - installHandler(job, tr("Cannot remove context %1").arg(context->name())); + installHandler(job, i18n("Cannot remove context %1", context->name())); } else { Q_ASSERT(false); } } QAbstractItemModel *AvailableTaskPagesModel::createPageListModel() { m_inboxObject = QObjectPtr::create(); - m_inboxObject->setProperty("name", tr("Inbox")); + m_inboxObject->setProperty("name", i18n("Inbox")); m_workdayObject = QObjectPtr::create(); - m_workdayObject->setProperty("name", tr("Workday")); + m_workdayObject->setProperty("name", i18n("Workday")); m_projectsObject = QObjectPtr::create(); - m_projectsObject->setProperty("name", tr("Projects")); + m_projectsObject->setProperty("name", i18n("Projects")); m_contextsObject = QObjectPtr::create(); - m_contextsObject->setProperty("name", tr("Contexts")); + m_contextsObject->setProperty("name", i18n("Contexts")); m_rootsProvider = Domain::QueryResultProvider::Ptr::create(); m_rootsProvider->append(m_inboxObject); @@ -263,12 +265,12 @@ const auto currentName = project->name(); project->setName(value.toString()); const auto job = m_projectRepository->update(project); - installHandler(job, tr("Cannot modify project %1").arg(currentName)); + installHandler(job, i18n("Cannot modify project %1", currentName)); } else if (auto context = object.objectCast()) { const auto currentName = context->name(); context->setName(value.toString()); const auto job = m_contextRepository->update(context); - installHandler(job, tr("Cannot modify context %1").arg(currentName)); + installHandler(job, i18n("Cannot modify context %1", currentName)); } else { Q_ASSERT(false); } @@ -287,7 +289,7 @@ if (auto project = object.objectCast()) { foreach (const auto &droppedArtifact, droppedArtifacts) { const auto job = m_projectRepository->associate(project, droppedArtifact); - installHandler(job, tr("Cannot add %1 to project %2").arg(droppedArtifact->title(), project->name())); + installHandler(job, i18n("Cannot add %1 to project %2", droppedArtifact->title(), project->name())); } return true; } else if (auto context = object.objectCast()) { @@ -300,18 +302,18 @@ foreach (const auto &droppedArtifact, droppedArtifacts) { auto task = droppedArtifact.staticCast(); const auto job = m_contextRepository->associate(context, task); - installHandler(job, tr("Cannot add %1 to context %2").arg(task->title(), context->name())); + installHandler(job, i18n("Cannot add %1 to context %2", task->title(), context->name())); } return true; } else if (object == m_inboxObject) { foreach (const auto &droppedArtifact, droppedArtifacts) { const auto job = m_projectRepository->dissociate(droppedArtifact); - installHandler(job, tr("Cannot move %1 to Inbox").arg(droppedArtifact->title())); + installHandler(job, i18n("Cannot move %1 to Inbox", droppedArtifact->title())); if (auto task = droppedArtifact.objectCast()) { Utils::JobHandler::install(job, [this, task] { const auto dissociateJob = m_taskRepository->dissociateAll(task); - installHandler(dissociateJob, tr("Cannot move task %1 to Inbox").arg(task->title())); + installHandler(dissociateJob, i18n("Cannot move task %1 to Inbox", task->title())); }); } } @@ -324,7 +326,7 @@ task->setStartDate(Utils::DateTime::currentDateTime()); const auto job = m_taskRepository->update(task); - installHandler(job, tr("Cannot update task %1 to Workday").arg(task->title())); + installHandler(job, i18n("Cannot update task %1 to Workday", task->title())); } } return true; diff --git a/src/presentation/contextpagemodel.cpp b/src/presentation/contextpagemodel.cpp --- a/src/presentation/contextpagemodel.cpp +++ b/src/presentation/contextpagemodel.cpp @@ -26,6 +26,8 @@ #include +#include + #include "domain/task.h" #include "domain/contextqueries.h" #include "domain/contextrepository.h" @@ -68,7 +70,7 @@ const auto job = parentTask ? m_taskRepository->createChild(task, parentTask) : m_taskRepository->createInContext(task, m_context); - installHandler(job, tr("Cannot add task %1 in context %2").arg(title, m_context->name())); + installHandler(job, i18n("Cannot add task %1 in context %2", title, m_context->name())); return task; } @@ -80,7 +82,7 @@ auto task = artifact.objectCast(); const auto job = index.parent().isValid() ? m_taskRepository->dissociate(task) : m_contextRepository->dissociate(m_context, task); - installHandler(job, tr("Cannot remove task %1 from context %2").arg(task->title(), m_context->name())); + installHandler(job, i18n("Cannot remove task %1 from context %2", task->title(), m_context->name())); } void ContextPageModel::promoteItem(const QModelIndex &index) @@ -90,7 +92,7 @@ auto task = artifact.objectCast(); Q_ASSERT(task); const auto job = m_taskRepository->promoteToProject(task); - installHandler(job, tr("Cannot promote task %1 to be a project").arg(task->title())); + installHandler(job, i18n("Cannot promote task %1 to be a project", task->title())); } QAbstractItemModel *ContextPageModel::createCentralListModel() @@ -139,7 +141,7 @@ task->setDone(value.toInt() == Qt::Checked); const auto job = m_taskRepository->update(task); - installHandler(job, tr("Cannot modify task %1 in context %2").arg(currentTitle, m_context->name())); + installHandler(job, i18n("Cannot modify task %1 in context %2", currentTitle, m_context->name())); return true; }; @@ -176,10 +178,10 @@ foreach(const Domain::Artifact::Ptr &droppedArtifact, droppedArtifacts) { auto childTask = droppedArtifact.objectCast(); auto job = associate(childTask); - installHandler(job, tr("Cannot move task %1 as sub-task of %2").arg(childTask->title(), parentTitle)); + installHandler(job, i18n("Cannot move task %1 as sub-task of %2", childTask->title(), parentTitle)); job = dissociate(childTask); if (job) - installHandler(job, tr("Cannot dissociate task %1 from its parent").arg(childTask->title())); + installHandler(job, i18n("Cannot dissociate task %1 from its parent", childTask->title())); } return true; diff --git a/src/presentation/noteinboxpagemodel.cpp b/src/presentation/noteinboxpagemodel.cpp --- a/src/presentation/noteinboxpagemodel.cpp +++ b/src/presentation/noteinboxpagemodel.cpp @@ -26,6 +26,8 @@ #include +#include + #include "presentation/querytreemodel.h" using namespace Presentation; @@ -44,7 +46,7 @@ auto note = Domain::Note::Ptr::create(); note->setTitle(title); const auto job = m_noteRepository->create(note); - installHandler(job, tr("Cannot add note %1 in Inbox").arg(title)); + installHandler(job, i18n("Cannot add note %1 in Inbox", title)); return note; } @@ -56,7 +58,7 @@ auto note = artifact.objectCast(); Q_ASSERT(note); const auto job = m_noteRepository->remove(note); - installHandler(job, tr("Cannot remove note %1 from Inbox").arg(note->title())); + installHandler(job, i18n("Cannot remove note %1 from Inbox", note->title())); } void NoteInboxPageModel::promoteItem(const QModelIndex &) @@ -96,7 +98,7 @@ const auto currentTitle = note->title(); note->setTitle(value.toString()); const auto job = m_noteRepository->update(note); - installHandler(job, tr("Cannot modify note %1 in Inbox").arg(currentTitle)); + installHandler(job, i18n("Cannot modify note %1 in Inbox", currentTitle)); return true; }; diff --git a/src/presentation/projectpagemodel.cpp b/src/presentation/projectpagemodel.cpp --- a/src/presentation/projectpagemodel.cpp +++ b/src/presentation/projectpagemodel.cpp @@ -26,6 +26,8 @@ #include +#include + #include "presentation/querytreemodel.h" using namespace Presentation; @@ -61,7 +63,7 @@ const auto job = parentTask ? m_taskRepository->createChild(task, parentTask) : m_taskRepository->createInProject(task, m_project); - installHandler(job, tr("Cannot add task %1 in project %2").arg(title, m_project->name())); + installHandler(job, i18n("Cannot add task %1 in project %2", title, m_project->name())); return task; } @@ -73,7 +75,7 @@ auto task = artifact.objectCast(); Q_ASSERT(task); const auto job = m_taskRepository->remove(task); - installHandler(job, tr("Cannot remove task %1 from project %2").arg(task->title(), m_project->name())); + installHandler(job, i18n("Cannot remove task %1 from project %2", task->title(), m_project->name())); } void ProjectPageModel::promoteItem(const QModelIndex &index) @@ -83,7 +85,7 @@ auto task = artifact.objectCast(); Q_ASSERT(task); const auto job = m_taskRepository->promoteToProject(task); - installHandler(job, tr("Cannot promote task %1 to be a project").arg(task->title())); + installHandler(job, i18n("Cannot promote task %1 to be a project", task->title())); } QAbstractItemModel *ProjectPageModel::createCentralListModel() @@ -130,7 +132,7 @@ task->setDone(value.toInt() == Qt::Checked); const auto job = m_taskRepository->update(task); - installHandler(job, tr("Cannot modify task %1 in project %2").arg(currentTitle, m_project->name())); + installHandler(job, i18n("Cannot modify task %1 in project %2", currentTitle, m_project->name())); return true; }; @@ -164,7 +166,7 @@ foreach(const Domain::Artifact::Ptr &droppedArtifact, droppedArtifacts) { auto childTask = droppedArtifact.objectCast(); const auto job = associate(childTask); - installHandler(job, tr("Cannot move task %1 as a sub-task of %2").arg(childTask->title(), parentTitle)); + installHandler(job, i18n("Cannot move task %1 as a sub-task of %2", childTask->title(), parentTitle)); } return true; diff --git a/src/presentation/runningtaskmodel.cpp b/src/presentation/runningtaskmodel.cpp --- a/src/presentation/runningtaskmodel.cpp +++ b/src/presentation/runningtaskmodel.cpp @@ -23,6 +23,8 @@ #include "runningtaskmodel.h" +#include + using namespace Presentation; RunningTaskModel::RunningTaskModel(const Domain::TaskQueries::Ptr &taskQueries, @@ -59,13 +61,13 @@ if (m_runningTask) { m_runningTask->setRunning(false); KJob *job = m_taskRepository->update(m_runningTask); - installHandler(job, tr("Cannot update task %1 to 'not running'").arg(m_runningTask->title())); + installHandler(job, i18n("Cannot update task %1 to 'not running'", m_runningTask->title())); } m_runningTask = runningTask; if (m_runningTask) { m_runningTask->setRunning(true); KJob *job = m_taskRepository->update(m_runningTask); - installHandler(job, tr("Cannot update task %1 to 'running'").arg(m_runningTask->title())); + installHandler(job, i18n("Cannot update task %1 to 'running'", m_runningTask->title())); } emit runningTaskChanged(m_runningTask); } diff --git a/src/presentation/tagpagemodel.cpp b/src/presentation/tagpagemodel.cpp --- a/src/presentation/tagpagemodel.cpp +++ b/src/presentation/tagpagemodel.cpp @@ -26,6 +26,8 @@ #include +#include + #include "domain/noterepository.h" #include "domain/task.h" #include "domain/tagqueries.h" @@ -61,7 +63,7 @@ auto note = Domain::Note::Ptr::create(); note->setTitle(title); const auto job = m_noteRepository->createInTag(note, m_tag); - installHandler(job, tr("Cannot add note %1 in tag %2").arg(title, m_tag->name())); + installHandler(job, i18n("Cannot add note %1 in tag %2", title, m_tag->name())); return note; } @@ -72,7 +74,7 @@ auto note = artifact.objectCast(); Q_ASSERT(note); const auto job = m_tagRepository->dissociate(m_tag, note); - installHandler(job, tr("Cannot remove note %1 from tag %2").arg(note->title(), m_tag->name())); + installHandler(job, i18n("Cannot remove note %1 from tag %2", note->title(), m_tag->name())); } void TagPageModel::promoteItem(const QModelIndex &) @@ -117,7 +119,7 @@ const auto currentTitle = note->title(); note->setTitle(value.toString()); const auto job = m_noteRepository->update(note); - installHandler(job, tr("Cannot modify note %1 in tag %2").arg(currentTitle, m_tag->name())); + installHandler(job, i18n("Cannot modify note %1 in tag %2", currentTitle, m_tag->name())); return true; }; diff --git a/src/presentation/taskinboxpagemodel.cpp b/src/presentation/taskinboxpagemodel.cpp --- a/src/presentation/taskinboxpagemodel.cpp +++ b/src/presentation/taskinboxpagemodel.cpp @@ -26,6 +26,8 @@ #include +#include + #include "presentation/querytreemodel.h" using namespace Presentation; @@ -49,7 +51,7 @@ task->setTitle(title); const auto job = parentTask ? m_taskRepository->createChild(task, parentTask) : m_taskRepository->create(task); - installHandler(job, tr("Cannot add task %1 in Inbox").arg(title)); + installHandler(job, i18n("Cannot add task %1 in Inbox", title)); return task; } @@ -61,7 +63,7 @@ auto task = artifact.objectCast(); Q_ASSERT(task); const auto job = m_taskRepository->remove(task); - installHandler(job, tr("Cannot remove task %1 from Inbox").arg(task->title())); + installHandler(job, i18n("Cannot remove task %1 from Inbox", task->title())); } void TaskInboxPageModel::promoteItem(const QModelIndex &index) @@ -71,7 +73,7 @@ auto task = artifact.objectCast(); Q_ASSERT(task); const auto job = m_taskRepository->promoteToProject(task); - installHandler(job, tr("Cannot promote task %1 to be a project").arg(task->title())); + installHandler(job, i18n("Cannot promote task %1 to be a project", task->title())); } QAbstractItemModel *TaskInboxPageModel::createCentralListModel() @@ -118,7 +120,7 @@ task->setDone(value.toInt() == Qt::Checked); const auto job = m_taskRepository->update(task); - installHandler(job, tr("Cannot modify task %1 in Inbox").arg(currentTitle)); + installHandler(job, i18n("Cannot modify task %1 in Inbox", currentTitle)); return true; }; @@ -144,10 +146,10 @@ if (parentTask) { const auto job = m_taskRepository->associate(parentTask, childTask); - installHandler(job, tr("Cannot move task %1 as sub-task of %2").arg(childTask->title(), parentTask->title())); + installHandler(job, i18n("Cannot move task %1 as sub-task of %2", childTask->title(), parentTask->title())); } else { const auto job = m_taskRepository->dissociate(childTask); - installHandler(job, tr("Cannot deparent task %1 from its parent").arg(childTask->title())); + installHandler(job, i18n("Cannot deparent task %1 from its parent", childTask->title())); } } diff --git a/src/presentation/workdaypagemodel.cpp b/src/presentation/workdaypagemodel.cpp --- a/src/presentation/workdaypagemodel.cpp +++ b/src/presentation/workdaypagemodel.cpp @@ -26,6 +26,8 @@ #include +#include + #include "domain/noterepository.h" #include "domain/taskqueries.h" #include "domain/taskrepository.h" @@ -57,7 +59,7 @@ task->setStartDate(Utils::DateTime::currentDateTime()); const auto job = parentTask ? m_taskRepository->createChild(task, parentTask) : m_taskRepository->create(task); - installHandler(job, tr("Cannot add task %1 in Workday").arg(title)); + installHandler(job, i18n("Cannot add task %1 in Workday", title)); return task; } @@ -69,7 +71,7 @@ auto task = artifact.objectCast(); if (task) { const auto job = m_taskRepository->remove(task); - installHandler(job, tr("Cannot remove task %1 from Workday").arg(task->title())); + installHandler(job, i18n("Cannot remove task %1 from Workday", task->title())); } } @@ -80,7 +82,7 @@ auto task = artifact.objectCast(); Q_ASSERT(task); const auto job = m_taskRepository->promoteToProject(task); - installHandler(job, tr("Cannot promote task %1 to be a project").arg(task->title())); + installHandler(job, i18n("Cannot promote task %1 to be a project", task->title())); } QAbstractItemModel *WorkdayPageModel::createCentralListModel() @@ -132,7 +134,7 @@ task->setDone(value.toInt() == Qt::Checked); const auto job = m_taskRepository->update(task); - installHandler(job, tr("Cannot modify task %1 in Workday").arg(currentTitle)); + installHandler(job, i18n("Cannot modify task %1 in Workday", currentTitle)); return true; } @@ -161,15 +163,15 @@ if (parentTask) { const auto job = m_taskRepository->associate(parentTask, childTask); - installHandler(job, tr("Cannot move task %1 as sub-task of %2").arg(childTask->title(), parentTask->title())); + installHandler(job, i18n("Cannot move task %1 as sub-task of %2", childTask->title(), parentTask->title())); } else { childTask->setStartDate(Utils::DateTime::currentDateTime()); auto job = m_taskRepository->update(childTask); - installHandler(job, tr("Cannot update task %1").arg(childTask->title())); + installHandler(job, i18n("Cannot update task %1", childTask->title())); job = m_taskRepository->dissociate(childTask); - installHandler(job, tr("Cannot deparent task %1 from its parent").arg(childTask->title())); + installHandler(job, i18n("Cannot deparent task %1 from its parent", childTask->title())); } } diff --git a/src/renku/app/aboutdata.cpp b/src/renku/app/aboutdata.cpp --- a/src/renku/app/aboutdata.cpp +++ b/src/renku/app/aboutdata.cpp @@ -24,25 +24,26 @@ #include "aboutdata.h" #include "../../appversion.h" #include +#include KAboutData App::getAboutData() { KAboutData about(QStringLiteral("renku"), - QObject::tr("Renku Notes"), QStringLiteral(APPLICATION_VERSION), - QObject::tr("A note taking application which aims at getting your mind like water"), + i18n("Renku Notes"), QStringLiteral(APPLICATION_VERSION), + i18n("A note taking application which aims at getting your mind like water"), KAboutLicense::GPL_V3, - QObject::tr("Copyright 2008-2015, Kevin Ottens ")); + i18n("Copyright 2008-2015, Kevin Ottens ")); - about.addAuthor(QObject::tr("Kevin Ottens"), - QObject::tr("Lead Developer"), + about.addAuthor(i18n("Kevin Ottens"), + i18n("Lead Developer"), QStringLiteral("ervin@kde.org")); - about.addAuthor(QObject::tr("Mario Bensi"), - QObject::tr("Developer"), + about.addAuthor(i18n("Mario Bensi"), + i18n("Developer"), QStringLiteral("nef@ipsquad.net")); - about.addAuthor(QObject::tr("Franck Arrecot"), - QObject::tr("Developer"), + about.addAuthor(i18n("Franck Arrecot"), + i18n("Developer"), QStringLiteral("franck.arrecot@gmail.com")); return about; diff --git a/src/renku/app/main.cpp b/src/renku/app/main.cpp --- a/src/renku/app/main.cpp +++ b/src/renku/app/main.cpp @@ -46,6 +46,7 @@ int main(int argc, char **argv) { + KLocalizedString::setApplicationDomain("zanshin"); QApplication app(argc, argv); App::initializeDependencies(); @@ -67,15 +68,15 @@ layout->addWidget(components->pageView()); widget->setLayout(layout); - auto sourcesDock = new QDockWidget(QObject::tr("Sources")); + auto sourcesDock = new QDockWidget(i18n("Sources")); sourcesDock->setObjectName(QStringLiteral("sourcesDock")); sourcesDock->setWidget(components->availableSourcesView()); - auto pagesDock = new QDockWidget(QObject::tr("Pages")); + auto pagesDock = new QDockWidget(i18n("Pages")); pagesDock->setObjectName(QStringLiteral("pagesDock")); pagesDock->setWidget(components->availablePagesView()); - auto editorDock = new QDockWidget(QObject::tr("Editor")); + auto editorDock = new QDockWidget(i18n("Editor")); editorDock->setObjectName(QStringLiteral("editorDock")); editorDock->setWidget(components->editorView()); diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt --- a/src/widgets/CMakeLists.txt +++ b/src/widgets/CMakeLists.txt @@ -19,7 +19,7 @@ taskapplicationcomponents.cpp ) -qt5_wrap_ui(widgets_SRCS +ki18n_wrap_ui(widgets_SRCS editorview.ui filterwidget.ui newprojectdialog.ui diff --git a/src/widgets/applicationcomponents.cpp b/src/widgets/applicationcomponents.cpp --- a/src/widgets/applicationcomponents.cpp +++ b/src/widgets/applicationcomponents.cpp @@ -33,6 +33,8 @@ #include #include +#include + #include "availablepagesview.h" #include "availablesourcesview.h" #include "editorview.h" @@ -57,7 +59,7 @@ auto moveItemAction = new QAction(this); moveItemAction->setObjectName(QStringLiteral("moveItemAction")); - moveItemAction->setText(tr("Move Item")); + moveItemAction->setText(i18n("Move Item")); moveItemAction->setShortcut(Qt::Key_M); connect(moveItemAction, &QAction::triggered, this, &ApplicationComponents::onMoveItemsRequested); diff --git a/src/widgets/availablepagesview.cpp b/src/widgets/availablepagesview.cpp --- a/src/widgets/availablepagesview.cpp +++ b/src/widgets/availablepagesview.cpp @@ -32,6 +32,8 @@ #include #include +#include + #include "presentation/metatypes.h" #include "presentation/querytreemodelbase.h" @@ -65,25 +67,25 @@ actionBar->setIconSize(QSize(16, 16)); m_addProjectAction->setObjectName(QStringLiteral("addProjectAction")); - m_addProjectAction->setText(tr("New Project")); + m_addProjectAction->setText(i18n("New Project")); m_addProjectAction->setIcon(QIcon::fromTheme(QStringLiteral("view-pim-tasks"))); connect(m_addProjectAction, &QAction::triggered, this, &AvailablePagesView::onAddProjectTriggered); actionBar->addAction(m_addProjectAction); m_addContextAction->setObjectName(QStringLiteral("addContextAction")); - m_addContextAction->setText(tr("New Context")); + m_addContextAction->setText(i18n("New Context")); m_addContextAction->setIcon(QIcon::fromTheme(QStringLiteral("view-pim-notes"))); connect(m_addContextAction, &QAction::triggered, this, &AvailablePagesView::onAddContextTriggered); actionBar->addAction(m_addContextAction); m_addTagAction->setObjectName(QStringLiteral("addTagAction")); - m_addTagAction->setText(tr("New Tag")); + m_addTagAction->setText(i18n("New Tag")); m_addTagAction->setIcon(QIcon::fromTheme(QStringLiteral("view-pim-tasks"))); connect(m_addTagAction, &QAction::triggered, this, &AvailablePagesView::onAddTagTriggered); actionBar->addAction(m_addTagAction); m_removeAction->setObjectName(QStringLiteral("removeAction")); - m_removeAction->setText(tr("Remove Page")); + m_removeAction->setText(i18n("Remove Page")); m_removeAction->setIcon(QIcon::fromTheme(QStringLiteral("list-remove"))); connect(m_removeAction, &QAction::triggered, this, &AvailablePagesView::onRemoveTriggered); actionBar->addAction(m_removeAction); @@ -112,21 +114,21 @@ auto goPreviousAction = new QAction(this); goPreviousAction->setObjectName(QStringLiteral("goPreviousAction")); - goPreviousAction->setText(tr("Previous Page")); + goPreviousAction->setText(i18n("Previous Page")); goPreviousAction->setIcon(QIcon::fromTheme(QStringLiteral("go-up"))); goPreviousAction->setShortcut(Qt::ALT | Qt::Key_Up); connect(goPreviousAction, &QAction::triggered, this, &AvailablePagesView::onGoPreviousTriggered); auto goNextAction = new QAction(this); goNextAction->setObjectName(QStringLiteral("goNextAction")); - goNextAction->setText(tr("Next Page")); + goNextAction->setText(i18n("Next Page")); goNextAction->setIcon(QIcon::fromTheme(QStringLiteral("go-down"))); goNextAction->setShortcut(Qt::ALT | Qt::Key_Down); connect(goNextAction, &QAction::triggered, this, &AvailablePagesView::onGoNextTriggered); auto goToAction = new QAction(this); goToAction->setObjectName(QStringLiteral("goToAction")); - goToAction->setText(tr("Go to Page...")); + goToAction->setText(i18n("Go to Page...")); goToAction->setShortcut(Qt::Key_J); connect(goToAction, &QAction::triggered, this, &AvailablePagesView::onGoToTriggered); @@ -255,16 +257,16 @@ void AvailablePagesView::onAddContextTriggered() { - const QString name = m_messageBoxInterface->askTextInput(this, tr("Add Context"), tr("Context name")); + const QString name = m_messageBoxInterface->askTextInput(this, i18n("Add Context"), i18n("Context name")); if (!name.isEmpty()) { QMetaObject::invokeMethod(m_model, "addContext", Q_ARG(QString, name)); } } void AvailablePagesView::onAddTagTriggered() { - const QString name = m_messageBoxInterface->askTextInput(this, tr("Add Tag"), tr("Tag name")); + const QString name = m_messageBoxInterface->askTextInput(this, i18n("Add Tag"), i18n("Tag name")); if (!name.isEmpty()) { QMetaObject::invokeMethod(m_model, "addTag", Q_ARG(QString, name)); @@ -285,14 +287,14 @@ return; } if (Domain::Project::Ptr project = object.objectCast()) { - title = tr("Delete Project"); - text = tr("Do you really want to delete the project '%1', with all its actions?").arg(project->name()); + title = i18n("Delete Project"); + text = i18n("Do you really want to delete the project '%1', with all its actions?", project->name()); } else if (Domain::Context::Ptr context = object.objectCast()) { - title = tr("Delete Context"); - text = tr("Do you really want to delete the context '%1'?").arg(context->name()); + title = i18n("Delete Context"); + text = i18n("Do you really want to delete the context '%1'?", context->name()); } else if (Domain::Tag::Ptr tag = object.objectCast()) { - title = tr("Delete Tag"); - text = tr("Do you really want to delete the tag '%1'?").arg(tag->name()); + title = i18n("Delete Tag"); + text = i18n("Do you really want to delete the tag '%1'?", tag->name()); } else { qFatal("Unrecognized object type"); return; diff --git a/src/widgets/availablesourcesview.cpp b/src/widgets/availablesourcesview.cpp --- a/src/widgets/availablesourcesview.cpp +++ b/src/widgets/availablesourcesview.cpp @@ -35,6 +35,7 @@ #include #include +#include #include "presentation/metatypes.h" #include "presentation/querytreemodelbase.h" @@ -70,7 +71,7 @@ actionBar->setIconSize(QSize(16, 16)); m_defaultAction->setObjectName(QStringLiteral("defaultAction")); - m_defaultAction->setText(tr("Use as Default Source")); + m_defaultAction->setText(i18n("Use as Default Source")); m_defaultAction->setIcon(QIcon::fromTheme(QStringLiteral("folder-favorites"))); connect(m_defaultAction, &QAction::triggered, this, &AvailableSourcesView::onDefaultTriggered); actionBar->addAction(m_defaultAction); @@ -91,7 +92,7 @@ auto settingsAction = new QAction(this); settingsAction->setObjectName(QStringLiteral("settingsAction")); - settingsAction->setText(tr("Configure %1...").arg(QApplication::applicationName())); + settingsAction->setText(i18n("Configure %1...", QApplication::applicationName())); settingsAction->setIcon(QIcon::fromTheme(QStringLiteral("configure"))); connect(settingsAction, &QAction::triggered, this, &AvailableSourcesView::onSettingsTriggered); m_actions.insert(QStringLiteral("options_configure"), settingsAction); diff --git a/src/widgets/editorview.cpp b/src/widgets/editorview.cpp --- a/src/widgets/editorview.cpp +++ b/src/widgets/editorview.cpp @@ -29,6 +29,9 @@ #include #include #include + +#include + #include "kdateedit.h" #include "addressline/addresseelineedit.h" @@ -202,7 +205,7 @@ { const auto delegateText = m_model->property("delegateText").toString(); const auto labelText = delegateText.isEmpty() ? QString() - : tr("Delegated to: %1").arg(delegateText); + : i18n("Delegated to: %1", delegateText); ui->delegateLabel->setVisible(!labelText.isEmpty()); ui->delegateLabel->setText(labelText); diff --git a/src/widgets/filterwidget.cpp b/src/widgets/filterwidget.cpp --- a/src/widgets/filterwidget.cpp +++ b/src/widgets/filterwidget.cpp @@ -29,6 +29,8 @@ #include #include +#include + #include "presentation/artifactfilterproxymodel.h" #include "ui_filterwidget.h" @@ -42,8 +44,8 @@ { ui->setupUi(this); ui->extension->hide(); - ui->sortTypeCombo->addItem(tr("Sort by title"), Presentation::ArtifactFilterProxyModel::TitleSort); - ui->sortTypeCombo->addItem(tr("Sort by date"), Presentation::ArtifactFilterProxyModel::DateSort); + ui->sortTypeCombo->addItem(i18n("Sort by title"), Presentation::ArtifactFilterProxyModel::TitleSort); + ui->sortTypeCombo->addItem(i18n("Sort by date"), Presentation::ArtifactFilterProxyModel::DateSort); setFocusProxy(ui->filterEdit); connect(ui->filterEdit, &QLineEdit::textChanged, this, &FilterWidget::onTextChanged); diff --git a/src/widgets/itemdelegate.cpp b/src/widgets/itemdelegate.cpp --- a/src/widgets/itemdelegate.cpp +++ b/src/widgets/itemdelegate.cpp @@ -28,6 +28,8 @@ #include #include +#include + #include "domain/note.h" #include "domain/task.h" #include "presentation/querytreemodelbase.h" @@ -108,7 +110,7 @@ : onDueDate ? QColor("orange") : baseColor; - const auto summaryText = taskDelegate.isValid() ? tr("(%1) %2").arg(taskDelegate.display(), opt.text) : opt.text; + const auto summaryText = taskDelegate.isValid() ? i18n("(%1) %2", taskDelegate.display(), opt.text) : opt.text; const auto dueDateText = dueDate.isValid() ? QLocale().toString(dueDate.date(), QLocale::ShortFormat) : QString(); diff --git a/src/widgets/pageview.cpp b/src/widgets/pageview.cpp --- a/src/widgets/pageview.cpp +++ b/src/widgets/pageview.cpp @@ -34,6 +34,7 @@ #include #include +#include #include #include "filterwidget.h" @@ -150,7 +151,7 @@ m_centralView->setStyleSheet(QStringLiteral("QTreeView::branch { border-image: url(none.png); }")); m_quickAddEdit->setObjectName(QStringLiteral("quickAddEdit")); - m_quickAddEdit->setPlaceholderText(tr("Type and press enter to add an item")); + m_quickAddEdit->setPlaceholderText(i18n("Type and press enter to add an item")); connect(m_quickAddEdit, &QLineEdit::returnPressed, this, &PageView::onReturnPressed); auto layout = new QVBoxLayout; @@ -165,7 +166,7 @@ auto addItemAction = new QAction(this); addItemAction->setObjectName(QStringLiteral("addItemAction")); - addItemAction->setText(tr("New Item")); + addItemAction->setText(i18n("New Item")); addItemAction->setIcon(QIcon::fromTheme(QStringLiteral("list-add"))); addItemAction->setShortcut(Qt::CTRL | Qt::Key_N); connect(addItemAction, &QAction::triggered, this, &PageView::onAddItemRequested); @@ -178,30 +179,30 @@ auto removeItemAction = new QAction(this); removeItemAction->setObjectName(QStringLiteral("removeItemAction")); - removeItemAction->setText(tr("Remove Item")); + removeItemAction->setText(i18n("Remove Item")); removeItemAction->setIcon(QIcon::fromTheme(QStringLiteral("list-remove"))); removeItemAction->setShortcut(Qt::Key_Delete); connect(removeItemAction, &QAction::triggered, this, &PageView::onRemoveItemRequested); addAction(removeItemAction); auto promoteItemAction = new QAction(this); promoteItemAction->setObjectName(QStringLiteral("promoteItemAction")); - promoteItemAction->setText(tr("Promote Item as Project")); + promoteItemAction->setText(i18n("Promote Item as Project")); promoteItemAction->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_P); connect(promoteItemAction, &QAction::triggered, this, &PageView::onPromoteItemRequested); auto filterViewAction = new QAction(this); filterViewAction->setObjectName(QStringLiteral("filterViewAction")); - filterViewAction->setText(tr("Filter...")); + filterViewAction->setText(i18n("Filter...")); filterViewAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-find"))); filterViewAction->setShortcut(Qt::CTRL | Qt::Key_F); filterViewAction->setCheckable(true); connect(filterViewAction, &QAction::triggered, this, &PageView::onFilterToggled); m_runTaskAction = new QAction(this); m_runTaskAction->setObjectName(QStringLiteral("runTaskAction")); m_runTaskAction->setShortcut(Qt::CTRL | Qt::Key_Space); - m_runTaskAction->setText(tr("Start Now")); + m_runTaskAction->setText(i18n("Start Now")); m_runTaskAction->setIcon(QIcon::fromTheme(QStringLiteral("media-playback-start"))); connect(m_runTaskAction, &QAction::triggered, this, &PageView::onRunTaskTriggered); updateRunTaskAction(); @@ -315,7 +316,7 @@ const auto editTopLeft = m_quickAddEdit->geometry().topLeft(); const auto pos = mapToGlobal(editTopLeft); auto popup = new PassivePopup(m_quickAddEdit); - popup->setText(tr("Type and press enter to add an item")); + popup->setText(i18n("Type and press enter to add an item")); popup->show(); popup->move(pos - QPoint(0, popup->height())); @@ -343,21 +344,21 @@ } if (hasDescendants) - text = tr("Do you really want to delete the selected items and their children?"); + text = i18n("Do you really want to delete the selected items and their children?"); else - text = tr("Do you really want to delete the selected items?"); + text = i18n("Do you really want to delete the selected items?"); } else { const QModelIndex ¤tIndex = currentIndexes.first(); if (!currentIndex.isValid()) return; if (currentIndex.model()->rowCount(currentIndex) > 0) - text = tr("Do you really want to delete the selected task and all its children?"); + text = i18n("Do you really want to delete the selected task and all its children?"); } if (!text.isEmpty()) { - QMessageBox::Button button = m_messageBoxInterface->askConfirmation(this, tr("Delete Tasks"), text); + QMessageBox::Button button = m_messageBoxInterface->askConfirmation(this, i18n("Delete Tasks"), text); bool canRemove = (button == QMessageBox::Yes); if (!canRemove) diff --git a/src/widgets/quickselectdialog.cpp b/src/widgets/quickselectdialog.cpp --- a/src/widgets/quickselectdialog.cpp +++ b/src/widgets/quickselectdialog.cpp @@ -25,16 +25,17 @@ #include "quickselectdialog.h" -#include - #include #include #include #include #include #include #include +#include +#include + using namespace Widgets; QuickSelectDialog::QuickSelectDialog(QWidget *parent) @@ -44,9 +45,9 @@ m_label(new QLabel(this)), m_tree(new QTreeView(this)) { - setWindowTitle(tr("Quick Select Dialog")); + setWindowTitle(i18n("Quick Select Dialog")); - m_label->setText(tr("You can start typing to filter the list of available pages")); + m_label->setText(i18n("You can start typing to filter the list of available pages")); m_filterProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); m_tree->setModel(m_filterProxyModel); @@ -84,9 +85,9 @@ void QuickSelectDialog::applyFilterChanged(const QString &textFilter) { if (textFilter.isEmpty()) - m_label->setText(tr("You can start typing to filter the list of available pages")); + m_label->setText(i18n("You can start typing to filter the list of available pages")); else - m_label->setText(tr("Path: %1").arg(textFilter)); + m_label->setText(i18n("Path: %1", textFilter)); m_filterProxyModel->setFilterFixedString(textFilter); m_tree->expandAll(); diff --git a/src/widgets/runningtaskwidget.cpp b/src/widgets/runningtaskwidget.cpp --- a/src/widgets/runningtaskwidget.cpp +++ b/src/widgets/runningtaskwidget.cpp @@ -23,11 +23,14 @@ #include "runningtaskwidget.h" #include "runningtaskmodelinterface.h" + #include #include #include #include #include + +#include #include using namespace Widgets; @@ -47,7 +50,7 @@ KWindowSystem::setOnAllDesktops(winId(), true); KWindowSystem::setState(winId(), NET::KeepAbove | NET::SkipTaskbar | NET::SkipPager); - setWindowTitle(tr("Zanshin Running Task Banner")); + setWindowTitle(i18n("Zanshin Running Task Banner")); // Current idea for a good background color: // the selection color, i.e. usually blue. Arguable ;) @@ -57,11 +60,11 @@ setAutoFillBackground(true); m_stopButton->setObjectName(QStringLiteral("stopButton")); - m_stopButton->setText(tr("Stop")); + m_stopButton->setText(i18n("Stop")); connect(m_stopButton, &QAbstractButton::clicked, this, &RunningTaskWidget::onTaskRunStopped); m_doneButton->setObjectName(QStringLiteral("doneButton")); - m_doneButton->setText(tr("Done")); + m_doneButton->setText(i18n("Done")); connect(m_doneButton, &QAbstractButton::clicked, this, &RunningTaskWidget::onTaskRunDone); m_layout->setContentsMargins(0, 0, 0, 0); diff --git a/src/widgets/scripteditor.cpp b/src/widgets/scripteditor.cpp --- a/src/widgets/scripteditor.cpp +++ b/src/widgets/scripteditor.cpp @@ -28,13 +28,15 @@ #include +#include + using namespace Widgets; ScriptEditor::ScriptEditor(QWidget *parent) : QMainWindow(parent), m_textEdit(new QTextEdit(this)) { - setWindowTitle(tr("Script Editor - Zanshin")); + setWindowTitle(i18n("Script Editor - Zanshin")); resize(600, 600); setCentralWidget(m_textEdit); } diff --git a/src/zanshin/app/aboutdata.cpp b/src/zanshin/app/aboutdata.cpp --- a/src/zanshin/app/aboutdata.cpp +++ b/src/zanshin/app/aboutdata.cpp @@ -24,25 +24,26 @@ #include "aboutdata.h" #include "../../appversion.h" #include +#include KAboutData App::getAboutData() { KAboutData about(QStringLiteral("zanshin"), - QObject::tr("Zanshin Tasks"), QStringLiteral(APPLICATION_VERSION), - QObject::tr("A Getting Things Done application which aims at getting your mind like water"), + i18n("Zanshin Tasks"), QStringLiteral(APPLICATION_VERSION), + i18n("A Getting Things Done application which aims at getting your mind like water"), KAboutLicense::GPL_V3, - QObject::tr("Copyright 2008-2016, Kevin Ottens ")); + i18n("Copyright 2008-2016, Kevin Ottens ")); - about.addAuthor(QObject::tr("Kevin Ottens"), - QObject::tr("Lead Developer"), + about.addAuthor(i18n("Kevin Ottens"), + i18n("Lead Developer"), QStringLiteral("ervin@kde.org")); - about.addAuthor(QObject::tr("Mario Bensi"), - QObject::tr("Developer"), + about.addAuthor(i18n("Mario Bensi"), + i18n("Developer"), QStringLiteral("nef@ipsquad.net")); - about.addAuthor(QObject::tr("Franck Arrecot"), - QObject::tr("Developer"), + about.addAuthor(i18n("Franck Arrecot"), + i18n("Developer"), QStringLiteral("franck.arrecot@gmail.com")); return about; diff --git a/src/zanshin/app/main.cpp b/src/zanshin/app/main.cpp --- a/src/zanshin/app/main.cpp +++ b/src/zanshin/app/main.cpp @@ -49,6 +49,7 @@ int main(int argc, char **argv) { + KLocalizedString::setApplicationDomain("zanshin"); QApplication app(argc, argv); App::initializeDependencies(); @@ -70,15 +71,15 @@ layout->addWidget(components->pageView()); widget->setLayout(layout); - auto sourcesDock = new QDockWidget(QObject::tr("Sources")); + auto sourcesDock = new QDockWidget(i18n("Sources")); sourcesDock->setObjectName(QStringLiteral("sourcesDock")); sourcesDock->setWidget(components->availableSourcesView()); - auto pagesDock = new QDockWidget(QObject::tr("Pages")); + auto pagesDock = new QDockWidget(i18n("Pages")); pagesDock->setObjectName(QStringLiteral("pagesDock")); pagesDock->setWidget(components->availablePagesView()); - auto editorDock = new QDockWidget(QObject::tr("Editor")); + auto editorDock = new QDockWidget(i18n("Editor")); editorDock->setObjectName(QStringLiteral("editorDock")); editorDock->setWidget(components->editorView()); diff --git a/src/zanshin/runner/zanshinrunner.cpp b/src/zanshin/runner/zanshinrunner.cpp --- a/src/zanshin/runner/zanshinrunner.cpp +++ b/src/zanshin/runner/zanshinrunner.cpp @@ -32,6 +32,7 @@ #include #include +#include K_EXPORT_PLASMA_RUNNER(zanshin, ZanshinRunner) Domain::TaskRepository::Ptr createTaskRepository() @@ -76,7 +77,7 @@ match.setData(summary); match.setType(Plasma::QueryMatch::ExactMatch); match.setIcon(QIcon::fromTheme(QStringLiteral("zanshin"))); - match.setText(tr("Add \"%1\" to your todo list").arg(summary)); + match.setText(i18n("Add \"%1\" to your todo list", summary)); match.setRelevance(1.0); matches << match; diff --git a/tests/units/presentation/availablenotepagesmodeltest.cpp b/tests/units/presentation/availablenotepagesmodeltest.cpp --- a/tests/units/presentation/availablenotepagesmodeltest.cpp +++ b/tests/units/presentation/availablenotepagesmodeltest.cpp @@ -27,6 +27,8 @@ #include +#include + #include "utils/mockobject.h" #include "presentation/availablenotepagesmodel.h" @@ -115,8 +117,8 @@ QCOMPARE(model->flags(tag1Index), defaultFlags | Qt::ItemIsDropEnabled); QCOMPARE(model->flags(tag2Index), defaultFlags | Qt::ItemIsDropEnabled); - QCOMPARE(model->data(inboxIndex).toString(), tr("Inbox")); - QCOMPARE(model->data(tagsIndex).toString(), tr("Tags")); + QCOMPARE(model->data(inboxIndex).toString(), i18n("Inbox")); + QCOMPARE(model->data(tagsIndex).toString(), i18n("Tags")); QCOMPARE(model->data(tag1Index).toString(), tag1->name()); QCOMPARE(model->data(tag2Index).toString(), tag2->name()); diff --git a/tests/units/presentation/availabletaskpagesmodeltest.cpp b/tests/units/presentation/availabletaskpagesmodeltest.cpp --- a/tests/units/presentation/availabletaskpagesmodeltest.cpp +++ b/tests/units/presentation/availabletaskpagesmodeltest.cpp @@ -27,6 +27,8 @@ #include +#include + #include "utils/mockobject.h" #include "utils/datetime.h" @@ -152,12 +154,12 @@ QCOMPARE(model->flags(context1Index), defaultFlags | Qt::ItemIsDropEnabled); QCOMPARE(model->flags(context2Index), defaultFlags | Qt::ItemIsDropEnabled); - QCOMPARE(model->data(inboxIndex).toString(), tr("Inbox")); - QCOMPARE(model->data(workdayIndex).toString(), tr("Workday")); - QCOMPARE(model->data(projectsIndex).toString(), tr("Projects")); + QCOMPARE(model->data(inboxIndex).toString(), i18n("Inbox")); + QCOMPARE(model->data(workdayIndex).toString(), i18n("Workday")); + QCOMPARE(model->data(projectsIndex).toString(), i18n("Projects")); QCOMPARE(model->data(project1Index).toString(), project1->name()); QCOMPARE(model->data(project2Index).toString(), project2->name()); - QCOMPARE(model->data(contextsIndex).toString(), tr("Contexts")); + QCOMPARE(model->data(contextsIndex).toString(), i18n("Contexts")); QCOMPARE(model->data(context1Index).toString(), context1->name()); QCOMPARE(model->data(context2Index).toString(), context2->name()); diff --git a/tests/units/widgets/editorviewtest.cpp b/tests/units/widgets/editorviewtest.cpp --- a/tests/units/widgets/editorviewtest.cpp +++ b/tests/units/widgets/editorviewtest.cpp @@ -27,6 +27,8 @@ #include #include +#include + #include "domain/note.h" #include "domain/task.h" @@ -234,7 +236,7 @@ editor.setModel(&model); // THEN - auto expectedText = tr("Delegated to: %1").arg(model.property("delegateText").toString()); + auto expectedText = i18n("Delegated to: %1", model.property("delegateText").toString()); QVERIFY(delegateLabel->isVisibleTo(&editor)); QCOMPARE(delegateLabel->text(), expectedText); } @@ -377,7 +379,7 @@ QCOMPARE(startDateEdit->date(), QDate::currentDate()); QCOMPARE(dueDateEdit->date(), QDate::currentDate().addDays(2)); QVERIFY(doneButton->isChecked()); - auto expectedText = tr("Delegated to: %1").arg(QStringLiteral("John Doe")); + auto expectedText = i18n("Delegated to: %1", QStringLiteral("John Doe")); QCOMPARE(delegateLabel->text(), expectedText); } @@ -622,7 +624,7 @@ model.setDelegateText(QStringLiteral("John Smith")); // THEN - auto expectedText = tr("Delegated to: %1").arg(model.property("delegateText").toString()); + auto expectedText = i18n("Delegated to: %1", model.property("delegateText").toString()); QCOMPARE(delegateLabel->text(), expectedText); } diff --git a/tests/units/widgets/filterwidgettest.cpp b/tests/units/widgets/filterwidgettest.cpp --- a/tests/units/widgets/filterwidgettest.cpp +++ b/tests/units/widgets/filterwidgettest.cpp @@ -28,6 +28,8 @@ #include #include +#include + #include "widgets/filterwidget.h" #include "presentation/artifactfilterproxymodel.h" @@ -50,7 +52,7 @@ QVERIFY(filterEdit); QVERIFY(filterEdit->isVisibleTo(&filter)); QVERIFY(filterEdit->text().isEmpty()); - QCOMPARE(filterEdit->placeholderText(), tr("Filter...")); + QCOMPARE(filterEdit->placeholderText(), i18n("Filter...")); auto extensionButton = filter.findChild(QStringLiteral("extensionButton")); QVERIFY(extensionButton); diff --git a/tests/units/widgets/pageviewtest.cpp b/tests/units/widgets/pageviewtest.cpp --- a/tests/units/widgets/pageviewtest.cpp +++ b/tests/units/widgets/pageviewtest.cpp @@ -34,6 +34,7 @@ #include #include +#include #include #include "domain/task.h" @@ -165,7 +166,7 @@ QVERIFY(quickAddEdit); QVERIFY(quickAddEdit->isVisibleTo(&page)); QVERIFY(quickAddEdit->text().isEmpty()); - QCOMPARE(quickAddEdit->placeholderText(), tr("Type and press enter to add an item")); + QCOMPARE(quickAddEdit->placeholderText(), i18n("Type and press enter to add an item")); auto addAction = page.findChild(QStringLiteral("addItemAction")); QVERIFY(addAction);