| 1 |
// Copyright (C) 2016 The Qt Company Ltd. |
| 2 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
// IMPORTANT!!!! If you want to add testdata to this file, |
| 30 |
// always add it to the end in order to not change the linenumbers of translations!!! |
| 31 |
|
| 32 |
package com.trolltech.examples; |
| 33 |
|
| 34 |
public class I18N extends QDialog { |
| 35 |
|
| 36 |
private class MainWindow extends QMainWindow { |
| 37 |
private String foo = tr("pack class class"); |
| 38 |
|
| 39 |
//: extra comment for t-tor |
| 40 |
private String bar = tr("pack class class extra"); |
| 41 |
|
| 42 |
public MainWindow(QWidget parent) { |
| 43 |
super(parent); |
| 44 |
|
| 45 |
listWidget = new QListWidget(); |
| 46 |
listWidget.addItem(tr("pack class class method")); |
| 47 |
|
| 48 |
} |
| 49 |
} |
| 50 |
|
| 51 |
public I18N(QWidget parent) { |
| 52 |
super(parent, new Qt.WindowFlags(Qt.WindowType.WindowStaysOnTopHint)); |
| 53 |
|
| 54 |
tr("pack class method"); |
| 55 |
|
| 56 |
tr("QT_LAYOUT_DIRECTION", |
| 57 |
"Translate this string to the string 'LTR' in left-to-right" + |
| 58 |
" languages or to 'RTL' in right-to-left languages (such as Hebrew" + |
| 59 |
" and Arabic) to get proper widget layout."); |
| 60 |
|
| 61 |
tr("%n files", "plural form", n); |
| 62 |
tr("%n cars", null, n); |
| 63 |
tr("Age: %1"); |
| 64 |
tr("There are %n house(s)", "Plurals and function call", getCount()); |
| 65 |
|
| 66 |
QTranslator trans; |
| 67 |
trans.translate("QTranslator", "Simple"); |
| 68 |
trans.translate("QTranslator", "Simple", null); |
| 69 |
trans.translate("QTranslator", "Simple with comment", "with comment"); |
| 70 |
trans.translate("QTranslator", "Plural without comment", null, 1); |
| 71 |
trans.translate("QTranslator", "Plural with comment", "comment 1", n); |
| 72 |
trans.translate("QTranslator", "Plural with comment", "comment 2", getCount()); |
| 73 |
|
| 74 |
/*: with extra comment! */ |
| 75 |
QCoreApplication.translate("Plurals, QCoreApplication", "%n house(s)", "Plurals and identifier", n); |
| 76 |
|
| 77 |
tr(""); |
| 78 |
|
| 79 |
// FIXME: This will fail. |
| 80 |
//QApplication.tr("QT_LAYOUT_DIRECTION", "scoped to qapp"); |
| 81 |
|
| 82 |
} |
| 83 |
|
| 84 |
} |