Added I18N for PQs, initial version. Hence resource file and language files. Changed samplesphysicalquantities to check some I18N topics.

This commit is contained in:
Klaus Basan
2013-07-27 20:23:23 +02:00
parent 581638ec7f
commit 40a97c3d82
38 changed files with 523 additions and 72 deletions

View File

@@ -2,10 +2,11 @@
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <QCoreApplication>
#include "samplesphysicalquantities.h"
#include "samplesaviation.h"
#include <QCoreApplication>
#include "blackmisc/blackmiscfreefunctions.h"
using namespace BlackMisc;
using namespace BlackMiscTest;
@@ -15,8 +16,19 @@ using namespace BlackMiscTest;
*/
int main(int argc, char *argv[])
{
BlackMisc::initResources();
QFile file(":/translations/blackmisc_i18n_de.qm");
qDebug() << (file.exists() ? "Found translations in resources" : "No translations in resources");
QTranslator translator;
translator.load("blackmisc_i18n_de", ":/translations/");
QCoreApplication a(argc, argv);
qDebug() << "Use I18N version, y? n?";
int yn = getchar();
bool t = (yn == 'y' || yn == 'Y') ? a.installTranslator(&translator) : false;
qDebug() << (t ? "Installed translator" : "No translator ");
CSamplesPhysicalQuantities::samples();
CSamplesAviation::samples();

View File

@@ -1,5 +1,4 @@
QT += core dbus
QT -= gui
TARGET = sample_quantities_avionics
TEMPLATE = app

View File

@@ -26,9 +26,9 @@ int CSamplesPhysicalQuantities::samples()
CLengthUnit lu1(CLengthUnit::cm());
CLengthUnit lu2(CLengthUnit::ft());
QString lu1s = lu1.toQString();
QString lu2s = lu2.toQString();
qDebug() << lu1 << lu2 << lu1s << lu2s;
QString lu1s = lu1.toQString(true);
QString lu2s = lu2.toQString(true);
qDebug() << lu1 << lu2 << lu1s << lu2s << lu1.getName(true) << lu2.getName(true);
const CLength l1(5.0, CLengthUnit::ft()); // 5 ft
CLength l2(1, CLengthUnit::NM()); // 1NM
CLength l3(1, CLengthUnit::km());
@@ -89,8 +89,8 @@ int CSamplesPhysicalQuantities::samples()
CTemperature t1;
CTemperature t2(20, CTemperatureUnit::C());
CTemperature t3(1, CTemperatureUnit::F());
qDebug() << t1 << t2 << t2.convertedSiValueRoundedWithUnit();
qDebug() << t3 << t3.valueRoundedWithUnit(CTemperatureUnit::C());
qDebug() << t1 << t2 << t2.convertedSiValueRoundedWithUnit(true);
qDebug() << t3.valueRoundedWithUnit(CTemperatureUnit::F(), -1 ,true) << t3.valueRoundedWithUnit(CTemperatureUnit::C(), -1, true) << "I18N/UTF";
// some logging with CLogMessage
// bDebug << p1;
@@ -111,7 +111,7 @@ int CSamplesPhysicalQuantities::samples()
qDebug() << ti1 << ti2;
CAcceleration ac1(10, CAccelerationUnit::m_s2());
qDebug() << ac1;
qDebug() << ac1 << ac1.unitValueRoundedWithUnit(-1, true) << "I18N/UTF";
// bye
qDebug() << "-----------------------------------------------";

View File

@@ -4,7 +4,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
INCLUDEPATH += . ..
TARGET = BlackBox
TARGET = blackbox
TEMPLATE = app
SOURCES += *.cpp

View File

@@ -60,7 +60,7 @@ namespace FSD
return m_tcp_socket->state() == QAbstractSocket::ConnectedState;
}
QString CFSDClient::getErrorMessage(QAbstractSocket::SocketError error)
QString CFSDClient::getErrorMessage(QAbstractSocket::SocketError /* error */)
{
return QString("Unknown");
}

View File

@@ -93,7 +93,7 @@ void CMultiPlayer::addPlane(CPlane *plane)
m_multiplayer_planes.insert(plane->callsign(), plane);
}
void CMultiPlayer::removePlane(CPlane *plane)
void CMultiPlayer::removePlane(CPlane * /** plane **/)
{
qint32 id = 0;
m_simulator->removePlane(id);

View File

@@ -81,7 +81,7 @@ namespace BlackCore {
void addPlane(CPlane *plane);
void removePlane(CPlane *plane);
void removePlane(CPlane *);
bool needsToRemoved(CPlane *plane);

View File

@@ -80,12 +80,13 @@ protected:
/*!
* \brief String for converter
* \param i18n
* \return
*/
virtual QString stringForConverter() const {
virtual QString stringForConverter(bool i18n = false) const {
QString s(this->getName());
s.append(" Active: ").append(this->m_frequencyActive.unitValueRoundedWithUnit(3));
s.append(" Standby: ").append(this->m_frequencyStandby.unitValueRoundedWithUnit(3));
s.append(" Active: ").append(this->m_frequencyActive.unitValueRoundedWithUnit(3, i18n));
s.append(" Standby: ").append(this->m_frequencyStandby.unitValueRoundedWithUnit(3, i18n));
return s;
}

View File

@@ -45,7 +45,7 @@ bool CTransponder::validate(bool strict) const
/**
* String representation
*/
QString CTransponder::stringForConverter() const
QString CTransponder::stringForConverter(bool /** i18n **/) const
{
QString s = this->getName();
s = s.append(" ").append(this->getTransponderCodeFormatted()).append(" ").append(this->getModeAsString());

View File

@@ -90,9 +90,10 @@ protected:
/*!
* \brief Meaningful string representation
* \param i18n
* \return
*/
virtual QString stringForConverter() const;
virtual QString stringForConverter(bool i18n = false) const;
public:
/*!

View File

@@ -76,7 +76,7 @@ bool CAviationVerticalPositions::operator !=(const CAviationVerticalPositions &o
/*
* String representation for converter
*/
QString CAviationVerticalPositions::stringForConverter() const
QString CAviationVerticalPositions::stringForConverter(bool /** i18n **/) const
{
QString s = QString("Altitude: ").
append(this->m_altitude.unitValueRoundedWithUnit()).

View File

@@ -28,9 +28,10 @@ private:
protected:
/*!
* \brief String for converter
* \param i18n
* \return
*/
virtual QString stringForConverter() const;
virtual QString stringForConverter(bool i18n = false) const;
/*!
* \brief Unmarshall from Dbus

View File

@@ -9,14 +9,15 @@
#include <QDebug>
#include <iostream>
namespace BlackMisc
{
namespace BlackMisc {
/*!
* \brief Provides "to QString" and stream operators
*/
// Virtual operators: http://stackoverflow.com/a/4571634/356726
class CBaseStreamStringifier
{
/*!
* \brief Stream << overload to be used in debugging messages
* \param debug
@@ -127,11 +128,12 @@ public:
/*!
* \brief Cast as QString
* \bool i18n
* \remarks operator cast caused too many ambiguity trouble
*/
QString toQString() const
QString toQString(bool i18n = false) const
{
return this->stringForConverter();
return this->stringForConverter(i18n);
}
protected:
@@ -152,9 +154,10 @@ protected:
/*!
* \brief String for converter
* \param i18n
* \return
*/
virtual QString stringForConverter() const = 0;
virtual QString stringForConverter(bool i18n = false) const = 0;
/*!
* \brief Stream to DBus
@@ -175,6 +178,7 @@ protected:
* \return
*/
CBaseStreamStringifier& operator=(const CBaseStreamStringifier&) { return *this; }
};
} // namespace

View File

@@ -6,14 +6,21 @@ CONFIG += staticlib
INCLUDEPATH += ..
# DEPENDPATH += . .. // BlackMisc should be independent
# PRECOMPILED_HEADER = stdpch.h
precompile_header:!isEmpty(PRECOMPILED_HEADER) {
DEFINES += USING_PCH
}
DEFINES += LOG_IN_FILE
RESOURCES += blackmisc.qrc
# lupdate
CODECFORTR = UTF-8
TRANSLATIONS += translations/blackmisc_i18n_de.ts \
translations/blackmisc_i18n_fr.ts \
translations/blackmisc_i18n_en.ts
HEADERS += *.h
SOURCES += *.cpp
DESTDIR = ../../lib
OTHER_FILES += $$TRANSLATIONS

View File

@@ -0,0 +1,7 @@
<RCC>
<qresource prefix="/">
<file>translations/blackmisc_i18n_de.qm</file>
<file>translations/blackmisc_i18n_fr.qm</file>
<file>translations/blackmisc_i18n_en.qm</file>
</qresource>
</RCC>

View File

@@ -69,3 +69,11 @@ void BlackMisc::registerMetadata()
Math::registerMetadata();
Geo::registerMetadata();
}
/*
* Init resources
*/
void BlackMisc::initResources()
{
initBlackMiscResources();
}

View File

@@ -10,6 +10,14 @@
#include "mathallclasses.h"
#include "geoallclasses.h"
/*!
* \brief Workaround, to call initResource from namespace
*/
inline void initBlackMiscResources() { Q_INIT_RESOURCE(blackmisc); }
/*!
* Free functions in BlackMisc
*/
namespace BlackMisc {
/*!
@@ -59,6 +67,12 @@ void registerMetadata();
*/
void registerMetadata();
/*!
* \brief Init resources
*/
void initResources();
} // BlackMisc
#endif // BLACKMISC_FREEFUNCTIONS_H

View File

@@ -92,7 +92,7 @@ void CComServer::sendToAll(const QString &messageID, const QByteArray &data)
}
}
QString CComServer::getErrorMessage(const QAbstractSocket::SocketError error)
QString CComServer::getErrorMessage(const QAbstractSocket::SocketError /** error **/)
{
return QString();
}
@@ -128,7 +128,7 @@ void CComServer::onClientDisconnected(uint clientID)
m_client_buffers.take(clientID)->deleteLater();
}
void CComServer::onClientMessageReceived(uint clientID, QString &messageID, QByteArray &message)
void CComServer::onClientMessageReceived(uint /** clientID **/, QString &messageID, QByteArray &message)
{
emit doMessageReceived(messageID, message);
}

View File

@@ -13,10 +13,10 @@ namespace Geo
/*
* String for converter
*/
QString CCoordinateGeodetic::stringForConverter() const
QString CCoordinateGeodetic::stringForConverter(bool i18n) const
{
QString s = "Geodetic: {%1, %2, %3}";
return s.arg(this->m_latitude.unitValueRoundedWithUnit(6)).arg(this->m_longitude.unitValueRoundedWithUnit(6)).arg(this->m_height.unitValueRoundedWithUnit());
return s.arg(this->m_latitude.unitValueRoundedWithUnit(6, i18n)).arg(this->m_longitude.unitValueRoundedWithUnit(6, i18n)).arg(this->m_height.unitValueRoundedWithUnit(i18n));
}
/*

View File

@@ -49,9 +49,10 @@ protected:
/*!
* \brief String for converter
* \param i18n
* \return
*/
virtual QString stringForConverter() const;
virtual QString stringForConverter(bool i18n = false) const;
/*!
* \brief Stream to DBus

View File

@@ -14,7 +14,7 @@ CDebug::CDebug()
}
void CDebug::create(const char *logPath, bool logInFile, bool eraseLastLog)
void CDebug::create(const char * /** logPath **/, bool logInFile, bool eraseLastLog)
{
if (!m_isInitialized)
{

View File

@@ -225,7 +225,7 @@ namespace BlackMisc
if (m_file->handle() == -1)
{
if ( !m_file->open(QIODevice::WriteOnly) )
printf ("Can't open log file '%s': %s\n", m_fileName.toLatin1().constData(), strerror (errno));
printf ("Can't open log file '%s': %s\n", m_fileName.toLatin1().constData(), strerror(errno));
}
if (m_file->handle() != -1)

View File

@@ -149,7 +149,7 @@ template<class ImplMatrix, int Rows, int Columns> void CMatrixBase<ImplMatrix, R
/*
* Convert to string
*/
template <class ImplMatrix, int Rows, int Columns> QString CMatrixBase<ImplMatrix, Rows, Columns>::stringForConverter() const
template <class ImplMatrix, int Rows, int Columns> QString CMatrixBase<ImplMatrix, Rows, Columns>::stringForConverter(bool /** i18n **/) const
{
QString s = "{";
for (int r = 0; r < Rows; r++)

View File

@@ -46,9 +46,10 @@ protected:
/*!
* \brief Conversion to string
* \param i18n
* \return
*/
QString stringForConverter() const;
QString stringForConverter(bool i18n = false) const;
/*!
* \brief Stream to DBus

View File

@@ -16,7 +16,7 @@ namespace Math
/*
* Convert to string
*/
template <class ImplVector> QString CVector3DBase<ImplVector>::stringForConverter() const
template <class ImplVector> QString CVector3DBase<ImplVector>::stringForConverter(bool /** i18n **/) const
{
QString s = ("{%1, %2, %3}");
s = s.arg(QString::number(this->m_i, 'f')).

View File

@@ -104,9 +104,10 @@ protected:
/*!
* \brief String for converter
* \param i18n
* \return
*/
virtual QString stringForConverter() const;
virtual QString stringForConverter(bool i18n = false) const;
/*!
* \brief Unmarshall from Dbus

View File

@@ -162,9 +162,9 @@ double CMeasurementUnit::conversionToUnit(double value, const CMeasurementUnit &
* Value to QString with unit, e.g. "5.00m"
* @return
*/
QString CMeasurementUnit::valueRoundedWithUnit(double value, int digits) const
QString CMeasurementUnit::valueRoundedWithUnit(double value, int digits, bool i18n) const
{
return this->toQStringRounded(value, digits).append(this->getUnitName());
return this->toQStringRounded(value, digits).append(this->getUnitName(i18n));
}
/*

View File

@@ -8,6 +8,7 @@
#include "blackmisc/basestreamstringifier.h"
#include "blackmisc/debug.h"
#include <QCoreApplication>
#include <QDBusArgument>
#include <QString>
#include <QtGlobal>
@@ -43,9 +44,10 @@ private:
protected:
/*!
* \brief Name as stringification
* \param i18n
* \return
*/
virtual QString stringForConverter() const
virtual QString stringForConverter(bool /* i18n */ = false) const
{
return this->m_name;
}
@@ -345,16 +347,17 @@ protected:
*/
virtual QString stringForStreaming() const
{
return this->m_name;
return this->getName(false);
}
/*!
* \brief String for converter is unit
* \brief Name as stringification
* \param i18n
* \return
*/
virtual QString stringForConverter() const
virtual QString stringForConverter(bool i18n = false) const
{
return this->m_unitName;
return this->getUnitName(i18n);
}
/*!
@@ -450,20 +453,22 @@ public:
/*!
* \brief Name such as "meter"
* \param i18n
* \return
*/
QString getName() const
QString getName(bool i18n=false) const
{
return this->m_name;
return i18n ? QCoreApplication::translate("CMeasurementUnit", this->m_name.toStdString().c_str()) : this->m_name;
}
/*!
* \brief Unit name such as "m"
* \param i18n
* \return
*/
QString getUnitName() const
QString getUnitName(bool i18n = false) const
{
return this->m_unitName;
return i18n ? QCoreApplication::translate("CMeasurementUnit", this->m_unitName.toStdString().c_str()) : this->m_unitName;
}
/*!
@@ -518,9 +523,10 @@ public:
* \brief Value rounded with unit, e.g. "5.00m", "30kHz"
* \param value
* \param digits
* \param i18n
* \return
*/
virtual QString valueRoundedWithUnit(double value, int digits = -1) const;
virtual QString valueRoundedWithUnit(double value, int digits = -1, bool i18n = false) const;
/*!
* \brief Threshold for rounding

View File

@@ -339,9 +339,9 @@ template <class MU, class PQ> QString CPhysicalQuantity<MU, PQ>::unitValueToQStr
/*
* Rounded with unit
*/
template <class MU, class PQ> QString CPhysicalQuantity<MU, PQ>::unitValueRoundedWithUnit(int digits) const
template <class MU, class PQ> QString CPhysicalQuantity<MU, PQ>::unitValueRoundedWithUnit(int digits, bool i18n) const
{
return this->m_unit.valueRoundedWithUnit(this->m_unitValueD, digits);
return this->m_unit.valueRoundedWithUnit(this->m_unitValueD, digits, i18n);
}
/*
@@ -356,20 +356,19 @@ template <class MU, class PQ> QString CPhysicalQuantity<MU, PQ>::convertedSiValu
/*
* SI base unit value with unit
*/
template <class MU, class PQ> QString CPhysicalQuantity<MU, PQ>::convertedSiValueRoundedWithUnit(int digits) const
template <class MU, class PQ> QString CPhysicalQuantity<MU, PQ>::convertedSiValueRoundedWithUnit(int digits, bool i18n) const
{
if (digits < 1) digits = this->m_conversionSiUnit.getDisplayDigits();
return this->convertedSiValueToQStringRounded(digits).append(this->m_conversionSiUnit.getUnitName());
return this->m_conversionSiUnit.valueRoundedWithUnit(this->m_convertedSiUnitValueD, digits, i18n);
}
/*
* Value rounded in unit
*/
template <class MU, class PQ> QString CPhysicalQuantity<MU, PQ>::valueRoundedWithUnit(const MU &unit, int digits) const
template <class MU, class PQ> QString CPhysicalQuantity<MU, PQ>::valueRoundedWithUnit(const MU &unit, int digits, bool i18n) const
{
if (unit == this->m_unit) return this->unitValueRoundedWithUnit(digits);
if (unit == this->m_conversionSiUnit) return this->convertedSiValueRoundedWithUnit(digits);
return unit.valueRoundedWithUnit(this->value(unit), digits);
if (unit == this->m_unit) return this->unitValueRoundedWithUnit(digits, i18n);
if (unit == this->m_conversionSiUnit) return this->convertedSiValueRoundedWithUnit(digits, i18n);
return unit.valueRoundedWithUnit(this->value(unit), digits, i18n);
}
/*

View File

@@ -71,12 +71,13 @@ protected:
CPhysicalQuantity(double baseValue, const MU &unit, const MU &siConversionUnit);
/*!
* \brief String for converter and streaming
* \brief Name as stringification
* \param i18n
* \return
*/
virtual QString stringForConverter() const
virtual QString stringForConverter(bool i18n = false) const
{
return this->unitValueRoundedWithUnit(-1);
return this->unitValueRoundedWithUnit(i18n);
}
/*!
@@ -180,9 +181,10 @@ public:
* \brief Value to QString with unit, e.g. "5.00m"
* \param unit
* \param digits
* \param i18n
* \return
*/
QString valueRoundedWithUnit(const MU &unit, int digits = -1) const;
QString valueRoundedWithUnit(const MU &unit, int digits = -1, bool i18n = false) const;
/*!
* \brief Value as int
@@ -205,9 +207,10 @@ public:
/*!
* \brief Value to QString with unit, e.g. "5.00m"
* \param digits
* \param i18n
* \return
*/
QString unitValueRoundedWithUnit(int digits = -1) const;
QString unitValueRoundedWithUnit(int digits = -1, bool i18n = false) const;
/*!
* \brief Rounded value by n digits
@@ -259,9 +262,10 @@ public:
/*!
* \brief SI Base unit value rounded
* \param digits
* \param i18n
* \return
*/
QString convertedSiValueRoundedWithUnit(int digits = -1) const;
QString convertedSiValueRoundedWithUnit(int digits = -1, bool i18n = false) const;
/*!
* \brief Add to the unit value.

View File

@@ -10,12 +10,15 @@
#include <QDBusArgument>
#include <QList>
#include <QtCore/qmath.h>
#include <QTranslator>
//
// Used with the template for quantities. This is the reason for
// having all units in one file, since template requires concrete instantiations
//
// I18N: http://qt-project.org/doc/qt-4.8/linguist-programmers.html#translating-text-that-is-outside-of-a-qobject-subclass
//
namespace BlackMisc
{
namespace PhysicalQuantities
@@ -26,6 +29,7 @@ namespace PhysicalQuantities
*/
class CLengthUnit : public CMeasurementUnit
{
private:
/*!
* \brief Constructor length unit
@@ -43,6 +47,7 @@ private:
{
// void
}
public:
/*!
* Default constructor, we do not want this, but required for Qt Metasystem
@@ -66,16 +71,19 @@ public:
{
static CLengthUnit m("meter", "m", true, true);
return m;
QT_TRANSLATE_NOOP("CMeasurementUnit", "meter");
}
/*!
* \brief Nautical miles NM
* \return
*/
static const CLengthUnit &NM()
{
static CLengthUnit NM("nautical miles", "NM", false, false, 1000.0 * 1.85200, CMeasurementPrefix::One(), 3);
static CLengthUnit NM("nautical mile", "NM", false, false, 1000.0 * 1.85200, CMeasurementPrefix::One(), 3);
return NM;
QT_TRANSLATE_NOOP("CMeasurementUnit", "nautical mile");
}
/*!
@@ -86,8 +94,10 @@ public:
{
static CLengthUnit ft("foot", "ft", false, false, 0.3048, CMeasurementPrefix::One(), 0);
return ft;
QT_TRANSLATE_NOOP("CMeasurementUnit", "foot");
}
/*!
* \brief Kilometer km
* \return
@@ -96,6 +106,7 @@ public:
{
static CLengthUnit km("kilometer", "km", true, false, CMeasurementPrefix::k().getFactor(), CMeasurementPrefix::k(), 3);
return km;
QT_TRANSLATE_NOOP("CMeasurementUnit", "kilometer");
}
/*!
@@ -106,6 +117,7 @@ public:
{
static CLengthUnit cm("centimeter", "cm", true, false, CMeasurementPrefix::c().getFactor(), CMeasurementPrefix::c(), 1);
return cm;
QT_TRANSLATE_NOOP("CMeasurementUnit", "centimeter");
}
/*!
@@ -116,6 +128,7 @@ public:
{
static CLengthUnit mi("mile", "mi", false, false, 1609.344, CMeasurementPrefix::None(), 3);
return mi;
QT_TRANSLATE_NOOP("CMeasurementUnit", "mile");
}
/*!
@@ -126,6 +139,7 @@ public:
{
static CLengthUnit mi("mile(statute)", "mi(statute)", false, false, 1609.3472, CMeasurementPrefix::None(), 3);
return mi;
QT_TRANSLATE_NOOP("CMeasurementUnit", "mile(statute)");
}
/*!
@@ -238,6 +252,7 @@ public:
{
static CAngleUnit rad("radian", "rad", true);
return rad;
QT_TRANSLATE_NOOP("CMeasurementUnit", "radian");
}
/*!
@@ -248,6 +263,8 @@ public:
{
static CAngleUnit deg("degree", "deg", false, M_PI / 180);
return deg;
QT_TRANSLATE_NOOP("CMeasurementUnit", "degree");
QT_TRANSLATE_NOOP("CMeasurementUnit", "deg");
}
/*!
@@ -258,6 +275,7 @@ public:
{
static CAngleUnit deg("segadecimal degree", "segd", false, M_PI / 180,
CMeasurementPrefix::One(), 0, 1E-9, CAngleUnit::conversionSexagesimalToSi, CAngleUnit::conversionSexagesimalFromSi); return deg;
QT_TRANSLATE_NOOP("CMeasurementUnit", "segadecimal degree");
}
/*!
@@ -614,8 +632,9 @@ public:
*/
static const CPressureUnit &mbar()
{
static CPressureUnit bar("bar", "bar", false, 1E2);
static CPressureUnit bar("millibar", "bar", false, 1E2);
return bar;
QT_TRANSLATE_NOOP("CMeasurementUnit", "millibar");
}
/*!
@@ -624,8 +643,9 @@ public:
*/
static const CPressureUnit &inHg()
{
static CPressureUnit inhg("Inch of mercury 0°C", "inHg", false, 3386.389);
static CPressureUnit inhg("inch of mercury 0C", "inHg", false, 3386.389);
return inhg;
QT_TRANSLATE_NOOP("CMeasurementUnit", "inch of mercury 0C");
}
/*!
@@ -634,8 +654,9 @@ public:
*/
static const CPressureUnit &inHgFL()
{
static CPressureUnit inhg("Inch of mercury ", "inHg", false, 3386.5307486631);
static CPressureUnit inhg("inch of mercury", "inHg", false, 3386.5307486631);
return inhg;
QT_TRANSLATE_NOOP("CMeasurementUnit", "inch of mercury 0C");
}
/*!
@@ -750,6 +771,7 @@ public:
{
static CTemperatureUnit K("Kelvin", "K", true, true);
return K;
QT_TRANSLATE_NOOP("CMeasurementUnit", "Kelvin");
}
/*!
@@ -758,8 +780,10 @@ public:
*/
static const CTemperatureUnit &C()
{
static CTemperatureUnit C("centigrade", "°C", false, false, 1.0, 273.15);
static CTemperatureUnit C("centigrade", "C", false, false, 1.0, 273.15);
return C;
QT_TRANSLATE_NOOP("CMeasurementUnit", "centigrade");
QT_TRANSLATE_NOOP("CMeasurementUnit", "C");
}
/*!
@@ -768,8 +792,10 @@ public:
*/
static const CTemperatureUnit &F()
{
static CTemperatureUnit F("Fahrenheit", "°F", false, false, 5.0 / 9.0, 459.67);
static CTemperatureUnit F("Fahrenheit", "F", false, false, 5.0 / 9.0, 459.67);
return F;
QT_TRANSLATE_NOOP("CMeasurementUnit", "Fahrenheit");
QT_TRANSLATE_NOOP("CMeasurementUnit", "F");
}
/*!
@@ -1098,7 +1124,7 @@ public:
/*!
* Default constructor, we do not want this, but required for Qt Metasystem
*/
CAccelerationUnit() : CMeasurementUnit("meter/second²", "m/s²", "acceleration", true, false, 1, CMeasurementPrefix::None(), 1) {}
CAccelerationUnit() : CMeasurementUnit("meter/second²", "m/s^2", "acceleration", true, false, 1, CMeasurementPrefix::None(), 1) {}
/*!
* Constructor, allows to implement methods in base class
@@ -1112,8 +1138,10 @@ public:
*/
static const CAccelerationUnit &m_s2()
{
static CAccelerationUnit ms2("meter/second²", "m/s²", true, false, 1, CMeasurementPrefix::None(), 1);
static CAccelerationUnit ms2("meter/second^2", "m/s^2", true, false, 1, CMeasurementPrefix::None(), 1);
return ms2;
QT_TRANSLATE_NOOP("CMeasurementUnit", "meter/second^2");
QT_TRANSLATE_NOOP("CMeasurementUnit", "m/s^2");
}
/*!
@@ -1122,8 +1150,10 @@ public:
*/
static const CAccelerationUnit &ft_s2()
{
static CAccelerationUnit fts2("feet/seconds²", "ft/s²", true, false, 3.28084, CMeasurementPrefix::m(), 0);
static CAccelerationUnit fts2("feet/seconds²", "ft/s^2", true, false, 3.28084, CMeasurementPrefix::m(), 0);
return fts2;
QT_TRANSLATE_NOOP("CMeasurementUnit", "feet/second^2");
QT_TRANSLATE_NOOP("CMeasurementUnit", "ft/s^2");
}
/*!
@@ -1166,6 +1196,7 @@ protected:
};
Q_DECLARE_METATYPE(BlackMisc::PhysicalQuantities::CAccelerationUnit)
} // namespace
} // namespace
#endif // guard

Binary file not shown.

View File

@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="de_DE">
<context>
<name>CMeasurementUnit</name>
<message>
<location filename="../pqunits.h" line="74"/>
<source>meter</source>
<translation>Meter</translation>
</message>
<message>
<location filename="../pqunits.h" line="86"/>
<source>nautical mile</source>
<translation>Nautische Meile</translation>
</message>
<message>
<location filename="../pqunits.h" line="97"/>
<source>foot</source>
<translation>Fuß</translation>
</message>
<message>
<location filename="../pqunits.h" line="109"/>
<source>kilometer</source>
<translation>Kilometer</translation>
</message>
<message>
<location filename="../pqunits.h" line="120"/>
<source>centimeter</source>
<translation>Zentimeter</translation>
</message>
<message>
<location filename="../pqunits.h" line="131"/>
<source>mile</source>
<translation>Meile</translation>
</message>
<message>
<location filename="../pqunits.h" line="142"/>
<source>mile(statute)</source>
<translation>Statute Meile</translation>
</message>
<message>
<location filename="../pqunits.h" line="255"/>
<source>radian</source>
<translation type="unfinished">Bogenmaß</translation>
</message>
<message>
<location filename="../pqunits.h" line="266"/>
<source>degree</source>
<translation>Grad</translation>
</message>
<message>
<location filename="../pqunits.h" line="267"/>
<source>deg</source>
<translation>°</translation>
</message>
<message>
<location filename="../pqunits.h" line="278"/>
<source>segadecimal degree</source>
<translation>Segadezimal</translation>
</message>
<message>
<location filename="../pqunits.h" line="637"/>
<source>millibar</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../pqunits.h" line="648"/>
<location filename="../pqunits.h" line="659"/>
<source>inch of mercury 0C</source>
<translation type="unfinished">Inch Hg bei 0°C</translation>
</message>
<message>
<location filename="../pqunits.h" line="774"/>
<source>Kelvin</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../pqunits.h" line="785"/>
<source>centigrade</source>
<translation type="unfinished">Grad Celcsius</translation>
</message>
<message>
<location filename="../pqunits.h" line="786"/>
<source>C</source>
<translation>°C</translation>
</message>
<message>
<location filename="../pqunits.h" line="797"/>
<source>Fahrenheit</source>
<translation type="unfinished">Fahrenheit</translation>
</message>
<message>
<location filename="../pqunits.h" line="798"/>
<source>F</source>
<translation>°F</translation>
</message>
<message>
<location filename="../pqunits.h" line="1143"/>
<source>meter/second^2</source>
<translation type="unfinished">Meter/Sekunde²</translation>
</message>
<message>
<location filename="../pqunits.h" line="1144"/>
<source>m/s^2</source>
<translation type="unfinished">m/s²</translation>
</message>
<message>
<location filename="../pqunits.h" line="1156"/>
<source>ft/s^2</source>
<translation>ft/s²</translation>
</message>
<message>
<location filename="../pqunits.h" line="1155"/>
<source>feet/second^2</source>
<translation>Fuß/Sekunde^2</translation>
</message>
</context>
</TS>

Binary file not shown.

View File

@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="en_US">
<context>
<name>CMeasurementUnit</name>
<message>
<location filename="../pqunits.h" line="74"/>
<source>meter</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../pqunits.h" line="86"/>
<source>nautical mile</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../pqunits.h" line="97"/>
<source>foot</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../pqunits.h" line="109"/>
<source>kilometer</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../pqunits.h" line="120"/>
<source>centimeter</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../pqunits.h" line="131"/>
<source>mile</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../pqunits.h" line="142"/>
<source>mile(statute)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../pqunits.h" line="255"/>
<source>radian</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../pqunits.h" line="266"/>
<source>degree</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../pqunits.h" line="267"/>
<source>deg</source>
<translation>°</translation>
</message>
<message>
<location filename="../pqunits.h" line="278"/>
<source>segadecimal degree</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../pqunits.h" line="637"/>
<source>millibar</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../pqunits.h" line="648"/>
<location filename="../pqunits.h" line="659"/>
<source>inch of mercury 0C</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../pqunits.h" line="774"/>
<source>Kelvin</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../pqunits.h" line="785"/>
<source>centigrade</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../pqunits.h" line="786"/>
<source>C</source>
<translation>°C</translation>
</message>
<message>
<location filename="../pqunits.h" line="797"/>
<source>Fahrenheit</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../pqunits.h" line="798"/>
<source>F</source>
<translation>°F</translation>
</message>
<message>
<location filename="../pqunits.h" line="1143"/>
<source>meter/second^2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../pqunits.h" line="1144"/>
<source>m/s^2</source>
<translation type="unfinished">m/s²</translation>
</message>
<message>
<location filename="../pqunits.h" line="1156"/>
<source>ft/s^2</source>
<translation>ft/s²</translation>
</message>
<message>
<location filename="../pqunits.h" line="1155"/>
<source>feet/second^2</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

Binary file not shown.

View File

@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="fr_FR">
<context>
<name>CMeasurementUnit</name>
<message>
<location filename="../pqunits.h" line="74"/>
<source>meter</source>
<translation>mètre</translation>
</message>
<message>
<location filename="../pqunits.h" line="86"/>
<source>nautical mile</source>
<translation>nautique mile</translation>
</message>
<message>
<location filename="../pqunits.h" line="97"/>
<source>foot</source>
<translation>foot</translation>
</message>
<message>
<location filename="../pqunits.h" line="109"/>
<source>kilometer</source>
<translation>kilomètre</translation>
</message>
<message>
<location filename="../pqunits.h" line="120"/>
<source>centimeter</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../pqunits.h" line="131"/>
<source>mile</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../pqunits.h" line="142"/>
<source>mile(statute)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../pqunits.h" line="255"/>
<source>radian</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../pqunits.h" line="266"/>
<source>degree</source>
<translation>degré</translation>
</message>
<message>
<location filename="../pqunits.h" line="267"/>
<source>deg</source>
<translation>°</translation>
</message>
<message>
<location filename="../pqunits.h" line="278"/>
<source>segadecimal degree</source>
<translation>segadecimal</translation>
</message>
<message>
<location filename="../pqunits.h" line="637"/>
<source>millibar</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../pqunits.h" line="648"/>
<location filename="../pqunits.h" line="659"/>
<source>inch of mercury 0C</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../pqunits.h" line="774"/>
<source>Kelvin</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../pqunits.h" line="785"/>
<source>centigrade</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../pqunits.h" line="786"/>
<source>C</source>
<translation>°C</translation>
</message>
<message>
<location filename="../pqunits.h" line="797"/>
<source>Fahrenheit</source>
<translation>Fahrenheit</translation>
</message>
<message>
<location filename="../pqunits.h" line="798"/>
<source>F</source>
<translation>°F</translation>
</message>
<message>
<location filename="../pqunits.h" line="1143"/>
<source>meter/second^2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../pqunits.h" line="1144"/>
<source>m/s^2</source>
<translation>m/s²</translation>
</message>
<message>
<location filename="../pqunits.h" line="1156"/>
<source>ft/s^2</source>
<translation>ft/s²</translation>
</message>
<message>
<location filename="../pqunits.h" line="1155"/>
<source>feet/second^2</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>