[the "translation" patch series] Part 3: improving the loading of localized files

* src/support/filetools.cpp (i18nLibFileSearch): use a trick to find
	out the name of the current translation. 

	* po/*.po: add the entry necessary for the above trick.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_5_X@19349 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2007-08-07 20:36:04 +00:00
parent eee9800ce4
commit 680e9d0b3d
30 changed files with 116 additions and 29 deletions

View File

@ -20793,3 +20793,6 @@ msgstr "
#, fuzzy
#~ msgid "Insets|n"
#~ msgstr "Âìúêíè(I)|I"
msgid "[[Replace with the code of your language]]"
msgstr "bg"

View File

@ -15903,3 +15903,6 @@ msgstr "Usuari desconegut"
#~ msgid "theorem"
#~ msgstr "teorema"
msgid "[[Replace with the code of your language]]"
msgstr "ca"

View File

@ -16105,3 +16105,6 @@ msgstr "Nezn
#, fuzzy
#~ msgid "Insets|n"
#~ msgstr "Vlo¾it|V"
msgid "[[Replace with the code of your language]]"
msgstr "cs"

View File

@ -17118,3 +17118,6 @@ msgstr "Ukendt indstik"
#, fuzzy
#~ msgid "Insets|n"
#~ msgstr "Indsæt|I"
msgid "[[Replace with the code of your language]]"
msgstr "da"

View File

@ -15938,3 +15938,6 @@ msgstr "Unbekannter Benutzer"
#~ msgid "Acknowledgement \\arabic{theorem}"
#~ msgstr "Danksagung \\arabic{theorem}"
msgid "[[Replace with the code of your language]]"
msgstr "de"

View File

@ -16625,3 +16625,6 @@ msgstr "Usuario desconocido"
#, fuzzy
#~ msgid "Insets|n"
#~ msgstr "Insertar|I"
msgid "[[Replace with the code of your language]]"
msgstr "es"

View File

@ -16602,3 +16602,6 @@ msgstr "Erabiltzaile ezezaguna"
#, fuzzy
#~ msgid "Insets|n"
#~ msgstr "Txertatu|T"
msgid "[[Replace with the code of your language]]"
msgstr "eu"

View File

@ -17355,3 +17355,6 @@ msgstr "Tuntematon sana:"
#, fuzzy
#~ msgid "Insets|n"
#~ msgstr "Lisää|L"
msgid "[[Replace with the code of your language]]"
msgstr "fi"

View File

@ -16816,11 +16816,11 @@ msgstr "Utilisateur inconnu"
#~ msgid "#*"
#~ msgstr "#*"
#~ msgid "About %1"
#~ msgstr "À Propos de %1"
msgid "About %1"
msgstr "À Propos de %1"
#~ msgid "Quit %1"
#~ msgstr "Quitter %1"
msgid "Quit %1"
msgstr "Quitter %1"
#~ msgid "PrettyRef: "
#~ msgstr "PrettyRef : "
@ -16839,3 +16839,6 @@ msgstr "Utilisateur inconnu"
#, fuzzy
#~ msgid "Insets|n"
#~ msgstr "Insérer|I"
msgid "[[Replace with the code of your language]]"
msgstr "fr"

View File

@ -15805,3 +15805,6 @@ msgstr "Usu
#~ msgid "Acknowledgement \\arabic{theorem}"
#~ msgstr "Agradecimento \\arabic{theorem}"
msgid "[[Replace with the code of your language]]"
msgstr "gl"

View File

@ -16106,3 +16106,6 @@ msgstr "%s: שורה %d: משתמש לא מוכר %s\n"
#, fuzzy
#~ msgid "Opened Theorem Inset"
#~ msgstr "ערכת הכלים הנוספת של Andrew"
msgid "[[Replace with the code of your language]]"
msgstr "he"

View File

@ -16139,3 +16139,6 @@ msgstr "Ismeretlen felhaszn
#~ msgid "Insets|n"
#~ msgstr "Betétek|k"
msgid "[[Replace with the code of your language]]"
msgstr "hu"

View File

@ -16688,3 +16688,6 @@ msgstr "Utente sconosciuto"
#, fuzzy
#~ msgid "Insets|n"
#~ msgstr "Inserisci|I"
msgid "[[Replace with the code of your language]]"
msgstr "it"

View File

@ -15775,3 +15775,6 @@ msgstr ""
#: src/support/userinfo.cpp:44
msgid "Unknown user"
msgstr "未知のユーザー"
msgid "[[Replace with the code of your language]]"
msgstr "ja"

View File

@ -15798,3 +15798,6 @@ msgstr "
#, fuzzy
#~ msgid "special char"
#~ msgstr "특수 문자|S"
msgid "[[Replace with the code of your language]]"
msgstr "ko"

View File

@ -15716,3 +15716,6 @@ msgstr "Ukjent bruker"
#~ msgid "Toc"
#~ msgstr "Innhold"
msgid "[[Replace with the code of your language]]"
msgstr "nb"

View File

@ -17492,3 +17492,6 @@ msgstr "Onbekend:"
#, fuzzy
#~ msgid "Insets|n"
#~ msgstr "Invoegen|I"
msgid "[[Replace with the code of your language]]"
msgstr "nl"

View File

@ -15863,3 +15863,6 @@ msgstr "ukjend brukar"
#~ msgid "primitive"
#~ msgstr "primetiv"
msgid "[[Replace with the code of your language]]"
msgstr "nn"

View File

@ -16618,3 +16618,6 @@ msgstr "Nieznany u
#, fuzzy
#~ msgid "Insets|n"
#~ msgstr "Wstaw|W"
msgid "[[Replace with the code of your language]]"
msgstr "pl"

View File

@ -17851,3 +17851,6 @@ msgstr "A
#, fuzzy
#~ msgid "Insets|n"
#~ msgstr "Inserir"
msgid "[[Replace with the code of your language]]"
msgstr "pt"

View File

@ -16774,3 +16774,6 @@ msgstr "Cuv
#, fuzzy
#~ msgid "Insets|n"
#~ msgstr "Inserare|I"
msgid "[[Replace with the code of your language]]"
msgstr "ro"

View File

@ -17302,3 +17302,6 @@ msgstr "
#, fuzzy
#~ msgid "Insets|n"
#~ msgstr "÷ÓÔÁ×ÉÔØ|÷"
msgid "[[Replace with the code of your language]]"
msgstr "ru"

View File

@ -16964,3 +16964,6 @@ msgstr "Nezn
#, fuzzy
#~ msgid "Insets|n"
#~ msgstr "Vlo¾i»|I"
msgid "[[Replace with the code of your language]]"
msgstr "sk"

View File

@ -17330,3 +17330,6 @@ msgstr "Neznana beseda:"
#, fuzzy
#~ msgid "Insets|n"
#~ msgstr "Vstavi|V"
msgid "[[Replace with the code of your language]]"
msgstr "sl"

View File

@ -17788,3 +17788,6 @@ msgstr "Ok
#, fuzzy
#~ msgid "Insets|n"
#~ msgstr "Lägg in"
msgid "[[Replace with the code of your language]]"
msgstr "sv"

View File

@ -16440,3 +16440,6 @@ msgstr "Bilinmeyen kullan
#, fuzzy
#~ msgid "Insets|n"
#~ msgstr "Ekle|E"
msgid "[[Replace with the code of your language]]"
msgstr "tr"

View File

@ -17774,3 +17774,6 @@ msgstr "Bouye n
#, fuzzy
#~ msgid "Insets|n"
#~ msgstr "Sititchî"
msgid "[[Replace with the code of your language]]"
msgstr "wa"

View File

@ -15803,3 +15803,6 @@ msgstr "未知用户"
#~ msgid "Adapt outp&ut"
#~ msgstr "Adapt outp&ut"
msgid "[[Replace with the code of your language]]"
msgstr "zh_CN"

View File

@ -17171,3 +17171,6 @@ msgstr "不明的使用者"
#, fuzzy
#~ msgid "Opened Theorem Inset"
#~ msgstr "開啟的 Theorem 內插"
msgid "[[Replace with the code of your language]]"
msgstr "zh_TW"

View File

@ -302,44 +302,44 @@ FileName const libFileSearch(string const & dir, string const & name,
FileName const i18nLibFileSearch(string const & dir, string const & name,
string const & ext)
{
// the following comments are from intl/dcigettext.c. We try
// to mimick this behaviour here.
/* The highest priority value is the `LANGUAGE' environment
variable. But we don't use the value if the currently
selected locale is the C locale. This is a GNU extension. */
/* [Otherwise] We have to proceed with the POSIX methods of
looking to `LC_ALL', `LC_xxx', and `LANG'. */
selected locale is the C locale. This is a GNU extension.
string lang = getEnv("LC_ALL");
if (lang.empty()) {
lang = getEnv("LC_MESSAGES");
if (lang.empty()) {
lang = getEnv("LANG");
if (lang.empty())
lang = "C";
}
}
Otherwise, we use a trick to guess what gettext has done:
each po file is able to tell us its name. (JMarc)
*/
string lang = to_ascii(_("[[Replace with the code of your language]]"));
string const language = getEnv("LANGUAGE");
if (lang != "C" && lang != "POSIX" && !language.empty())
if (!lang.empty() && !language.empty())
lang = language;
string l;
lang = split(lang, l, ':');
while (!l.empty() && l != "C" && l != "POSIX") {
FileName const tmp = libFileSearch(addPath(dir, token(l, '_', 0)),
name, ext);
while (!l.empty()) {
FileName tmp;
// First try with the full name
tmp = libFileSearch(addPath(dir, l), name, ext);
if (!tmp.empty())
return tmp;
// Then the name without country code
string const shortl = token(l, '_', 0);
if (shortl != l) {
tmp = libFileSearch(addPath(dir, shortl), name, ext);
if (!tmp.empty())
return tmp;
}
#if 1
// to be removed later (JMarc)
FileName const tmpold = libFileSearch(dir,
token(l, '_', 0) + '_' + name,
ext);
if (!tmpold.empty()) {
lyxerr << "i18nLibFileSearch: File `" << tmpold
// For compatibility, to be removed later (JMarc)
tmp = libFileSearch(dir, token(l, '_', 0) + '_' + name,
ext);
if (!tmp.empty()) {
lyxerr << "i18nLibFileSearch: File `" << tmp
<< "' has been found by the old method" <<endl;
return tmpold;
return tmp;
}
#endif
lang = split(lang, l, ':');