diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2010-11-08 12:25:30 (GMT) |
---|---|---|
committer | Kent Hansen <kent.hansen@nokia.com> | 2010-11-08 14:46:29 (GMT) |
commit | 27e77b7ceeeffe9227b5b96fdd63e3433e0eb63e (patch) | |
tree | 5f28fc510bd4649a8a86fd1cb9b5a39927369a7f /tests/auto/qscriptengine/translations | |
parent | d48a324d6670b14348d546db6a739ee138dab1e2 (diff) | |
download | Qt-27e77b7ceeeffe9227b5b96fdd63e3433e0eb63e.zip Qt-27e77b7ceeeffe9227b5b96fdd63e3433e0eb63e.tar.gz Qt-27e77b7ceeeffe9227b5b96fdd63e3433e0eb63e.tar.bz2 |
Make qsTr() work with Unicode (non-Latin-1) strings
Converting the source string/context/comment to Latin-1 is very
broken, since JS strings are UTF-16.
The strings should be converted to UTF-8, which should also be
the default encoding for qsTranslate().
Effectively, this bug meant that only Latin-1 characters could
be used in source strings; the translations themselves could
have non-Latin-1 characters. But there was data loss in the
case where you passed a source string for which no translation
was found (since the Latin-1-ized string would be returned).
Task-number: QTBUG-14989
Reviewed-by: Jedrzej Nowacki
Diffstat (limited to 'tests/auto/qscriptengine/translations')
-rw-r--r-- | tests/auto/qscriptengine/translations/idtranslatable-unicode.qm | bin | 0 -> 209 bytes | |||
-rw-r--r-- | tests/auto/qscriptengine/translations/idtranslatable-unicode.ts | 26 | ||||
-rw-r--r-- | tests/auto/qscriptengine/translations/translatable-unicode.qm | bin | 0 -> 322 bytes | |||
-rw-r--r-- | tests/auto/qscriptengine/translations/translatable-unicode.ts | 37 |
4 files changed, 63 insertions, 0 deletions
diff --git a/tests/auto/qscriptengine/translations/idtranslatable-unicode.qm b/tests/auto/qscriptengine/translations/idtranslatable-unicode.qm Binary files differnew file mode 100644 index 0000000..8c5fb91 --- /dev/null +++ b/tests/auto/qscriptengine/translations/idtranslatable-unicode.qm diff --git a/tests/auto/qscriptengine/translations/idtranslatable-unicode.ts b/tests/auto/qscriptengine/translations/idtranslatable-unicode.ts new file mode 100644 index 0000000..74ebf43 --- /dev/null +++ b/tests/auto/qscriptengine/translations/idtranslatable-unicode.ts @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="nb_NO"> +<defaultcodec>UTF-8</defaultcodec> +<context> + <name></name> + <message id="Ǹǒƙǐǡ"> + <location filename="idtranslatable-unicode.js" line="1"/> + <source></source> + <translation>Ƨưƈȼȝȿș</translation> + </message> + <message id="ƑǎȑȩƜƎƚǐ"> + <location filename="idtranslatable-unicode.js" line="3"/> + <source></source> + <translation>Ǡȡȋȅȕ</translation> + </message> + <message id="ƁơȓƏƌ" numerus="yes"> + <location filename="idtranslatable-unicode.js" line="5"/> + <source></source> + <translation> + <numerusform>Ƒưǹ</numerusform> + <numerusform>%n ƒơǒ(ș)</numerusform> + </translation> + </message> +</context> +</TS> diff --git a/tests/auto/qscriptengine/translations/translatable-unicode.qm b/tests/auto/qscriptengine/translations/translatable-unicode.qm Binary files differnew file mode 100644 index 0000000..aa75ce6 --- /dev/null +++ b/tests/auto/qscriptengine/translations/translatable-unicode.qm diff --git a/tests/auto/qscriptengine/translations/translatable-unicode.ts b/tests/auto/qscriptengine/translations/translatable-unicode.ts new file mode 100644 index 0000000..1b8b4d2 --- /dev/null +++ b/tests/auto/qscriptengine/translations/translatable-unicode.ts @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<defaultcodec>UTF-8</defaultcodec> +<context> + <name>translatable-unicode</name> + <message> + <location filename="translatable-unicode.js" line="1"/> + <source>H₂O</source> + <translation>ͻͼͽ</translation> + </message> + <message> + <location filename="translatable-unicode.js" line="5"/> + <source>ΑΒΓ</source> + <translation>ӜҴѼ</translation> + </message> + <message> + <location filename="translatable-unicode.js" line="9"/> + <source>H₂O</source> + <comment>not the same H₂O</comment> + <translation>ԶՊՒ</translation> + </message> +</context> +<context> + <name>Čāğĕ</name> + <message> + <location filename="translatable-unicode.js" line="2"/> + <source>CO₂</source> + <translation>בךע</translation> + </message> + <message> + <location filename="translatable-unicode.js" line="6"/> + <source>ДЕЖ</source> + <translation>خسس</translation> + </message> +</context> +</TS> |