| 1 |
import QtQuick 1.0 |
| 2 |
|
| 3 |
QtObject { |
| 4 |
function translate() { |
| 5 |
qsTr("One"); |
| 6 |
qsTranslate("FooContext", "Two"); |
| 7 |
|
| 8 |
var greeting_strings = [ |
| 9 |
QT_TR_NOOP("Hello"), |
| 10 |
QT_TRANSLATE_NOOP("FooContext", "Goodbye") |
| 11 |
]; |
| 12 |
|
| 13 |
qsTr("One", "not the same one"); |
| 14 |
|
| 15 |
//: My first comment. |
| 16 |
qsTr("See comment"); |
| 17 |
|
| 18 |
//: My second comment. |
| 19 |
qsTranslate("BarContext", "See other comment"); |
| 20 |
|
| 21 |
//: My third comment |
| 22 |
//: spans two lines. |
| 23 |
qsTr("The comment explains it all"); |
| 24 |
|
| 25 |
//: My fourth comment |
| 26 |
//: spans a whopping |
| 27 |
//: three lines. |
| 28 |
qsTranslate("BazContext", "It should be clear by now"); |
| 29 |
|
| 30 |
/*: C-style comment. */ |
| 31 |
qsTr("I love C++"); |
| 32 |
|
| 33 |
/*: Another C-style comment. */ |
| 34 |
qsTranslate("FooContext", "I really love C++"); |
| 35 |
|
| 36 |
/*: C-style comment, followed by */ |
| 37 |
/*: another one. */ |
| 38 |
qsTr("Qt is the best"); |
| 39 |
|
| 40 |
/*: Another C-style comment, followed by */ |
| 41 |
/*: yet another one. */ |
| 42 |
qsTranslate("BarContext", "Qt is the very best"); |
| 43 |
|
| 44 |
// This comment doesn't have any effect. |
| 45 |
qsTr("The comment had no effect"); |
| 46 |
|
| 47 |
// This comment doesn't have any effect either. |
| 48 |
qsTranslate("BazContext", "The comment had no effect, really"); |
| 49 |
|
| 50 |
/* This C-style comment doesn't have any effect. */ |
| 51 |
qsTr("No comment to your comment"); |
| 52 |
|
| 53 |
/* This C-style comment doesn't have any effect either. */ |
| 54 |
qsTranslate("FooContext", "I refuse to comment on that"); |
| 55 |
|
| 56 |
//= id_foo |
| 57 |
qsTr("This string has an identifier"); |
| 58 |
|
| 59 |
//= id_bar |
| 60 |
qsTranslate("BarContext", "This string also has an identifier"); |
| 61 |
|
| 62 |
//~ loc-blank False |
| 63 |
qsTr("This string has meta-data"); |
| 64 |
|
| 65 |
//~ loc-layout_id foo_dialog |
| 66 |
qsTranslate("BazContext", "This string also has meta-data"); |
| 67 |
|
| 68 |
// This comment is to be ignored. |
| 69 |
//: This is a comment for the translator. |
| 70 |
//= id_baz |
| 71 |
//~ foo 123 |
| 72 |
//~ magic-stuff This means something special. |
| 73 |
qsTr("This string has a lot of information"); |
| 74 |
|
| 75 |
// This comment is also to be ignored. |
| 76 |
//: This is another comment for the translator. |
| 77 |
//= id_babar |
| 78 |
//~ foo-bar Important stuff |
| 79 |
//~ needle-in-haystack Found |
| 80 |
//~ overflow True |
| 81 |
qsTranslate("FooContext", "This string has even more information"); |
| 82 |
|
| 83 |
qsTr("This string has disambiguation", "Disambiguation"); |
| 84 |
|
| 85 |
qsTranslate("BarContext", "This string also has disambiguation", "Another disambiguation"); |
| 86 |
|
| 87 |
qsTr("This string contains plurals", "", 10); |
| 88 |
|
| 89 |
qsTrId("qtn_foo_bar"); |
| 90 |
|
| 91 |
var more_greeting_strings = [ QT_TRID_NOOP("qtn_needle"), QT_TRID_NOOP("qtn_haystack") ]; |
| 92 |
|
| 93 |
//: qsTrId() with comment, meta-data and plurals. |
| 94 |
//~ well-tested True |
| 95 |
qsTrId("qtn_bar_baz", 10); |
| 96 |
|
| 97 |
//% "Source text" |
| 98 |
qsTrId("qtn_baz_biz"); |
| 99 |
|
| 100 |
//~ quoted " string with spaces " |
| 101 |
qsTr("translation with extras-quoted field"); |
| 102 |
|
| 103 |
// template literals are supported |
| 104 |
qsTr(`template literal`); |
| 105 |
qsTranslate("TemplateLiteral", 'template literal 2'); |
| 106 |
|
| 107 |
// empty texts are supported |
| 108 |
qsTr(""); |
| 109 |
|
| 110 |
//= id1 |
| 111 |
//@ label1 |
| 112 |
qsTr("msg with id1"); |
| 113 |
|
| 114 |
//@ label2 |
| 115 |
qsTr("invalid usage of label because of missing id"); |
| 116 |
|
| 117 |
//@ label3 |
| 118 |
//% "propagating label" |
| 119 |
qsTrId("id2"); |
| 120 |
|
| 121 |
qsTrId("id2"); |
| 122 |
|
| 123 |
//% "invalid usage of label, contradicting labels for id" |
| 124 |
//@ label4 |
| 125 |
qsTrId("id4"); |
| 126 |
//@ label5 |
| 127 |
qsTrId("id4"); |
| 128 |
|
| 129 |
//@ label6 |
| 130 |
} |
| 131 |
} |