Commit ca30de6a authored by Cyrille Berger's avatar Cyrille Berger

(possible) Fix: strings shown untranslated in the user interface

CCBUG:251606


svn path=/trunk/koffice/; revision=1194087
parent 6d610b39
......@@ -26,6 +26,8 @@
#include <QtCore/QMetaType>
#include <QtCore/QDebug>
#include <klocalizedstring.h>
/**
* A KoID is a combination of a user-visible string and a string that uniquely
* identifies a given resource across languages.
......@@ -35,14 +37,34 @@ class KoID
public:
KoID() : m_id(), m_name() {}
/**
* Construct a KoID with the given id, and name, id is the untranslated
* official name of the id, name should be translatable as it will be used
* in the UI.
*
* @code
* KoID("id", i18n("name"))
* @endcode
*/
explicit KoID(const QString & id, const QString & name = QString())
: m_id(id),
m_name(name) {}
/**
* Use this constructore for static KoID. as KoID("id", ki18n("name"));
* the name will be translated the first time it is needed. This is
* important because static objects are constructed before translations
* are initialized.
*/
explicit KoID(const QString & id, const KLocalizedString& name )
: m_id(id),
m_localizedString(name) {}
QString id() const {
return m_id;
}
QString name() const {
if(m_name.isEmpty()) m_name = m_localizedString.toString();
return m_name;
}
......@@ -54,7 +76,8 @@ public:
private:
QString m_id;
QString m_name;
mutable QString m_name;
KLocalizedString m_localizedString;
};
......
......@@ -22,16 +22,16 @@
#include <klocale.h>
const KoID AlphaColorModelID("A", i18n("Alpha"));
const KoID RGBAColorModelID("RGBA", i18n("Red Green Blue"));
const KoID XYZAColorModelID("XYZA", i18n("XYZ"));
const KoID LABAColorModelID("LABA", i18n("L a* b*"));
const KoID CMYKAColorModelID("CMYKA", i18n("Cyan Magenta Yellow Black"));
const KoID GrayAColorModelID("GRAYA", i18n("Grayscale"));
const KoID GrayColorModelID("GRAY", i18n("Grayscale (without transparency)"));
const KoID YCbCrAColorModelID("YCbCrA", i18n("YCbCr"));
const KoID AlphaColorModelID("A", ki18n("Alpha"));
const KoID RGBAColorModelID("RGBA", ki18n("Red Green Blue"));
const KoID XYZAColorModelID("XYZA", ki18n("XYZ"));
const KoID LABAColorModelID("LABA", ki18n("L a* b*"));
const KoID CMYKAColorModelID("CMYKA", ki18n("Cyan Magenta Yellow Black"));
const KoID GrayAColorModelID("GRAYA", ki18n("Grayscale"));
const KoID GrayColorModelID("GRAY", ki18n("Grayscale (without transparency)"));
const KoID YCbCrAColorModelID("YCbCrA", ki18n("YCbCr"));
const KoID Integer8BitsColorDepthID("U8", i18n("8 Bits"));
const KoID Integer16BitsColorDepthID("U16", i18n("16 Bits"));
const KoID Float16BitsColorDepthID("F16", i18n("16 Bits Float"));
const KoID Float32BitsColorDepthID("F32", i18n("32 Bits Float"));
const KoID Integer8BitsColorDepthID("U8", ki18n("8 Bits"));
const KoID Integer16BitsColorDepthID("U16", ki18n("16 Bits"));
const KoID Float16BitsColorDepthID("F16", ki18n("16 Bits Float"));
const KoID Float32BitsColorDepthID("F32", ki18n("32 Bits Float"));
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