Skip to content

Commit

Permalink
Autoremove a locale only if its not the fallback for another enabled one
Browse files Browse the repository at this point in the history
  • Loading branch information
bzeller committed Jun 25, 2018
1 parent cd9983d commit cffd83b
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions zypp/sat/detail/PoolImpl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,20 @@ namespace zypp
// Add removed locales+fallback except they are still in current
for ( Locale lang: localesTracker.removed() )
{
for ( ; lang && ! localeIds.current().count( IdString(lang) ); lang = lang.fallback() )
{ localeIds.removed().insert( IdString(lang) ); }
if ( lang && ! localeIds.current().count( IdString(lang) ) ) {

//remove the requested one
localeIds.removed().insert( IdString(lang) );

//remove fallbacks
const auto &currLangs = localeIds.current();
for ( lang = lang.fallback(); lang && ! localeIds.current().count( IdString(lang) ); lang = lang.fallback() ) {
//remove the language only if its not a fallback for any other
if ( std::none_of(currLangs.begin(), currLangs.end(), [&lang](const IdString &loc){ return Locale(loc).fallback() == lang; }) )
localeIds.removed().insert( IdString(lang) );
}
}

}

// Assert that TrackedLocaleIds::current is not empty.
Expand Down

0 comments on commit cffd83b

Please sign in to comment.