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 26, 2018
1 parent 1a57d31 commit 45a98e9
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions zypp/sat/detail/PoolImpl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,24 @@ 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();
auto checkIsFallback = [&lang]( const IdString &currLocStr_r ){
Locale currLoc(currLocStr_r);
return ( currLoc && Locale(currLoc).hasFallback(lang) );
};
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(), checkIsFallback ) )
localeIds.removed().insert( IdString(lang) );
}
}

}

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

0 comments on commit 45a98e9

Please sign in to comment.