Remove Pot translator

This commit is contained in:
Jonas Kvinge 2024-10-21 00:29:21 +02:00
parent 60f4a57425
commit c818dabe92
4 changed files with 1 additions and 77 deletions

View File

@ -440,7 +440,6 @@ set(SOURCES
src/core/systemtrayicon.cpp src/core/systemtrayicon.cpp
src/core/localredirectserver.cpp src/core/localredirectserver.cpp
src/core/mimedata.cpp src/core/mimedata.cpp
src/core/potranslator.cpp
src/core/temporaryfile.cpp src/core/temporaryfile.cpp
src/utilities/strutils.cpp src/utilities/strutils.cpp
src/utilities/envutils.cpp src/utilities/envutils.cpp
@ -773,7 +772,6 @@ set(HEADERS
src/core/urlhandler.h src/core/urlhandler.h
src/core/standarditemiconloader.h src/core/standarditemiconloader.h
src/core/translations.h src/core/translations.h
src/core/potranslator.h
src/core/mimedata.h src/core/mimedata.h
src/core/stylesheetloader.h src/core/stylesheetloader.h
src/core/localredirectserver.h src/core/localredirectserver.h

View File

@ -1,34 +0,0 @@
/*
* Strawberry Music Player
* This file was part of Clementine.
* Copyright 2010, David Sansome <me@davidsansome.com>
* Copyright 2018-2024, Jonas Kvinge <jonas@jkvinge.net>
*
* Strawberry is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Strawberry is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <QString>
#include "potranslator.h"
PoTranslator::PoTranslator(QObject *parent) : QTranslator(parent) {}
QString PoTranslator::translate(const char *context, const char *source_text, const char *disambiguation, const int n) const {
QString ret = QTranslator::translate(context, source_text, disambiguation, n);
if (!ret.isEmpty()) return ret;
return QTranslator::translate(nullptr, source_text, disambiguation, n);
}

View File

@ -1,39 +0,0 @@
/*
* Strawberry Music Player
* This file was part of Clementine.
* Copyright 2010, David Sansome <me@davidsansome.com>
* Copyright 2018-2024, Jonas Kvinge <jonas@jkvinge.net>
*
* Strawberry is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Strawberry is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef POTRANSLATOR_H
#define POTRANSLATOR_H
#include <QTranslator>
#include <QString>
// We convert from .po files to .qm files, which loses context information.
// This translator tries loading strings with an empty context if it can't find any others.
class PoTranslator : public QTranslator {
Q_OBJECT
public:
explicit PoTranslator(QObject *parent = nullptr);
QString translate(const char *context, const char *source_text, const char *disambiguation = nullptr, int n = -1) const override;
};
#endif // POTRANSLATOR_H

View File

@ -27,7 +27,6 @@
#include "translations.h" #include "translations.h"
#include "core/logging.h" #include "core/logging.h"
#include "core/potranslator.h"
using namespace Qt::Literals::StringLiterals; using namespace Qt::Literals::StringLiterals;
@ -45,7 +44,7 @@ Translations::~Translations() {
void Translations::LoadTranslation(const QString &prefix, const QString &path, const QString &language) { void Translations::LoadTranslation(const QString &prefix, const QString &path, const QString &language) {
const QString basefilename = prefix + u'_' + language; const QString basefilename = prefix + u'_' + language;
QTranslator *t = new PoTranslator; QTranslator *t = new QTranslator;
if (t->load(basefilename, path)) { if (t->load(basefilename, path)) {
qLog(Debug) << "Tranlations loaded from" << basefilename; qLog(Debug) << "Tranlations loaded from" << basefilename;
QCoreApplication::installTranslator(t); QCoreApplication::installTranslator(t);