kio: use static immutable map for translated NFOs

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2021-03-07 21:35:24 +02:00
parent fd2158a973
commit 5f595705a8
4 changed files with 89 additions and 129 deletions

View file

@ -118,7 +118,7 @@ void KFileMetaDataConfigurationWidget::Private::addItem(const KUrl& uri)
KConfigGroup settings = config.group("Show"); KConfigGroup settings = config.group("Show");
const QString label = (m_provider == 0) const QString label = (m_provider == 0)
? KNfoTranslator::instance().translation(uri) ? KNfoTranslator::translation(uri)
: m_provider->label(uri); : m_provider->label(uri);
QListWidgetItem* item = new QListWidgetItem(label, m_metaDataList); QListWidgetItem* item = new QListWidgetItem(label, m_metaDataList);

View file

@ -192,7 +192,7 @@ void KFileMetaDataProvider::setItems(const KFileItemList& items)
QString KFileMetaDataProvider::label(const KUrl& metaDataUri) const QString KFileMetaDataProvider::label(const KUrl& metaDataUri) const
{ {
return KNfoTranslator::instance().translation(metaDataUri.url()); return KNfoTranslator::translation(metaDataUri.url());
} }
QString KFileMetaDataProvider::group(const KUrl& metaDataUri) const QString KFileMetaDataProvider::group(const KUrl& metaDataUri) const

View file

@ -19,117 +19,101 @@
#include "knfotranslator_p.h" #include "knfotranslator_p.h"
#include <klocale.h> #include <klocale.h>
#include <kstandarddirs.h>
#include <kurl.h> #include <kurl.h>
#include <config-kio.h> #include <config-kio.h>
struct TranslationItem { #include <map>
const char* const key;
const char* const context;
const char* const value;
};
// TODO: a lot of NFOs are missing yet QString KNfoTranslator::translation(const KUrl& uri)
static const TranslationItem g_translations[] = {
{ "kfileitem#modified", I18N_NOOP2_NOSTRIP("@label", "Modified") },
{ "kfileitem#owner", I18N_NOOP2_NOSTRIP("@label", "Owner") },
{ "kfileitem#permissions", I18N_NOOP2_NOSTRIP("@label", "Permissions") },
{ "kfileitem#size", I18N_NOOP2_NOSTRIP("@label", "Size") },
{ "kfileitem#totalSize", I18N_NOOP2_NOSTRIP("@label", "Total Size") },
{ "kfileitem#type", I18N_NOOP2_NOSTRIP("@label", "Type") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#comment", I18N_NOOP2_NOSTRIP("@label", "Comment") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#contentCreated", I18N_NOOP2_NOSTRIP("@label creation date", "Created") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#contentSize", I18N_NOOP2_NOSTRIP("@label file content size", "Size") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#depends", I18N_NOOP2_NOSTRIP("@label file depends from", "Depends") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#description", I18N_NOOP2_NOSTRIP("@label", "Description") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#generator", I18N_NOOP2_NOSTRIP("@label Software used to generate content", "Generator") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#hasPart", I18N_NOOP2_NOSTRIP("@label see http://www.semanticdesktop.org/ontologies/2007/01/19/nie#hasPart", "Has Part") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#hasLogicalPart", I18N_NOOP2_NOSTRIP("@label see http://www.semanticdesktop.org/ontologies/2007/01/19/nie#hasLogicalPart", "Has Logical Part") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#isPartOf", I18N_NOOP2_NOSTRIP("@label parent directory", "Part of") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#keyword", I18N_NOOP2_NOSTRIP("@label", "Keyword") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#lastModified", I18N_NOOP2_NOSTRIP("@label modified date of file", "Modified") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#mimeType", I18N_NOOP2_NOSTRIP("@label", "MIME Type") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#plainTextContent", I18N_NOOP2_NOSTRIP("@label", "Content") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#relatedTo", I18N_NOOP2_NOSTRIP("@label", "Related To") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#subject", I18N_NOOP2_NOSTRIP("@label", "Subject") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#title", I18N_NOOP2_NOSTRIP("@label music title", "Title") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#url", I18N_NOOP2_NOSTRIP("@label file URL", "Location") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nco#creator", I18N_NOOP2_NOSTRIP("@label", "Creator") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#averageBitrate", I18N_NOOP2_NOSTRIP("@label", "Average Bitrate") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#channels", I18N_NOOP2_NOSTRIP("@label", "Channels") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#characterCount", I18N_NOOP2_NOSTRIP("@label number of characters", "Characters") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#codec", I18N_NOOP2_NOSTRIP("@label", "Codec") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#colorDepth", I18N_NOOP2_NOSTRIP("@label", "Color Depth") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#duration", I18N_NOOP2_NOSTRIP("@label", "Duration") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#fileName", I18N_NOOP2_NOSTRIP("@label", "Filename") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#hasHash", I18N_NOOP2_NOSTRIP("@label", "Hash") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#height", I18N_NOOP2_NOSTRIP("@label", "Height") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#interlaceMode", I18N_NOOP2_NOSTRIP("@label", "Interlace Mode") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#lineCount", I18N_NOOP2_NOSTRIP("@label number of lines", "Lines") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#programmingLanguage", I18N_NOOP2_NOSTRIP("@label", "Programming Language") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#sampleRate", I18N_NOOP2_NOSTRIP("@label", "Sample Rate") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#width", I18N_NOOP2_NOSTRIP("@label", "Width") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#wordCount", I18N_NOOP2_NOSTRIP("@label number of words", "Words") },
{ "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#apertureValue", I18N_NOOP2_NOSTRIP("@label EXIF aperture value", "Aperture") },
{ "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#exposureBiasValue", I18N_NOOP2_NOSTRIP("@label EXIF", "Exposure Bias Value") },
{ "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#exposureTime", I18N_NOOP2_NOSTRIP("@label EXIF", "Exposure Time") },
{ "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#flash", I18N_NOOP2_NOSTRIP("@label EXIF", "Flash") },
{ "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#focalLength", I18N_NOOP2_NOSTRIP("@label EXIF", "Focal Length") },
{ "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#focalLengthIn35mmFilm", I18N_NOOP2_NOSTRIP("@label EXIF", "Focal Length 35 mm") },
{ "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#isoSpeedRatings", I18N_NOOP2_NOSTRIP("@label EXIF", "ISO Speed Ratings") },
{ "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#make", I18N_NOOP2_NOSTRIP("@label EXIF", "Make") },
{ "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#meteringMode", I18N_NOOP2_NOSTRIP("@label EXIF", "Metering Mode") },
{ "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#model", I18N_NOOP2_NOSTRIP("@label EXIF", "Model") },
{ "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#orientation", I18N_NOOP2_NOSTRIP("@label EXIF", "Orientation") },
{ "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#whiteBalance", I18N_NOOP2_NOSTRIP("@label EXIF", "White Balance") },
{ "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#director", I18N_NOOP2_NOSTRIP("@label video director", "Director") },
{ "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#genre", I18N_NOOP2_NOSTRIP("@label music genre", "Genre") },
{ "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#musicAlbum", I18N_NOOP2_NOSTRIP("@label music album", "Album") },
{ "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#performer", I18N_NOOP2_NOSTRIP("@label", "Performer") },
{ "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#releaseDate", I18N_NOOP2_NOSTRIP("@label", "Release Date") },
{ "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#trackNumber", I18N_NOOP2_NOSTRIP("@label music track number", "Track") },
{ "http://www.semanticdesktop.org/ontologies/2007/08/15/nao#created", I18N_NOOP2_NOSTRIP("@label resource created time", "Resource Created")},
{ "http://www.semanticdesktop.org/ontologies/2007/08/15/nao#hasSubResource", I18N_NOOP2_NOSTRIP("@label", "Sub Resource")},
{ "http://www.semanticdesktop.org/ontologies/2007/08/15/nao#lastModified", I18N_NOOP2_NOSTRIP("@label resource last modified", "Resource Modified")},
{ "http://www.semanticdesktop.org/ontologies/2007/08/15/nao#numericRating", I18N_NOOP2_NOSTRIP("@label", "Numeric Rating")},
{ "http://www.semanticdesktop.org/ontologies/2010/04/30/ndo#copiedFrom", I18N_NOOP2_NOSTRIP("@label", "Copied From")},
{ "http://www.semanticdesktop.org/ontologies/2010/01/25/nuao#firstUsage", I18N_NOOP2_NOSTRIP("@label", "First Usage")},
{ "http://www.semanticdesktop.org/ontologies/2010/01/25/nuao#lastUsage", I18N_NOOP2_NOSTRIP("@label", "Last Usage")},
{ "http://www.semanticdesktop.org/ontologies/2010/01/25/nuao#usageCount", I18N_NOOP2_NOSTRIP("@label", "Usage Count")},
{ "http://nepomuk.kde.org/ontologies/2010/11/29/kext#unixFileGroup", I18N_NOOP2_NOSTRIP("@label", "Unix File Group")},
{ "http://nepomuk.kde.org/ontologies/2010/11/29/kext#unixFileMode", I18N_NOOP2_NOSTRIP("@label", "Unix File Mode")},
{ "http://nepomuk.kde.org/ontologies/2010/11/29/kext#unixFileOwner", I18N_NOOP2_NOSTRIP("@label", "Unix File Owner")},
{ "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", I18N_NOOP2_NOSTRIP("@label file type", "Type") },
{ "translation.fuzzy", I18N_NOOP2_NOSTRIP("@label Number of fuzzy translations", "Fuzzy Translations") },
{ "translation.last_translator", I18N_NOOP2_NOSTRIP("@label Name of last translator", "Last Translator") },
{ "translation.obsolete", I18N_NOOP2_NOSTRIP("@label Number of obsolete translations", "Obsolete Translations") },
{ "translation.source_date", I18N_NOOP2_NOSTRIP("@label", "Translation Source Date") },
{ "translation.total", I18N_NOOP2_NOSTRIP("@label Number of total translations", "Total Translations") },
{ "translation.translated", I18N_NOOP2_NOSTRIP("@label Number of translated strings", "Translated") },
{ "translation.translation_date", I18N_NOOP2_NOSTRIP("@label", "Translation Date") },
{ "translation.untranslated", I18N_NOOP2_NOSTRIP("@label Number of untranslated strings" , "Untranslated") },
{ 0, 0, 0 } // mandatory last entry
};
class KNfoTranslatorSingleton
{ {
public: typedef std::map<QString,QString> TranslationMap;
KNfoTranslator instance;
};
K_GLOBAL_STATIC(KNfoTranslatorSingleton, s_nfoTranslator)
KNfoTranslator& KNfoTranslator::instance() // TODO: a lot of NFOs are missing yet
{ static const TranslationMap s_translations = {
return s_nfoTranslator->instance; { "kfileitem#modified", i18nc("@label", "Modified") },
} { "kfileitem#owner", i18nc("@label", "Owner") },
{ "kfileitem#permissions", i18nc("@label", "Permissions") },
{ "kfileitem#size", i18nc("@label", "Size") },
{ "kfileitem#totalSize", i18nc("@label", "Total Size") },
{ "kfileitem#type", i18nc("@label", "Type") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#comment", i18nc("@label", "Comment") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#contentCreated", i18nc("@label creation date", "Created") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#contentSize", i18nc("@label file content size", "Size") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#depends", i18nc("@label file depends from", "Depends") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#description", i18nc("@label", "Description") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#generator", i18nc("@label Software used to generate content", "Generator") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#hasPart", i18nc("@label see http://www.semanticdesktop.org/ontologies/2007/01/19/nie#hasPart", "Has Part") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#hasLogicalPart", i18nc("@label see http://www.semanticdesktop.org/ontologies/2007/01/19/nie#hasLogicalPart", "Has Logical Part") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#isPartOf", i18nc("@label parent directory", "Part of") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#keyword", i18nc("@label", "Keyword") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#lastModified", i18nc("@label modified date of file", "Modified") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#mimeType", i18nc("@label", "MIME Type") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#plainTextContent", i18nc("@label", "Content") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#relatedTo", i18nc("@label", "Related To") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#subject", i18nc("@label", "Subject") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#title", i18nc("@label music title", "Title") },
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#url", i18nc("@label file URL", "Location") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nco#creator", i18nc("@label", "Creator") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#averageBitrate", i18nc("@label", "Average Bitrate") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#channels", i18nc("@label", "Channels") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#characterCount", i18nc("@label number of characters", "Characters") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#codec", i18nc("@label", "Codec") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#colorDepth", i18nc("@label", "Color Depth") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#duration", i18nc("@label", "Duration") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#fileName", i18nc("@label", "Filename") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#hasHash", i18nc("@label", "Hash") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#height", i18nc("@label", "Height") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#interlaceMode", i18nc("@label", "Interlace Mode") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#lineCount", i18nc("@label number of lines", "Lines") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#programmingLanguage", i18nc("@label", "Programming Language") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#sampleRate", i18nc("@label", "Sample Rate") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#width", i18nc("@label", "Width") },
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#wordCount", i18nc("@label number of words", "Words") },
{ "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#apertureValue", i18nc("@label EXIF aperture value", "Aperture") },
{ "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#exposureBiasValue", i18nc("@label EXIF", "Exposure Bias Value") },
{ "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#exposureTime", i18nc("@label EXIF", "Exposure Time") },
{ "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#flash", i18nc("@label EXIF", "Flash") },
{ "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#focalLength", i18nc("@label EXIF", "Focal Length") },
{ "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#focalLengthIn35mmFilm", i18nc("@label EXIF", "Focal Length 35 mm") },
{ "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#isoSpeedRatings", i18nc("@label EXIF", "ISO Speed Ratings") },
{ "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#make", i18nc("@label EXIF", "Make") },
{ "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#meteringMode", i18nc("@label EXIF", "Metering Mode") },
{ "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#model", i18nc("@label EXIF", "Model") },
{ "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#orientation", i18nc("@label EXIF", "Orientation") },
{ "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#whiteBalance", i18nc("@label EXIF", "White Balance") },
{ "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#director", i18nc("@label video director", "Director") },
{ "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#genre", i18nc("@label music genre", "Genre") },
{ "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#musicAlbum", i18nc("@label music album", "Album") },
{ "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#performer", i18nc("@label", "Performer") },
{ "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#releaseDate", i18nc("@label", "Release Date") },
{ "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#trackNumber", i18nc("@label music track number", "Track") },
{ "http://www.semanticdesktop.org/ontologies/2007/08/15/nao#created", i18nc("@label resource created time", "Resource Created")},
{ "http://www.semanticdesktop.org/ontologies/2007/08/15/nao#hasSubResource", i18nc("@label", "Sub Resource")},
{ "http://www.semanticdesktop.org/ontologies/2007/08/15/nao#lastModified", i18nc("@label resource last modified", "Resource Modified")},
{ "http://www.semanticdesktop.org/ontologies/2007/08/15/nao#numericRating", i18nc("@label", "Numeric Rating")},
{ "http://www.semanticdesktop.org/ontologies/2010/04/30/ndo#copiedFrom", i18nc("@label", "Copied From")},
{ "http://www.semanticdesktop.org/ontologies/2010/01/25/nuao#firstUsage", i18nc("@label", "First Usage")},
{ "http://www.semanticdesktop.org/ontologies/2010/01/25/nuao#lastUsage", i18nc("@label", "Last Usage")},
{ "http://www.semanticdesktop.org/ontologies/2010/01/25/nuao#usageCount", i18nc("@label", "Usage Count")},
{ "http://nepomuk.kde.org/ontologies/2010/11/29/kext#unixFileGroup", i18nc("@label", "Unix File Group")},
{ "http://nepomuk.kde.org/ontologies/2010/11/29/kext#unixFileMode", i18nc("@label", "Unix File Mode")},
{ "http://nepomuk.kde.org/ontologies/2010/11/29/kext#unixFileOwner", i18nc("@label", "Unix File Owner")},
{ "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", i18nc("@label file type", "Type") },
{ "translation.fuzzy", i18nc("@label Number of fuzzy translations", "Fuzzy Translations") },
{ "translation.last_translator", i18nc("@label Name of last translator", "Last Translator") },
{ "translation.obsolete", i18nc("@label Number of obsolete translations", "Obsolete Translations") },
{ "translation.source_date", i18nc("@label", "Translation Source Date") },
{ "translation.total", i18nc("@label Number of total translations", "Total Translations") },
{ "translation.translated", i18nc("@label Number of translated strings", "Translated") },
{ "translation.translation_date", i18nc("@label", "Translation Date") },
{ "translation.untranslated", i18nc("@label Number of untranslated strings" , "Untranslated") },
};
QString KNfoTranslator::translation(const KUrl& uri) const
{
const QString key = uri.url(); const QString key = uri.url();
if (m_hash.contains(key)) { const TranslationMap::const_iterator it = s_translations.find(key);
return m_hash.value(key); if (it != s_translations.cend()) {
return it->second;
} }
// fallback if the URI is not translated // fallback if the URI is not translated
@ -154,17 +138,3 @@ QString KNfoTranslator::translation(const KUrl& uri) const
} }
return tunedLabel; return tunedLabel;
} }
KNfoTranslator::KNfoTranslator() :
m_hash()
{
const TranslationItem* item = &g_translations[0];
while (item->key != 0) {
m_hash.insert(item->key, i18nc(item->context, item->value));
++item;
}
}
KNfoTranslator::~KNfoTranslator()
{
}

View file

@ -20,7 +20,6 @@
#ifndef KNFOTRANSLATOR_H #ifndef KNFOTRANSLATOR_H
#define KNFOTRANSLATOR_H #define KNFOTRANSLATOR_H
#include <QHash>
#include <QString> #include <QString>
class KUrl; class KUrl;
@ -33,16 +32,7 @@ class KUrl;
class KNfoTranslator class KNfoTranslator
{ {
public: public:
static KNfoTranslator& instance(); static QString translation(const KUrl& uri);
QString translation(const KUrl& uri) const;
protected:
KNfoTranslator();
virtual ~KNfoTranslator();
friend class KNfoTranslatorSingleton;
private:
QHash<QString, QString> m_hash;
}; };
#endif // KNFO_TRANSLATOR_H #endif // KNFO_TRANSLATOR_H