fix logic
[personal-kdelibs.git] / kdecore / localization / ktranscript_p.h
blobc367476a6ba20a34363f8241486e4fe24886befc
1 /* This file is part of the KDE libraries
2 Copyright (C) 2007 Chusslove Illich <caslav.ilic@gmx.net>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
20 #ifndef KTRANSCRIPT_P_H
21 #define KTRANSCRIPT_P_H
23 #include <QVariant>
24 #include <QList>
25 #include <QStringList>
26 #include <QHash>
28 /**
29 * @internal
30 * (used by KLocalizedString)
32 * KTranscript provides support for programmable translations.
33 * The class is abstract in order to facilitate dynamic loading.
35 * @author Chusslove Illich <caslav.ilic@gmx.net>
36 * @short class for supporting programmable translations
38 class KTranscript
40 public:
42 /**
43 * Evaluates interpolation.
45 * @param argv list of interpolation tokens
46 * @param lang language of the translation
47 * @param lscr script of the translation
48 * @param msgctxt message context
49 * @param dynctxt dynamic context
50 * @param msgid original message
51 * @param subs substitutions for message placeholders
52 * @param vals values that were formatted to substitutions
53 * @param final finalized ordinary translation
54 * @param mods scripting modules to load; the list is cleared after loading
55 * @param error set to the message detailing the problem, if the script
56 failed; set to empty otherwise
57 * @param fallback set to true if the script requested fallback to ordinary
58 translation; set to false otherwise
59 * @return resolved interpolation if evaluation succeeded,
60 * empty string otherwise
62 virtual QString eval (const QList<QVariant> &argv,
63 const QString &lang,
64 const QString &lscr,
65 const QString &msgctxt,
66 const QHash<QString, QString> &dynctxt,
67 const QString &msgid,
68 const QStringList &subs,
69 const QList<QVariant> &vals,
70 const QString &final,
71 QList<QStringList> &mods,
72 QString &error,
73 bool &fallback) = 0;
75 /**
76 * Returns the list of calls to execute an all messages after the
77 * interpolations are done, as evaluations with no parameters.
79 * @param lang language of the translation
80 * @return list of post calls
82 virtual QStringList postCalls (const QString &lang) = 0;
84 /**
85 * Destructor.
87 virtual ~KTranscript () {}
90 #endif