From a86de5d3c06b44feb56d697877d96be114e11f09 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Thu, 23 Aug 2012 11:52:01 +0200 Subject: [PATCH] Revert "Read list of translated languages from a file" This reverts commit ed1515ef69d0381e9b0657cf1966f9d86e0cb25f. --- configure.ac | 6 +----- lib/Makefile.am | 2 -- src/Language.cpp | 36 +++++------------------------------- src/Language.h | 4 ---- 4 files changed, 6 insertions(+), 42 deletions(-) diff --git a/configure.ac b/configure.ac index 71a4b1cf31..acfa66338e 100644 --- a/configure.ac +++ b/configure.ac @@ -180,10 +180,6 @@ m4_defun([AC_GNU_SOURCE],[]) AM_GNU_GETTEXT([no-libtool]) AM_GNU_GETTEXT_VERSION([0.16.1]) AC_LANG_POP(C) -AC_CONFIG_COMMANDS([lib/installed_translation], [ - rm -f lib/installed_translations - echo $CATALOGS | sed 's/\.gmo//g' > lib/installed_translations -]) # some standard header files AC_HEADER_MAJOR @@ -375,7 +371,7 @@ AC_CONFIG_FILES([Makefile \ development/cygwin/lyxrc.dist \ development/lyx.spec \ intl/Makefile \ - lib/lyx.desktop-temp:lib/lyx.desktop.in \ + lib/lyx.desktop-temp:lib/lyx.desktop.in lib/Makefile \ lib/doc/Makefile \ lib/lyx2lyx/lyx2lyx_version.py \ diff --git a/lib/Makefile.am b/lib/Makefile.am index 9068d50162..557818aaf4 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -8,8 +8,6 @@ dist_pkgdata_DATA = CREDITS autocorrect chkconfig.ltx external_templates \ encodings layouttranslations languages latexfonts symbols syntax.default \ unicodesymbols -nodist_pkgdata_DATA = installed_translations - # We use DATA now instead of PYTHON because automake 1.11.2 complains. # Note that we "chmod 755" manually this file in install-data-hook. dist_pkgdata_DATA += configure.py diff --git a/src/Language.cpp b/src/Language.cpp index 95e725f3f3..13e43c2968 100644 --- a/src/Language.cpp +++ b/src/Language.cpp @@ -196,6 +196,10 @@ bool Language::read(Lexer & lex) encoding_ = encodings.fromLyXName("iso8859-1"); LYXERR0("Unknown encoding " << encodingStr_); } + // cache translation status. Calling getMessages() directly in + // PrefLanguage::PrefLanguage() did only work if the gui language + // was set to auto (otherwise all languages would be marked as available). + translated_ = getMessages(code()).available(); return true; } @@ -255,12 +259,8 @@ void Languages::read(FileName const & filename) } // Read layout translations - FileName path = libFileSearch(string(), "layouttranslations"); + FileName const path = libFileSearch(string(), "layouttranslations"); readLayoutTranslations(path); - - // Read installed translations - path = libFileSearch(string(), "installed_translations"); - readInstalledTranslations(path); } @@ -369,32 +369,6 @@ void Languages::readLayoutTranslations(support::FileName const & filename) } -void Languages::readInstalledTranslations(support::FileName const & filename) -{ - Lexer lex; - lex.setFile(filename); - lex.setContext("Languages::read"); - - // 1) read all installed gmo files names - set installed_translations; - string lang_code; - while (lex.isOK()) { - lex >> lang_code; - installed_translations.insert(lang_code); - } - - // 2) mark all corresponding languages as translated. - LanguageList::iterator lit = languagelist.begin(); - LanguageList::iterator const lend = languagelist.end(); - for ( ; lit != lend ; ++lit) { - if (installed_translations.count(lit->second.code()) - || installed_translations.count(token(lit->second.code(), '_', 0))) - lit->second.translated(true); - } - -} - - Language const * Languages::getLanguage(string const & language) const { if (language == "reset") diff --git a/src/Language.h b/src/Language.h index fb1158b33a..71b6777259 100644 --- a/src/Language.h +++ b/src/Language.h @@ -50,8 +50,6 @@ public: bool rightToLeft() const { return rightToLeft_; } /// Is an (at least partial) translation of this language available? bool translated() const { return translated_; } - /// Is an (at least partial) translation of this language available? - void translated(bool trans) { translated_ = trans; } /** * Translate a string from the layout files that appears in the output. * It takes the translations from lib/layouttranslations instead of @@ -149,8 +147,6 @@ public: /// void readLayoutTranslations(support::FileName const & filename); /// - void readInstalledTranslations(support::FileName const & filename); - /// Language const * getLanguage(std::string const & language) const; /// size_type size() const { return languagelist.size(); }