Always evaluate locale fallbacks when retrieving translated strings.
authorMichael Andres <ma@suse.de>
Thu, 11 Mar 2010 20:16:11 +0000 (21:16 +0100)
committerMichael Andres <ma@suse.de>
Thu, 11 Mar 2010 20:55:52 +0000 (21:55 +0100)
zypp/sat/Solvable.cc
zypp/sat/Solvable.h

index 453875f..5fa8e23 100644 (file)
@@ -176,7 +176,11 @@ namespace zypp
       }
       else
       {
-        s = ::solvable_lookup_str_lang( _solvable, attr.id(), lang_r.code().c_str() );
+       for ( Locale l( lang_r ); l != Locale::noCode; l = l.fallback() )
+         if ( (s = ::solvable_lookup_str_lang( _solvable, attr.id(), l.code().c_str(), 0 )) )
+           return s;
+         // here: no matching locale, so use default
+         s = ::solvable_lookup_str_lang( _solvable, attr.id(), 0, 0 );
       }
       return s ? s : std::string();
    }
index 85f55a7..e56d99e 100644 (file)
@@ -100,7 +100,7 @@ namespace zypp
         std::string lookupStrAttribute( const SolvAttr & attr ) const;
         /** \overload Trying to look up a translated string attribute.
          *
-         * Returns the translation for \c lang_r (\b no fallback locales).
+         * Returns the translation for \c lang_r.
          *
          * Passing an empty \ref Locale will return the string for the
          * current default locale (\see \ref ZConfig::TextLocale),