Author: mlandres Date: Wed Oct 22 14:30:33 2008 New Revision: 11446 URL: http://svn.opensuse.org/viewcvs/zypp?rev=11446&view=rev Log: Fallback to default locale in Locale::bestMatch Modified: trunk/libzypp/zypp/Locale.cc trunk/libzypp/zypp/Locale.h Modified: trunk/libzypp/zypp/Locale.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Locale.cc?rev=11446&r1=11445&r2=11446&view=diff ============================================================================== --- trunk/libzypp/zypp/Locale.cc (original) +++ trunk/libzypp/zypp/Locale.cc Wed Oct 22 14:30:33 2008 @@ -13,6 +13,7 @@ #include <map> #include "zypp/Locale.h" +#include "zypp/ZConfig.h" using std::endl; @@ -222,11 +223,15 @@ Locale Locale::fallback() const { return _pimpl->fallback(); } + + /////////////////////////////////////////////////////////////////// + Locale Locale::bestMatch( const LocaleSet & avLocales_r, const Locale & requested_r ) { if ( ! avLocales_r.empty() ) { - for ( Locale check( requested_r ); check != noCode; check = check.fallback() ) + for ( Locale check( requested_r == noCode ? ZConfig::instance().defaultTextLocale() : requested_r ); + check != noCode; check = check.fallback() ) { if ( avLocales_r.find( check ) != avLocales_r.end() ) return check; Modified: trunk/libzypp/zypp/Locale.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Locale.h?rev=11446&r1=11445&r2=11446&view=diff ============================================================================== --- trunk/libzypp/zypp/Locale.h (original) +++ trunk/libzypp/zypp/Locale.h Wed Oct 22 14:30:33 2008 @@ -90,10 +90,13 @@ /** Return the best match for \ref Locale \c requested_r within the available \c avLocales_r. * - * If neither \c requested_r nor any of it's \ref fallback locales are available, - * \ref Locale::noCode is returned. + * If \c requested_r is nor specified or equals \ref Locale::noCode, + * \ref ZConfig::defaultTextLocale is assumed. + * + * If neither \c requested_r nor any of it's \ref fallback locales + * are available, \ref Locale::noCode is returned. */ - static Locale bestMatch( const LocaleSet & avLocales_r, const Locale & requested_r ); + static Locale bestMatch( const LocaleSet & avLocales_r, const Locale & requested_r = Locale() ); private: /** Pointer to implementation */ -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org