Commit 4686d2f6 authored by Leena Miettinen's avatar Leena Miettinen Committed by The Qt Project
Browse files

Doc: describe translation sources in Developer topic


Move information from the Release Manager topic and
add information about QML sources in the Qt Linguist Manual.

Change-Id: I0d2a2ea68a2e7e94895b41436d9f973d8c2cb2aa
Reviewed-by: default avatarLeena Miettinen <riitta-leena.miettinen@digia.com>
parent edb4f6fa
dev 5.10 5.11 5.12 5.12.1 5.12.10 5.12.11 5.12.12 5.12.2 5.12.3 5.12.4 5.12.5 5.12.6 5.12.7 5.12.8 5.12.9 5.13 5.13.0 5.13.1 5.13.2 5.14 5.14.0 5.14.1 5.14.2 5.15 5.15.0 5.15.1 5.15.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 5.9.8 6.0 6.0.0 6.1 6.1.0 6.1.1 6.1.2 6.1.3 6.2 6.2.0 6.2.1 6.2.2 old/5.1 old/5.2 wip/cmake v5.15.0-alpha1 v5.14.1 v5.14.0 v5.14.0-rc2 v5.14.0-rc1 v5.14.0-beta3 v5.14.0-beta2 v5.14.0-beta1 v5.14.0-alpha1 v5.13.2 v5.13.1 v5.13.0 v5.13.0-rc3 v5.13.0-rc2 v5.13.0-rc1 v5.13.0-beta4 v5.13.0-beta3 v5.13.0-beta2 v5.13.0-beta1 v5.13.0-alpha1 v5.12.7 v5.12.6 v5.12.5 v5.12.4 v5.12.3 v5.12.2 v5.12.1 v5.12.0 v5.12.0-rc2 v5.12.0-rc1 v5.12.0-beta4 v5.12.0-beta3 v5.12.0-beta2 v5.12.0-beta1 v5.12.0-alpha1 v5.11.3 v5.11.2 v5.11.1 v5.11.0 v5.11.0-rc2 v5.11.0-rc1 v5.11.0-beta4 v5.11.0-beta3 v5.11.0-beta2 v5.11.0-beta1 v5.11.0-alpha1 v5.10.1 v5.10.0 v5.10.0-rc3 v5.10.0-rc2 v5.10.0-rc1 v5.10.0-beta4 v5.10.0-beta3 v5.10.0-beta2 v5.10.0-beta1 v5.10.0-alpha1 v5.9.9 v5.9.8 v5.9.7 v5.9.6 v5.9.5 v5.9.4 v5.9.3 v5.9.2 v5.9.1 v5.9.0 v5.9.0-rc2 v5.9.0-rc1 v5.9.0-beta4 v5.9.0-beta3 v5.9.0-beta2 v5.9.0-beta1 v5.9.0-alpha1 v5.8.0 v5.8.0-rc1 v5.8.0-beta1 v5.8.0-alpha1 v5.7.1 v5.7.0 v5.7.0-rc1 v5.7.0-beta1 v5.7.0-alpha1 v5.6.3 v5.6.2 v5.6.1 v5.6.1-1 v5.6.0 v5.6.0-rc1 v5.6.0-beta1 v5.6.0-alpha1 v5.5.1 v5.5.0 v5.5.0-rc1 v5.5.0-beta1 v5.5.0-alpha1 v5.4.2 v5.4.1 v5.4.0 v5.4.0-rc1 v5.4.0-beta1 v5.4.0-alpha1 v5.3.2 v5.3.1 v5.3.0 v5.3.0-rc1 v5.3.0-beta1 v5.3.0-alpha1 v5.2.1 v5.2.0 v5.2.0-rc1 v5.2.0-beta1 v5.2.0-alpha1 v5.1.1 v5.1.0 v5.1.0-rc2 v5.1.0-rc1 v5.1.0-beta1
No related merge requests found
Showing with 74 additions and 34 deletions
......@@ -181,39 +181,6 @@
For lupdate to work successfully, it must know which translation files to
produce. The files are listed in the application's \c .pro Qt project file.
\section1 Qt Project Files
The easiest method to use lupdate and lrelease is by specifying
a \c .pro Qt project file. There must be an entry in the \c TRANSLATIONS
section of the project file for each language that is additional to
the native language. A typical entry looks like this:
\snippet arrowpad/arrowpad.pro 1
Using a locale within the translation file name is useful for
determining which language to load at runtime. This is explained
in the \l{linguist-programmers.html} {Developers} chapter.
An example of a complete \c .pro file with four translation source
files:
\snippet doc_src_linguist-manual.pro 0
If your compiler uses a different encoding for its runtime
system than for its source code and you want to use non-ASCII
characters in string literals, you will need to set the \c
CODECFORSRC. For example:
\snippet doc_src_linguist-manual.pro 2
Microsoft Visual Studio 2005 .NET appears to be the only compiler
for which this is necessary. However, if you want to write
portable code, we recommend that you avoid non-ASCII characters
in your source files. You can still specify non-ASCII characters
portably using escape sequences, for example:
\snippet doc_src_linguist-manual.cpp 3
\section1 Using lupdate
Usage: \c {lupdate myproject.pro}
......@@ -223,7 +190,10 @@
interface files, and produces or updates \c .ts translation
files. The files to process and the files to update can be set at
the command line, or provided in a \c .pro file specified as an
command line argument. The produced translation files are given to
command line argument. The developer creates the .pro file, as
described in \l{Qt Linguist Manual: Developers}.
The produced translation files are given to
the translator who uses \QL to read the files and insert the
translations.
......@@ -867,6 +837,76 @@
with Qt, but requires a certain amount of developer intervention and
will of course incur some runtime performance cost.
\section1 Specifying Translation Sources in Qt Project Files
To enable release managers to use lupdate and lrelease, specify
a \c .pro Qt project file. There must be an entry in the \c TRANSLATIONS
section of the project file for each language that is additional to
the native language. A typical entry looks like this:
\snippet arrowpad/arrowpad.pro 1
Using a locale within the translation file name is useful for
determining which language to load at runtime. For more information, see
QLocale.
The \c lupdate tool extracts user interface strings from your application.
It reads the application .pro file to identify which source files
contain text to be translated. This means your source files must be listed
in the \c SOURCES or \c HEADERS entry in the .pro file. If your files are
not listed, the text in them will not be found.
An example of a complete \c .pro file with four translation source
files:
\snippet doc_src_linguist-manual.pro 0
If your compiler uses a different encoding for its runtime
system than for its source code and you want to use non-ASCII
characters in string literals, you will need to set the \c
CODECFORSRC. For example:
\snippet doc_src_linguist-manual.pro 2
Microsoft Visual Studio 2005 .NET appears to be the only compiler
for which this is necessary. However, if you want to write
portable code, we recommend that you avoid non-ASCII characters
in your source files. You can still specify non-ASCII characters
portably using escape sequences, for example:
\snippet doc_src_linguist-manual.cpp 3
\section2 Use a Conditional to Hide QML Source From the Compiler
The SOURCES variable is intended for C++ source files. If you list QML
or JavaScript source files there, the compiler tries to build them as though
they are C++ files. As a workaround, you can use an \c lupdate_only{...}
conditional statement so the \c lupdate tool sees the .qml files but the C++
compiler ignores them.
For example, the following .pro file snippet specifies two .qml files in
the application:
\code
lupdate_only {
SOURCES = main.qml \
MainPage.qml
}
\endcode
You can also specify the .qml source files with a wildcard match. The
search is not recursive so you need to specify each directory where there
are user interface strings in the source code:
\code
lupdate_only {
SOURCES = *.qml \
*.js \
content/*.qml \
content/*.js
}
\endcode
\section1 Internationalizing Applications
Design your application so that it can be adapted to various languages and
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment