mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +00:00
enable translation of ambigous messages
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9097 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
4e2940c3d8
commit
e416d1aea7
@ -1,3 +1,8 @@
|
||||
2004-10-18 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* Customization.lyx: add description of translation of ambigous
|
||||
messages
|
||||
|
||||
2004-10-17 José Matos <jamatos@lyx.org>
|
||||
|
||||
* Depend.pl: removed.
|
||||
|
@ -2814,6 +2814,78 @@ README
|
||||
LYX-SOURCE-DIR/po/
|
||||
\family default
|
||||
directory for more instructions.
|
||||
\layout Subsubsection
|
||||
|
||||
Ambigous messages
|
||||
\layout Standard
|
||||
|
||||
Sometimes it turns out that one english message needs to be translated into
|
||||
different messages in the target language.
|
||||
One example is the message
|
||||
\family typewriter
|
||||
To
|
||||
\family default
|
||||
which has the german translation
|
||||
\family typewriter
|
||||
\lang german
|
||||
Nach
|
||||
\family default
|
||||
\lang english
|
||||
or
|
||||
\family typewriter
|
||||
\lang german
|
||||
Bis
|
||||
\family default
|
||||
\lang english
|
||||
.
|
||||
|
||||
\family typewriter
|
||||
gettext
|
||||
\family default
|
||||
does not handle such ambigous translations.
|
||||
Therefore you have to add some context information to the message: Instead
|
||||
of
|
||||
\family typewriter
|
||||
To
|
||||
\family default
|
||||
it becomes
|
||||
\family typewriter
|
||||
To[[as in 'From format x to format y']]
|
||||
\family default
|
||||
and
|
||||
\family typewriter
|
||||
To[[as in 'From page x to page y']].
|
||||
|
||||
\family default
|
||||
Now the two occurences of
|
||||
\family typewriter
|
||||
To
|
||||
\family default
|
||||
are different for
|
||||
\family typewriter
|
||||
gettext
|
||||
\family default
|
||||
and can be translated correctly to
|
||||
\family typewriter
|
||||
\lang german
|
||||
Nach
|
||||
\family default
|
||||
\lang english
|
||||
and
|
||||
\family typewriter
|
||||
\lang german
|
||||
Bis
|
||||
\family default
|
||||
\lang english
|
||||
, respectively.
|
||||
\layout Standard
|
||||
|
||||
Of course the context information needs to be stripped off the original
|
||||
message when no translation is used.
|
||||
Therefore you have to put it in double square brackets at the end of the
|
||||
message (see the example above).
|
||||
The translation mechanism of LyX ensures that everything in double square
|
||||
brackets at the end of messages is removed before displaying the message.
|
||||
\layout Subsection
|
||||
|
||||
Translating the documentation.
|
||||
@ -2839,7 +2911,7 @@ As of February 2003, almost all of the docs have been translated into German
|
||||
\emph on
|
||||
Tutorial
|
||||
\emph default
|
||||
has been translated into at least 12 ther languages, with other translations
|
||||
has been translated into at least 12 other languages, with other translations
|
||||
in progress.
|
||||
The library of translated documents is growing rapidly.
|
||||
\end_inset
|
||||
|
@ -1,3 +1,7 @@
|
||||
2004-10-18 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* de.po: update strings with context information
|
||||
|
||||
2004-10-05 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* ru.po: fix crash when autosaving reported by Nikita V.
|
||||
|
13
po/de.po
13
po/de.po
@ -1538,8 +1538,7 @@ msgid "From:|#F"
|
||||
msgstr "Von:|#V"
|
||||
|
||||
#: src/frontends/xforms/forms/form_preferences.fd:1960
|
||||
#: src/frontends/xforms/forms/form_print.fd:188
|
||||
msgid "To:|#T"
|
||||
msgid "To:|#T[[as in 'From format x to format y']]"
|
||||
msgstr "Nach:|#N"
|
||||
|
||||
#: src/frontends/xforms/forms/form_preferences.fd:1978
|
||||
@ -1726,6 +1725,10 @@ msgstr "Kopien"
|
||||
msgid "Sorted|#S"
|
||||
msgstr "Sortiert|#S"
|
||||
|
||||
#: src/frontends/xforms/forms/form_print.fd:188
|
||||
msgid "To:|#T[[as in 'From page x to page y']]"
|
||||
msgstr "Bis:|#B"
|
||||
|
||||
#: src/frontends/xforms/forms/form_print.fd:224
|
||||
msgid "Reverse order|#R"
|
||||
msgstr "Umgekehrte Reihenfolge|#R"
|
||||
@ -3998,7 +4001,7 @@ msgid "C&onverter:"
|
||||
msgstr "&Konverter:"
|
||||
|
||||
#: src/frontends/qt2/ui/QPrefConvertersModule.ui:220
|
||||
msgid "&To:"
|
||||
msgid "&To:[[as in 'From format x to format y']]"
|
||||
msgstr "&Nach:"
|
||||
|
||||
#: src/frontends/qt2/ui/QPrefConvertersModule.ui:235
|
||||
@ -4516,8 +4519,8 @@ msgid "Page number to print from"
|
||||
msgstr "Drucke ab Seite Nr."
|
||||
|
||||
#: src/frontends/qt2/ui/QPrintDialogBase.ui:112
|
||||
msgid "&to"
|
||||
msgstr "&bis"
|
||||
msgid "&To:[[as in 'From page x to page y']]"
|
||||
msgstr "&Bis:"
|
||||
|
||||
#: src/frontends/qt2/ui/QPrintDialogBase.ui:131
|
||||
msgid "Page number to print to"
|
||||
|
@ -1,3 +1,7 @@
|
||||
2004-10-18 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* messages.C (Pimpl): strip off translation context information
|
||||
|
||||
2004-10-14 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* BufferView_pimpl.C (setBuffer): when closing a buffer, make sure
|
||||
|
@ -1,3 +1,8 @@
|
||||
2004-10-18 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* ui/QPrefConvertersModule.ui: Add translation context to "To:"
|
||||
* ui/QPrintDialogBase.ui: ditto
|
||||
|
||||
2004-10-11 Andreas Vox <vox@isp.uni-luebeck.de>
|
||||
|
||||
* qfont_loader.C (initFontPath, addToFontPath): two new static
|
||||
|
@ -217,7 +217,7 @@
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>&To:</string>
|
||||
<string>&To:[[as in 'From format x to format y']]</string>
|
||||
</property>
|
||||
<property>
|
||||
<name>buddy</name>
|
||||
|
@ -109,7 +109,7 @@
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>&to</string>
|
||||
<string>&To:[[as in 'From page x to page y']]</string>
|
||||
</property>
|
||||
<property>
|
||||
<name>buddy</name>
|
||||
|
@ -1,3 +1,8 @@
|
||||
2004-10-18 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* forms/form_preferences.fd: Add translation context to "To:"
|
||||
* forms/form_print.fd: ditto
|
||||
|
||||
2004-10-05 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* FormPreferences.C: add code to input/output the indexing command.
|
||||
|
@ -1957,7 +1957,7 @@ alignment: FL_ALIGN_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: To:|#T
|
||||
label: To:|#T[[as in 'From format x to format y']]
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
|
@ -185,7 +185,7 @@ alignment: FL_ALIGN_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: To:|#T
|
||||
label: To:|#T[[as in 'From page x to page y']]
|
||||
shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
|
@ -13,6 +13,8 @@
|
||||
#include "support/filetools.h"
|
||||
#include "support/path_defines.h"
|
||||
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
using lyx::support::GetEnvPath;
|
||||
using lyx::support::lyx_localedir;
|
||||
|
||||
@ -98,11 +100,24 @@ public:
|
||||
bindtextdomain(PACKAGE, lyx_localedir().c_str());
|
||||
textdomain(PACKAGE);
|
||||
const char* msg = gettext(m.c_str());
|
||||
setlocale(LC_ALL, old);
|
||||
free(old);
|
||||
// Some english words have different translations, depending
|
||||
// on context. In these cases the original string is
|
||||
// augmented by context information (e.g.
|
||||
// "To:[[as in 'From page x to page y']]" and
|
||||
// "To:[[as in 'From format x to format y']]".
|
||||
// This means that we need to filter out everything in
|
||||
// double square brackets at the end of the string,
|
||||
// otherwise the user sees bogus messages.
|
||||
// If we are unable to honour the request we just
|
||||
// return what we got in.
|
||||
return (!n ? m : string(msg));
|
||||
string translated(n ? msg : m);
|
||||
static boost::regex const reg("^([^\\[]*)\\[\\[[^\\]]*\\]\\]$");
|
||||
boost::smatch sub;
|
||||
if (regex_match(translated, sub, reg))
|
||||
translated = sub.str(1);
|
||||
setlocale(LC_ALL, old);
|
||||
free(old);
|
||||
return translated;
|
||||
}
|
||||
private:
|
||||
///
|
||||
|
@ -17,9 +17,9 @@
|
||||
///
|
||||
class Messages {
|
||||
public:
|
||||
///
|
||||
/// messages in the language defined by the environment
|
||||
Messages();
|
||||
///
|
||||
/// messages in the language \p l
|
||||
Messages(std::string const & l);
|
||||
///
|
||||
~Messages();
|
||||
|
Loading…
Reference in New Issue
Block a user