Commit 6266d097 authored by Martin Tobias Holmedahl Sandsmark's avatar Martin Tobias Holmedahl Sandsmark
Browse files

switch back to using ki18n

parent 8df059c5
......@@ -44,6 +44,7 @@ find_package(KF5 REQUIRED
XmlGui
CoreAddons
DocTools
I18n
)
add_definitions(
......
......@@ -25,6 +25,8 @@
#include <KConfig>
#include <KConfigGroup>
#include <KStandardShortcut>
#include <KLocalizedString>
#include <QIcon>
#include <QAction>
......@@ -72,8 +74,8 @@ QUrl HistoryAction::pop()
HistoryCollection::HistoryCollection(KActionCollection *ac, QObject *parent)
: QObject(parent)
, m_b(new HistoryAction(QIcon::fromTheme(QLatin1String( "go-previous" )), tr("Back", "Go to the last path viewed"), ac))
, m_f(new HistoryAction(QIcon::fromTheme(QLatin1String( "go-next" )), tr("Forward", "Go to forward in the history of paths viewed"), ac))
, m_b(new HistoryAction(QIcon::fromTheme(QLatin1String( "go-previous" )), i18nc("Go to the last path viewed", "Back"), ac))
, m_f(new HistoryAction(QIcon::fromTheme(QLatin1String( "go-next" )), i18nc("Go to forward in the history of paths viewed", "Forward"), ac))
, m_receiver(0)
{
ac->addAction(QLatin1String( "go_back" ), m_b);
......
......@@ -25,15 +25,16 @@
#include <KAboutData>
#include <QApplication>
#include <QCommandLineParser>
#include <KLocalizedString>
#include <QUrl>
static KAboutData about(
QStringLiteral(APP_NAME),
QObject::tr(APP_PRETTYNAME),
i18n(APP_PRETTYNAME),
QStringLiteral(APP_VERSION),
QObject::tr("Graphical disk-usage information"),
i18n("Graphical disk-usage information"),
KAboutLicense::GPL,
QObject::tr("(C) 2006 Max Howell\n\
i18n("(C) 2006 Max Howell\n\
(C) 2008-2014 Martin Sandsmark"),
QString(),
QStringLiteral("http://utils.kde.org/projects/filelight")
......@@ -44,26 +45,26 @@ int main(int argc, char *argv[])
{
using Filelight::MainWindow;
about.addAuthor(QObject::tr("Martin Sandsmark"), QObject::tr("Maintainer"), QStringLiteral("martin.sandsmark@kde.org"), QStringLiteral("http://iskrembilen.com/"));
about.addAuthor(QObject::tr("Max Howell"), QObject::tr("Original author"), QStringLiteral("max.howell@methylblue.com"), QStringLiteral("http://www.methylblue.com/"));
about.addCredit(QObject::tr("Lukas Appelhans"), QObject::tr("Help and support"));
about.addCredit(QObject::tr("Steffen Gerlach"), QObject::tr("Inspiration"), QString(), QStringLiteral("http://www.steffengerlach.de/"));
about.addCredit(QObject::tr("Mike Diehl"), QObject::tr("Original documentation"));
about.addCredit(QObject::tr("Sune Vuorela"), QObject::tr("Icon"));
about.addCredit(QObject::tr("Nuno Pinheiro"), QObject::tr("Icon"));
about.addAuthor(i18n("Martin Sandsmark"), i18n("Maintainer"), QStringLiteral("martin.sandsmark@kde.org"), QStringLiteral("http://iskrembilen.com/"));
about.addAuthor(i18n("Max Howell"), i18n("Original author"), QStringLiteral("max.howell@methylblue.com"), QStringLiteral("http://www.methylblue.com/"));
about.addCredit(i18n("Lukas Appelhans"), i18n("Help and support"));
about.addCredit(i18n("Steffen Gerlach"), i18n("Inspiration"), QString(), QStringLiteral("http://www.steffengerlach.de/"));
about.addCredit(i18n("Mike Diehl"), i18n("Original documentation"));
about.addCredit(i18n("Sune Vuorela"), i18n("Icon"));
about.addCredit(i18n("Nuno Pinheiro"), i18n("Icon"));
QApplication app(argc, argv);
app.setApplicationName(QStringLiteral(APP_NAME));
app.setApplicationDisplayName(QObject::tr(APP_PRETTYNAME));
app.setApplicationDisplayName(i18n(APP_PRETTYNAME));
app.setApplicationVersion(QStringLiteral(APP_VERSION));
app.setOrganizationDomain(QStringLiteral("kde.org"));
app.setOrganizationName(QStringLiteral("KDE"));
QCommandLineParser options;
options.setApplicationDescription(QObject::tr("Graphical disk-usage information"));
options.setApplicationDescription(i18n("Graphical disk-usage information"));
options.addHelpOption();
options.addVersionOption();
options.addPositionalArgument(QStringLiteral("url"), QObject::tr("Path or URL to scan"), QObject::tr("[url]"));
options.addPositionalArgument(QStringLiteral("url"), i18n("Path or URL to scan"), i18n("[url]"));
about.setupCommandLine(&options);
options.process(app);
about.processCommandLine(&options);
......
......@@ -51,6 +51,7 @@
#include <KActionCollection>
#include <KIO/Global> // upUrl
#include <KService>
#include <KLocalizedString>
namespace Filelight {
......@@ -59,7 +60,7 @@ MainWindow::MainWindow() : KParts::MainWindow(), m_part(0), m_histories(0)
// setXMLFile("filelightui.rc");
KService::Ptr service = KService::serviceByDesktopName(QStringLiteral("filelightpart"));
if (!service) {
KMessageBox::error(this, tr("Unable to locate the Filelight Part.\nPlease make sure Filelight was correctly installed."));
KMessageBox::error(this, i18n("Unable to locate the Filelight Part.\nPlease make sure Filelight was correctly installed."));
std::exit(1);
return;
}
......@@ -67,7 +68,7 @@ MainWindow::MainWindow() : KParts::MainWindow(), m_part(0), m_histories(0)
KPluginFactory *factory = KPluginLoader(service->library()).factory();
if (!factory) {
KMessageBox::error(this, tr("Unable to load the Filelight Part.\nPlease make sure Filelight was correctly installed."));
KMessageBox::error(this, i18n("Unable to load the Filelight Part.\nPlease make sure Filelight was correctly installed."));
std::exit(1);
return;
}
......@@ -92,7 +93,7 @@ MainWindow::MainWindow() : KParts::MainWindow(), m_part(0), m_histories(0)
const KConfigGroup config = KSharedConfig::openConfig()->group("general");
m_combo->setHistoryItems(config.readPathEntry("comboHistory", QStringList()));
} else {
KMessageBox::error(this, tr("Unable to create Filelight part widget.\nPlease ensure that Filelight is correctly installed."));
KMessageBox::error(this, i18n("Unable to create Filelight part widget.\nPlease ensure that Filelight is correctly installed."));
std::exit(1);
}
......@@ -118,38 +119,38 @@ void MainWindow::setupActions() //singleton function
QAction* action;
action = ac->addAction(QStringLiteral("scan_home"), this, SLOT(slotScanHomeFolder()));
action->setText(tr("Scan &Home Folder"));
action->setText(i18n("Scan &Home Folder"));
action->setIcon(QIcon::fromTheme(QStringLiteral("user-home")));
ac->setDefaultShortcut(action, QKeySequence(Qt::CTRL + Qt::Key_Home));
action = ac->addAction(QStringLiteral("scan_root"), this, SLOT(slotScanRootFolder()));
action->setText(tr("Scan &Root Folder"));
action->setText(i18n("Scan &Root Folder"));
action->setIcon(QIcon::fromTheme(QStringLiteral("folder-red")));
action = ac->addAction(QStringLiteral("scan_rescan"), m_part, SLOT(rescan()));
action->setText(tr("Rescan"));
action->setText(i18n("Rescan"));
action->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh")));
ac->setDefaultShortcut(action, QKeySequence::Refresh);
action = ac->addAction(QStringLiteral("scan_stop"), this, SLOT(slotAbortScan()));
action->setText(tr("Stop"));
action->setText(i18n("Stop"));
action->setIcon(QIcon::fromTheme(QStringLiteral("process-stop")));
ac->setDefaultShortcut(action, Qt::Key_Escape);
action = ac->addAction(QStringLiteral("go"), m_combo, SIGNAL(returnPressed()));
action->setText(tr("Go"));
action->setText(i18n("Go"));
action->setIcon(QIcon::fromTheme(QStringLiteral("go-jump-locationbar")));
action = ac->addAction(QStringLiteral( "scan_folder" ), this, SLOT(slotScanFolder()));
action->setText(tr("Scan Folder"));
action->setText(i18n("Scan Folder"));
action->setIcon(QIcon::fromTheme(QStringLiteral( "folder" )));
QWidgetAction *locationAction = ac->add<QWidgetAction>(QStringLiteral("location_bar"), 0, 0);
locationAction->setText(tr("Location Bar"));
locationAction->setText(i18n("Location Bar"));
locationAction->setDefaultWidget(m_combo);
m_recentScans = new KRecentFilesAction(tr("&Recent Scans"), ac);
m_recentScans = new KRecentFilesAction(i18n("&Recent Scans"), ac);
m_recentScans->setMaxItems(8);
m_histories = new HistoryCollection(ac, this);
......@@ -190,7 +191,7 @@ void MainWindow::configKeys() //slot
void MainWindow::slotScanFolder()
{
slotScanUrl(QFileDialog::getExistingDirectoryUrl(this, tr("Select Folder to Scan"), m_part->url()));
slotScanUrl(QFileDialog::getExistingDirectoryUrl(this, i18n("Select Folder to Scan"), m_part->url()));
}
void MainWindow::slotScanHomeFolder() {
......
......@@ -37,6 +37,7 @@
#include <KStandardAction>
#include <QStatusBar>
#include <KPluginFactory>
#include <KLocalizedString>
#include <QFile> //encodeName()
#include <QTimer> //postInit() hack
......@@ -68,11 +69,11 @@ Part::Part(QWidget *parentWidget, QObject *parent, const QList<QVariant>&)
KAboutData aboutData(
QLatin1String("filelightpart"),
tr(APP_PRETTYNAME),
i18n(APP_PRETTYNAME),
QLatin1String(APP_VERSION),
tr("Displays file usage in an easy to understand way."),
i18n("Displays file usage in an easy to understand way."),
KAboutLicense::GPL,
tr("(c) 2002-2004 Max Howell\n\
i18n("(c) 2002-2004 Max Howell\n\
(c) 2008-2014 Martin T. Sandsmark"),
QString(),
QLatin1String("http://utils.kde.org/projects/filelight"),
......@@ -110,7 +111,7 @@ Part::Part(QWidget *parentWidget, QObject *parent, const QList<QVariant>&)
KStandardAction::zoomIn(m_map, SLOT(zoomIn()), actionCollection());
KStandardAction::zoomOut(m_map, SLOT(zoomOut()), actionCollection());
QAction *action = actionCollection()->addAction(QLatin1String("configure_filelight"));
action->setText(tr("Configure Filelight..."));
action->setText(i18n("Configure Filelight..."));
action->setIcon(QIcon::fromTheme(QLatin1String("configure")));
connect(action, SIGNAL(triggered()), this, SLOT(configFilelight()));
......@@ -163,19 +164,19 @@ Part::openUrl(const QUrl &u)
}
else if (!uri.isValid())
{
KMSG(tr("The entered URL cannot be parsed; it is invalid."));
KMSG(i18n("The entered URL cannot be parsed; it is invalid."));
}
else if ((!isLocal && path[0] != QLatin1Char( '/' )) || (isLocal && !QDir::isAbsolutePath(path)))
{
KMSG(tr("Filelight only accepts absolute paths, eg. /%1").arg(path));
KMSG(i18n("Filelight only accepts absolute paths, eg. /%1", path));
}
else if (isLocal && access(path8bit, F_OK) != 0) //stat(path, &statbuf) == 0
{
KMSG(tr("Folder not found: %1").arg(path));
KMSG(i18n("Folder not found: %1").arg(path));
}
else if (isLocal && !QDir(path).isReadable()) //access(path8bit, R_OK | X_OK) != 0 doesn't work on win32
{
KMSG(tr("Unable to enter: %1\nYou do not have access rights to this location.").arg(path));
KMSG(i18n("Unable to enter: %1\nYou do not have access rights to this location.", path));
}
else
{
......@@ -196,7 +197,7 @@ bool
Part::closeUrl()
{
if (m_manager->abort())
statusBar()->showMessage(tr("Aborting Scan..."));
statusBar()->showMessage(i18n("Aborting Scan..."));
m_map->hide();
m_stateWidget->hide();
......@@ -251,7 +252,7 @@ Part::start(const QUrl &url)
if (m_manager->start(url)) {
setUrl(url);
const QString s = tr("Scanning: %1").arg(prettyUrl());
const QString s = i18n("Scanning: %1", prettyUrl());
stateChanged(QLatin1String( "scan_started" ));
emit started(0); //as a Part, we have to do this
emit setWindowCaption(s);
......@@ -287,7 +288,7 @@ void
Part::scanCompleted(Folder *tree)
{
if (tree) {
statusBar()->showMessage(tr("Scan completed, generating map..."));
statusBar()->showMessage(i18n("Scan completed, generating map..."));
m_stateWidget->hide();
m_map->show();
......@@ -297,7 +298,7 @@ Part::scanCompleted(Folder *tree)
}
else {
stateChanged(QLatin1String( "scan_failed" ));
emit canceled(tr("Scan failed: %1").arg(prettyUrl()));
emit canceled(i18n("Scan failed: %1").arg(prettyUrl()));
emit setWindowCaption(QString());
statusBar()->clearMessage();
......@@ -315,8 +316,8 @@ Part::mapChanged(const Folder *tree)
const int fileCount = tree->children();
const QString text = ( fileCount == 0 ) ?
tr("No files.") :
tr("%n file(s)", "number of files found", fileCount);
i18n("No files.") :
i18np("1 file", "%1 files",fileCount);
m_numberOfFiles->setText(text);
}
......
......@@ -25,6 +25,7 @@
#include <KColorScheme>
#include <KIO/Job>
#include <KLocalizedString>
#include <QLabel>
#include <QPainter>
......@@ -88,7 +89,7 @@ ProgressBox::halt()
void
ProgressBox::setText(int files)
{
m_text = tr("%n file(s)", "files found so far during scan", files);
m_text = i18np("%1 File", "%1 Files", files);
m_textWidth = fontMetrics().width(m_text);
m_textHeight = fontMetrics().height();
}
......
......@@ -25,6 +25,7 @@
#include <part/Config.h>
#include <part/fileTree.h>
#include <KFormat>
#include <KLocalizedString>
//**** REMOVE NEED FOR the +1 with MAX_RING_DEPTH uses
//**** add some angle bounds checking (possibly in Segment ctor? can I delete in a ctor?)
......@@ -146,9 +147,11 @@ RadialMap::Builder::build(const Folder* const dir, const unsigned int depth, uns
{
//append a segment for unrepresented space - a "fake" segment
const QString s = QObject::tr("%n file(s), with an average size of %1",
"description of a segment of several smaller files",
hiddenFileCount).arg(KFormat().formatByteSize(hiddenSize/hiddenFileCount));
const QString s = i18np("1 file, with an average size of %2",
"%1 files, with an average size of %2",
hiddenFileCount,
KFormat().formatByteSize(hiddenSize/hiddenFileCount));
(m_signature + depth)->append(new Segment(new File(s.toUtf8(), hiddenSize), a_start, a_end - a_start, true));
}
......
......@@ -151,7 +151,8 @@ RadialMap::Widget::paintExplodedLabels(QPainter &paint) const
int *sizes = new int [ m_map.m_visibleDepth + 1 ]; //**** make sizes an array of floats I think instead (or doubles)
// If the minimum is larger than the default it fucks up further down
if (paint.font().pointSize() < Config::minFontPitch) {
if (paint.font().pointSize() < 0 ||
paint.font().pointSize() < Config::minFontPitch) {
QFont font = paint.font();
font.setPointSize(Config::minFontPitch);
paint.setFont(font);
......
......@@ -35,6 +35,7 @@
#include <KToolInvocation>
#include <KFormat>
#include <QUrl>
#include <KLocalizedString>
#include <QApplication> //QApplication::setOverrideCursor()
#include <QClipboard>
......@@ -71,7 +72,7 @@ void RadialMap::Widget::paintEvent(QPaintEvent*)
paint.drawPixmap(m_offset, m_map.pixmap());
else
{
paint.drawText(rect(), 0, tr("ERROR: Internal representation is invalid,\nplease rescan."));
paint.drawText(rect(), 0, i18nc("We messed up, the user needs to initiate a rescan.", "Internal representation is invalid,\nplease rescan."));
return;
}
......@@ -156,14 +157,15 @@ void RadialMap::Widget::mouseMoveEvent(QMouseEvent *e)
if (m_focus->file()->isFolder()) {
int files = static_cast<const Folder*>(m_focus->file())->children();
const uint percent = uint((100 * files) / (double)m_tree->children());
string += tr("File(s): %1", 0, files);
string += i18np("File: %1", "Files: %1", files);
if (percent > 0) string += QString(QLatin1String(" (%1%)")).arg(percent);
}
const QUrl url = Widget::url(m_focus->file());
if (m_focus == m_rootSegment && url != KIO::upUrl(url)) {
string += tr("\nClick to go up to parent directory");
string += i18n("\nClick to go up to parent directory");
}
QToolTip::showText(e->globalPos(), string, this);
......@@ -216,25 +218,25 @@ void RadialMap::Widget::mousePressEvent(QMouseEvent *e)
popup.setTitle(m_focus->file()->fullPath(m_tree));
if (isDir) {
openFileManager = popup.addAction(QIcon::fromTheme(QLatin1String("system-file-manager")), tr("Open &File Manager Here"));
openFileManager = popup.addAction(QIcon::fromTheme(QLatin1String("system-file-manager")), i18n("Open &File Manager Here"));
if (url.scheme() == QLatin1String("file" ))
openTerminal = popup.addAction(QIcon::fromTheme(QLatin1String( "utilities-terminal" )), tr("Open &Terminal Here"));
openTerminal = popup.addAction(QIcon::fromTheme(QLatin1String( "utilities-terminal" )), i18n("Open &Terminal Here"));
if (m_focus->file() != m_tree) {
popup.addSeparator();
centerMap = popup.addAction(QIcon::fromTheme(QLatin1String( "zoom-in" )), tr("&Center Map Here"));
centerMap = popup.addAction(QIcon::fromTheme(QLatin1String( "zoom-in" )), i18n("&Center Map Here"));
}
}
else
openFile = popup.addAction(QIcon::fromTheme(QLatin1String("document-open")), tr("Scan/open the path of the selected element", "&Open"));
openFile = popup.addAction(QIcon::fromTheme(QLatin1String("document-open")), i18nc("Scan/open the path of the selected element", "&Open"));
popup.addSeparator();
copyClipboard = popup.addAction(QIcon::fromTheme(QLatin1String( "edit-copy" )), tr("&Copy to clipboard"));
copyClipboard = popup.addAction(QIcon::fromTheme(QLatin1String( "edit-copy" )), i18n("&Copy to clipboard"));
if (m_focus->file() != m_tree) {
popup.addSeparator();
deleteItem = popup.addAction(QIcon::fromTheme(QLatin1String( "edit-delete" )), tr("&Delete"));
deleteItem = popup.addAction(QIcon::fromTheme(QLatin1String( "edit-delete" )), i18n("&Delete"));
}
QAction* clicked = popup.exec(e->globalPos(), 0);
......@@ -255,11 +257,11 @@ void RadialMap::Widget::mousePressEvent(QMouseEvent *e)
m_toBeDeleted = m_focus;
const QUrl url = Widget::url(m_toBeDeleted->file());
const QString message = m_toBeDeleted->file()->isFolder()
? tr("<qt>The folder at <i>'%1'</i> will be <b>recursively</b> and <b>permanently</b> deleted.</qt>").arg(url.toString())
: tr("<qt><i>'%1'</i> will be <b>permanently</b> deleted.</qt>").arg(url.toString());
? i18n("<qt>The folder at <i>'%1'</i> will be <b>recursively</b> and <b>permanently</b> deleted.</qt>").arg(url.toString())
: i18n("<qt><i>'%1'</i> will be <b>permanently</b> deleted.</qt>").arg(url.toString());
const int userIntention = KMessageBox::warningContinueCancel(
this, message,
QString(), KGuiItem(tr("&Delete"), QLatin1String("edit-delete")));
QString(), KGuiItem(i18n("&Delete"), QLatin1String("edit-delete")));
if (userIntention == KMessageBox::Continue) {
KIO::Job *job = KIO::del(url);
......@@ -304,7 +306,7 @@ void RadialMap::Widget::deleteJobFinished(KJob *job)
m_map.make(m_tree, true);
repaint();
} else
KMessageBox::error(this, job->errorString(), tr("Error while deleting"));
KMessageBox::error(this, job->errorString(), i18n("Error while deleting"));
}
void RadialMap::Widget::dropEvent(QDropEvent *e)
......
......@@ -22,6 +22,7 @@
#include "settingsDialog.h"
#include "Config.h"
#include <KLocalizedString>
#include <QRadioButton>
#include <QCloseEvent>
#include <QDir>
......@@ -46,15 +47,15 @@ SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent)
m_schemaGroup = new QButtonGroup;
QRadioButton *radioButton;
radioButton = new QRadioButton(tr("Rainbow"));
radioButton = new QRadioButton(i18n("Rainbow"));
vbox->addWidget(radioButton);
m_schemaGroup->addButton(radioButton, Filelight::Rainbow);
radioButton = new QRadioButton(tr("System colors"));
radioButton = new QRadioButton(i18n("System colors"));
vbox->addWidget(radioButton);
m_schemaGroup->addButton(radioButton, Filelight::KDE);
radioButton = new QRadioButton(tr("High contrast"));
radioButton = new QRadioButton(i18n("High contrast"));
vbox->addWidget(radioButton);
m_schemaGroup->addButton(radioButton, Filelight::HighContrast);
......@@ -168,7 +169,7 @@ void SettingsDialog::toggleDontScanRemovableMedia(bool b)
void SettingsDialog::addFolder()
{
const QUrl url = QFileDialog::getExistingDirectory(this, tr("Select path to ignore"), QDir::rootPath());
const QUrl url = QFileDialog::getExistingDirectory(this, i18n("Select path to ignore"), QDir::rootPath());
//TODO error handling!
//TODO wrong protocol handling!
......@@ -184,7 +185,7 @@ void SettingsDialog::addFolder()
if (m_listBox->currentItem() == 0) m_listBox->setCurrentRow(0);
m_removeButton->setEnabled(true);
}
else QMessageBox::information(this, tr("Folder already ignored"), tr("That folder is already set to be excluded from scans."));
else QMessageBox::information(this, i18n("Folder already ignored"), i18n("That folder is already set to be excluded from scans."));
}
}
......
......@@ -31,6 +31,7 @@
#include <Solid/StorageAccess>
#include <KDiskFreeSpaceInfo>
#include <KLocalizedString>
#include <QLabel>
#include <QApplication>
......@@ -105,8 +106,8 @@ void SummaryWidget::createDiskMaps()
{
DiskList disks;
const QByteArray free = tr("Free", "Free space on the disks/partitions").toUtf8();
const QByteArray used = tr("Used", "Used space on the disks/partitions").toUtf8();
const QByteArray free = i18nc("Free space on the disks/partitions", "Free").toUtf8();
const QByteArray used = i18nc("Used space on the disks/partitions", "Used").toUtf8();
QString text;
......@@ -126,7 +127,7 @@ void SummaryWidget::createDiskMaps()
QHBoxLayout* horizontalLayout = new QHBoxLayout(info);
// Create the text and icon under the radialMap.
text = tr("<b>%1</b> (%n% Used)", "Percent used disk space on the partition", disk.used*100/disk.size).arg(disk.mount);
text = i18nc("Percent used disk space on the partition", "<b>%1</b> (%2% Used)").arg(disk.mount).arg(disk.used*100/disk.size);
QLabel *label = new QLabel(text, this);
horizontalLayout->addWidget(label);
......
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