Description: Prevent language-options from listing invalid items Bug-Ubuntu: http://launchpad.net/bugs/960314 Forwarded: not-needed (change to Ubuntu specific patch) Author: Gunnar Hjalmarsson Last-Update: 2013-01-30 Index: accountsservice-0.6.29/debian/changelog =================================================================== --- accountsservice-0.6.29.orig/debian/changelog 2013-01-23 14:19:33.000000000 +0100 +++ accountsservice-0.6.29/debian/changelog 2013-01-30 02:12:10.472528370 +0100 @@ -1,3 +1,12 @@ +accountsservice (0.6.29-1ubuntu5) raring; urgency=low + + * debian/patches/0009-language-tools.patch: + Prevent language-options from listing items that don't correspond + with an installed langpack, even if there is a matching locale + (LP: #960314). + + -- Gunnar Hjalmarsson Wed, 30 Jan 2013 02:10:00 +0100 + accountsservice (0.6.29-1ubuntu4) raring; urgency=low * debian/patches/0010-set-language.patch: Index: accountsservice-0.6.29/debian/patches/0009-language-tools.patch =================================================================== --- accountsservice-0.6.29.orig/debian/patches/0009-language-tools.patch 2012-11-29 21:49:23.000000000 +0100 +++ accountsservice-0.6.29/debian/patches/0009-language-tools.patch 2013-01-30 02:00:15.932985159 +0100 @@ -104,8 +104,8 @@ Index: accountsservice-0.6.29/data/langtools/language-options =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ accountsservice-0.6.29/data/langtools/language-options 2012-11-29 17:48:30.728502114 +0100 -@@ -0,0 +1,66 @@ ++++ accountsservice-0.6.29/data/langtools/language-options 2013-01-30 00:44:24.214414397 +0100 +@@ -0,0 +1,77 @@ +#!/usr/bin/perl +use strict; +use warnings; @@ -122,11 +122,22 @@ + @extended_localelist{$loc, $lang} = (1, 1); +} + -+# get the union of /usr/share/locale-langpack and /usr/share/locale ++# get the directory names in /usr/share/locale-langpack plus possible other ++# translation directory names in /usr/share/locale +my %translation_dirs; -+for my $dir ('/usr/share/locale-langpack', '/usr/share/locale') { -+ if ( opendir my ($dh), $dir ) { -+ $translation_dirs{$_} = 1 for readdir $dh; ++if ( opendir my ($dh), '/usr/share/locale-langpack' ) { ++ $translation_dirs{$_} = 1 for readdir $dh; ++} ++my %langpack_langcodes = map { s/[^a-z].+//; $_, 1 } ++ grep !/^\./, keys %translation_dirs; ++if ( opendir my ($dh), '/usr/share/locale' ) { ++ for ( readdir $dh ) { ++ for my $lang ( keys %langpack_langcodes ) { ++ if ( /^$lang[_@]/ ) { ++ $translation_dirs{$_} = 1; ++ last; ++ } ++ } + } +} +