2
* This file is part of unity-2d
4
* Copyright 2011 Canonical Ltd.
7
* - Aurélien Gâteau <aurelien.gateau@canonical.com>
9
* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; version 3.
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program. If not, see <http://www.gnu.org/licenses/>.
21
#ifndef GETTEXTTRANSLATOR_H
22
#define GETTEXTTRANSLATOR_H
27
#include <QTranslator>
29
struct GettextTranslatorPrivate;
31
* A QTranslator which uses gettext
33
class GettextTranslator : public QTranslator
37
GettextTranslator(QObject* parent = 0);
41
* Reimplemented. Note that context is ignored.
43
QString translate(const char* context, const char* sourceText, const char* disambiguation=0) const;
46
* Initialize the translator.
47
* Translations are then loaded from:
48
* $directory/$lang/locale/LC_MESSAGES/$domainName.mo
50
bool init(const QString& domainName, const QString& directory);
53
Q_DISABLE_COPY(GettextTranslator)
54
GettextTranslatorPrivate* const d;
56
// Hide "load" methods because they are used to load .qm
57
bool load(const QString& filename, const QString& directory = QString(), const QString& search_delimiters = QString(), const QString& suffix = QString());
58
bool load(const uchar* data, int len);
61
#endif /* GETTEXTTRANSLATOR_H */