mirror of
https://invent.kde.org/plasma/plasma-desktop.git
synced 2026-11-03 22:59:45 -09:00
Port emojier away from deprecated I18N_NOOP
This is rather dirty, the category table should hold KLazyLocalizedString instances rather than QStrings of the untranslated message, and actual translation should be done by calling toString() on those, to avoid duplicating the context. That however isn't easily possible here as the translation happens on the QML side, after using the untranslated string in a mapping table for icons. So this has to do for now.
This commit is contained in:
parent
5f24d9347f
commit
2d8a9c30b9
2 changed files with 17 additions and 11 deletions
|
|
@ -106,6 +106,9 @@ class EmojiParser(object):
|
||||||
*/
|
*/
|
||||||
// Generated from emoji-test.txt
|
// Generated from emoji-test.txt
|
||||||
#include "emojicategory.h"
|
#include "emojicategory.h"
|
||||||
|
|
||||||
|
#include <KLazyLocalizedString>
|
||||||
|
|
||||||
const QStringList &getCategoryNames()
|
const QStringList &getCategoryNames()
|
||||||
{
|
{
|
||||||
static const QStringList names = {'''
|
static const QStringList names = {'''
|
||||||
|
|
@ -113,7 +116,7 @@ const QStringList &getCategoryNames()
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
'''
|
'''
|
||||||
content = "\n".join([template_header] + [f" I18N_NOOP2(\"Emoji Category\", \"{categoryName.decode('utf-8')}\")," for categoryName in self.categoryNames] + [template_foot])
|
content = "\n".join([template_header] + [f" QString::fromUtf8(kli18nc(\"Emoji Category\", \"{categoryName.decode('utf-8')}\").untranslatedText())," for categoryName in self.categoryNames] + [template_foot])
|
||||||
with open("../emojicategory.cpp", "w") as f:
|
with open("../emojicategory.cpp", "w") as f:
|
||||||
f.write(content)
|
f.write(content)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,19 +5,22 @@
|
||||||
*/
|
*/
|
||||||
// Generated from emoji-test.txt
|
// Generated from emoji-test.txt
|
||||||
#include "emojicategory.h"
|
#include "emojicategory.h"
|
||||||
|
|
||||||
|
#include <KLazyLocalizedString>
|
||||||
|
|
||||||
const QStringList &getCategoryNames()
|
const QStringList &getCategoryNames()
|
||||||
{
|
{
|
||||||
static const QStringList names = {
|
static const QStringList names = {
|
||||||
I18N_NOOP2("Emoji Category", "Smileys and Emotion"),
|
QString::fromUtf8(kli18nc("Emoji Category", "Smileys and Emotion").untranslatedText()),
|
||||||
I18N_NOOP2("Emoji Category", "People and Body"),
|
QString::fromUtf8(kli18nc("Emoji Category", "People and Body").untranslatedText()),
|
||||||
I18N_NOOP2("Emoji Category", "Component"),
|
QString::fromUtf8(kli18nc("Emoji Category", "Component").untranslatedText()),
|
||||||
I18N_NOOP2("Emoji Category", "Animals and Nature"),
|
QString::fromUtf8(kli18nc("Emoji Category", "Animals and Nature").untranslatedText()),
|
||||||
I18N_NOOP2("Emoji Category", "Food and Drink"),
|
QString::fromUtf8(kli18nc("Emoji Category", "Food and Drink").untranslatedText()),
|
||||||
I18N_NOOP2("Emoji Category", "Travel and Places"),
|
QString::fromUtf8(kli18nc("Emoji Category", "Travel and Places").untranslatedText()),
|
||||||
I18N_NOOP2("Emoji Category", "Activities"),
|
QString::fromUtf8(kli18nc("Emoji Category", "Activities").untranslatedText()),
|
||||||
I18N_NOOP2("Emoji Category", "Objects"),
|
QString::fromUtf8(kli18nc("Emoji Category", "Objects").untranslatedText()),
|
||||||
I18N_NOOP2("Emoji Category", "Symbols"),
|
QString::fromUtf8(kli18nc("Emoji Category", "Symbols").untranslatedText()),
|
||||||
I18N_NOOP2("Emoji Category", "Flags"),
|
QString::fromUtf8(kli18nc("Emoji Category", "Flags").untranslatedText()),
|
||||||
};
|
};
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue