| 1 |
/* |
| 2 |
* SPDX-FileCopyrightText: 2017~2017 CSSlayer <[email protected]> |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: LGPL-2.1-or-later |
| 5 |
* |
| 6 |
*/ |
| 7 |
#ifndef _WIDGETSADDONS_FCITXQTI18NHELPER_H_ |
| 8 |
#define _WIDGETSADDONS_FCITXQTI18NHELPER_H_ |
| 9 |
|
| 10 |
#include <QString> |
| 11 |
#include <fcitx-utils/i18n.h> |
| 12 |
|
| 13 |
namespace fcitx { |
| 14 |
|
| 15 |
inline QString tr2fcitx(const char *message, const char *comment = nullptr) { |
| 16 |
if (comment && comment[0] && message && message[0]) { |
| 17 |
return QString(C_(comment, message)); |
| 18 |
} else if (message && message[0]) { |
| 19 |
return QString(_(message)); |
| 20 |
} else { |
| 21 |
return QString(); |
| 22 |
} |
| 23 |
} |
| 24 |
} // namespace fcitx |
| 25 |
|
| 26 |
#endif // _WIDGETSADDONS_FCITXQTI18NHELPER_H_ |