From fa98e04de2b70184533b2e1212ddbc166d19061a Mon Sep 17 00:00:00 2001 From: Klaus Kaempf Date: Tue, 28 Feb 2006 14:24:05 +0000 Subject: [PATCH] implement lang_country -> lang fallback for requested locales --- zypp/zypp_detail/ZYppImpl.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/zypp/zypp_detail/ZYppImpl.cc b/zypp/zypp_detail/ZYppImpl.cc index 8508648..b20d8a2 100644 --- a/zypp/zypp_detail/ZYppImpl.cc +++ b/zypp/zypp_detail/ZYppImpl.cc @@ -195,6 +195,9 @@ namespace zypp bool changed = false; for (LocaleSet::const_iterator it = locales_r.begin(); it != locales_r.end(); ++it) { changed = possible.insert( *it ).second; + if ( (it->code() != it->language().code()) ) { + changed = possible.insert( Locale( it->language().code() ) ).second; + } } // oops, some requested are not possbile, make them possible @@ -207,6 +210,8 @@ namespace zypp // now select the requested items for selection for (LocaleSet::const_iterator it = locales_r.begin(); it != locales_r.end(); ++it) { + MIL << "Requested locale '" << *it << "'" << endl; + // remove unwanted ? PoolItem installed( Helper::findInstalledByNameAndKind( _pool.accessor(), it->code(), ResTraits::kind ) ); PoolItem uninstalled( solver::detail::Helper::findUninstalledByNameAndKind( _pool.accessor(), it->code(), ResTraits::kind ) ); if (uninstalled) { @@ -214,6 +219,17 @@ namespace zypp uninstalled.status().setTransact( true, ResStatus::USER ); } } + + // if lang_country is given, also enable lang (i.e. if "de_DE" is given, also enable "de") + if ( (it->code() != it->language().code()) ) { + MIL << "Auto requesting locale '" << it->language().code() << "'" << endl; + uninstalled = solver::detail::Helper::findUninstalledByNameAndKind( _pool.accessor(), it->language().code(), ResTraits::kind ); + if (uninstalled) { + if (!uninstalled.status().isLocked()) { + uninstalled.status().setTransact( true, ResStatus::USER ); + } + } + } } _requested_locales = locales_r; -- 2.7.4