File indexing completed on 2024-04-21 03:54:24
0001 /* This file is part of the KDE libraries 0002 SPDX-FileCopyrightText: 2007 Chusslove Illich <caslav.ilic@gmx.net> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef KTRANSCRIPT_P_H 0008 #define KTRANSCRIPT_P_H 0009 0010 #include <QHash> 0011 #include <QList> 0012 #include <QStringList> 0013 #include <QVariant> 0014 0015 /** 0016 * @internal 0017 * (used by KLocalizedString) 0018 * 0019 * @c KTranscript provides support for programmable translations. 0020 * The class is abstract in order to facilitate dynamic loading. 0021 * 0022 * @author Chusslove Illich <caslav.ilic@gmx.net> 0023 * @short class for supporting programmable translations 0024 */ 0025 class KTranscript 0026 { 0027 public: 0028 /** 0029 * Evaluates interpolation. 0030 * 0031 * @param argv list of interpolation tokens 0032 * @param lang language of the translation 0033 * @param ctry locale country 0034 * @param msgctxt message context 0035 * @param dynctxt dynamic context 0036 * @param msgid original message 0037 * @param subs substitutions for message placeholders 0038 * @param vals values that were formatted to substitutions 0039 * @param ftrans finalized ordinary translation 0040 * @param mods scripting modules to load; the list is cleared after loading 0041 * @param error set to the message detailing the problem, if the script 0042 failed; set to empty otherwise 0043 * @param fallback set to true if the script requested fallback to ordinary 0044 translation; set to false otherwise 0045 * @return resolved interpolation if evaluation succeeded, 0046 * empty string otherwise 0047 */ 0048 virtual QString eval(const QList<QVariant> &argv, 0049 const QString &lang, 0050 const QString &ctry, 0051 const QString &msgctxt, 0052 const QHash<QString, QString> &dynctxt, 0053 const QString &msgid, 0054 const QStringList &subs, 0055 const QList<QVariant> &vals, 0056 const QString &ftrans, 0057 QList<QStringList> &mods, 0058 QString &error, 0059 bool &fallback) = 0; 0060 0061 /** 0062 * Returns the list of calls to execute an all messages after the 0063 * interpolations are done, as evaluations with no parameters. 0064 * 0065 * @param lang language of the translation 0066 * @return list of post calls 0067 */ 0068 virtual QStringList postCalls(const QString &lang) = 0; 0069 0070 /** 0071 * Destructor. 0072 */ 0073 virtual ~KTranscript() 0074 { 0075 } 0076 }; 0077 0078 #ifdef KTRANSCRIPT_TESTBUILD 0079 KTranscript *autotestCreateKTranscriptImp(); 0080 void autotestDestroyKTranscriptImp(); 0081 #endif 0082 0083 #endif