Line |
Branch |
Exec |
Source |
1 |
|
|
/***************************************************************************** |
2 |
|
|
* |
3 |
|
|
* Copyright (C) 2009-2022 Florian Pose <fp@igh.de> |
4 |
|
|
* |
5 |
|
|
* This file is part of the QtPdCom library. |
6 |
|
|
* |
7 |
|
|
* The QtPdCom library is free software: you can redistribute it and/or modify |
8 |
|
|
* it under the terms of the GNU Lesser General Public License as published by |
9 |
|
|
* the Free Software Foundation, either version 3 of the License, or (at your |
10 |
|
|
* option) any later version. |
11 |
|
|
* |
12 |
|
|
* The QtPdCom library is distributed in the hope that it will be useful, but |
13 |
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
14 |
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public |
15 |
|
|
* License for more details. |
16 |
|
|
* |
17 |
|
|
* You should have received a copy of the GNU Lesser General Public License |
18 |
|
|
* along with the QtPdCom Library. If not, see <http://www.gnu.org/licenses/>. |
19 |
|
|
* |
20 |
|
|
****************************************************************************/ |
21 |
|
|
|
22 |
|
|
#include "Translator.h" |
23 |
|
|
|
24 |
|
|
#include <QTranslator> |
25 |
|
|
#include <QCoreApplication> |
26 |
|
|
|
27 |
|
✗ |
static void loadRcc() { |
28 |
|
✗ |
Q_INIT_RESOURCE(QtPdCom_ts); |
29 |
|
|
} |
30 |
|
|
|
31 |
|
|
namespace QtPdCom { |
32 |
|
|
|
33 |
|
|
/****************************************************************************/ |
34 |
|
|
|
35 |
|
|
/** Load a translation. |
36 |
|
|
*/ |
37 |
|
✗ |
bool loadTranslation(QTranslator &translator, const QLocale &locale) |
38 |
|
|
{ |
39 |
|
✗ |
loadRcc(); |
40 |
|
✗ |
const bool ans = translator.load(locale, "QtPdCom", "_", ":/QtPdCom"); |
41 |
|
|
// all widgets are in english per default, so no need to have a ts file |
42 |
|
✗ |
if (locale.language() == QLocale::English) |
43 |
|
✗ |
return true; |
44 |
|
✗ |
return ans; |
45 |
|
|
|
46 |
|
|
} |
47 |
|
|
|
48 |
|
|
/****************************************************************************/ |
49 |
|
|
|
50 |
|
|
} // namespace |
51 |
|
|
|