1/* This file is part of the KDE libraries
2 SPDX-FileCopyrightText: 2007 Chusslove Illich <caslav.ilic@gmx.net>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef KTRANSCRIPT_P_H
8#define KTRANSCRIPT_P_H
9
10#include <QHash>
11#include <QList>
12#include <QStringList>
13#include <QVariant>
14
15/**
16 * @internal
17 * (used by KLocalizedString)
18 *
19 * @c KTranscript provides support for programmable translations.
20 * The class is abstract in order to facilitate dynamic loading.
21 *
22 * @author Chusslove Illich <caslav.ilic@gmx.net>
23 * @short class for supporting programmable translations
24 */
25class KTranscript
26{
27public:
28 /**
29 * Evaluates interpolation.
30 *
31 * @param argv list of interpolation tokens
32 * @param lang language of the translation
33 * @param ctry locale country
34 * @param msgctxt message context
35 * @param dynctxt dynamic context
36 * @param msgid original message
37 * @param subs substitutions for message placeholders
38 * @param vals values that were formatted to substitutions
39 * @param ftrans finalized ordinary translation
40 * @param mods scripting modules to load; the list is cleared after loading
41 * @param error set to the message detailing the problem, if the script
42 failed; set to empty otherwise
43 * @param fallback set to true if the script requested fallback to ordinary
44 translation; set to false otherwise
45 * @return resolved interpolation if evaluation succeeded,
46 * empty string otherwise
47 */
48 virtual QString eval(const QList<QVariant> &argv,
49 const QString &lang,
50 const QString &ctry,
51 const QString &msgctxt,
52 const QHash<QString, QString> &dynctxt,
53 const QString &msgid,
54 const QStringList &subs,
55 const QList<QVariant> &vals,
56 const QString &ftrans,
57 QList<QStringList> &mods,
58 QString &error,
59 bool &fallback) = 0;
60
61 /**
62 * Returns the list of calls to execute an all messages after the
63 * interpolations are done, as evaluations with no parameters.
64 *
65 * @param lang language of the translation
66 * @return list of post calls
67 */
68 virtual QStringList postCalls(const QString &lang) = 0;
69
70 /**
71 * Destructor.
72 */
73 virtual ~KTranscript()
74 {
75 }
76};
77
78#ifdef KTRANSCRIPT_TESTBUILD
79KTranscript *autotestCreateKTranscriptImp();
80void autotestDestroyKTranscriptImp();
81#endif
82
83#endif
84

source code of ki18n/src/i18n/ktranscript_p.h