~phablet-team/ubuntu-settings-components/printer-components

« back to all changes in this revision

Viewing changes to plugins/Ubuntu/Settings/Printers/i18n.cpp

* Add support for translations in the printer components

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2014, 2017 Canonical, Ltd.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU Lesser General Public License as published by
 
6
 * the Free Software Foundation; version 3.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU Lesser General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Lesser General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Authored by: Ken VanDine <ken.vandine@canonical.com>
 
17
 *              Andrew Hayzen <andrew.hayzen@canonical.com>
 
18
 */
 
19
 
 
20
#define NO_TR_OVERRIDE
 
21
#include "i18n.h"
 
22
 
 
23
#include <libintl.h>
 
24
 
 
25
const char *thisDomain = "";
 
26
 
 
27
void initTr(const char *domain, const char *localeDir)
 
28
{
 
29
    // Don't bind the domain or set textdomain as it changes the Apps domain
 
30
    // as well. Instead store the domain and use it in the lookups
 
31
//    bindtextdomain(domain, localeDir);
 
32
//    textdomain(domain);
 
33
    Q_UNUSED(localeDir);
 
34
 
 
35
    thisDomain = domain;
 
36
}
 
37
 
 
38
QString __(const char *text, const char *domain)
 
39
{
 
40
    Q_UNUSED(domain);
 
41
 
 
42
    // Use the stored domain
 
43
    return QString::fromUtf8(dgettext(thisDomain, text));
 
44
}