Merge lp:~seb128/ubuntu-system-settings/language-filter-translations into lp:ubuntu-system-settings

Proposed by Sebastien Bacher
Status: Work in progress
Proposed branch: lp:~seb128/ubuntu-system-settings/language-filter-translations
Merge into: lp:ubuntu-system-settings
Diff against target: 29 lines (+11/-1)
1 file modified
plugins/language/language-plugin.cpp (+11/-1)
To merge this branch: bzr merge lp:~seb128/ubuntu-system-settings/language-filter-translations
Reviewer Review Type Date Requested Status
Iain Lane Needs Information
Review via email: mp+259730@code.launchpad.net

Commit message

[language] list languages with translations rather than installed locales

Description of the change

[language] list languages with translations rather than installed locales

To post a comment you must log in.
Revision history for this message
Iain Lane (laney) wrote :

This was discussed in #ubuntu-desktop: http://irclogs.ubuntu.com/2015/05/21/#ubuntu-desktop.html#t08:51 and we decided to wait with this change until we have a design for a region selector too. I think we'll be able to land this MP as-is or close to as-is then.

Thanks!

review: Needs Information
Revision history for this message
Sebastien Bacher (seb128) wrote :

Seems like we need to get a locale selector before we land that simplication of language, keep as work in progress meanwhile so it doesn't land by error

Unmerged revisions

1418. By Sebastien Bacher

[language] list languages with translations rather than installed locales

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/language/language-plugin.cpp'
2--- plugins/language/language-plugin.cpp 2015-04-10 11:22:10 +0000
3+++ plugins/language/language-plugin.cpp 2015-05-21 08:33:40 +0000
4@@ -291,6 +291,9 @@
5 QHash<QString, QString> likelyLocaleForLanguage;
6 QList<LanguageLocale> languageLocales;
7
8+ QStringList installedTranslations(QDir("/usr/share/locale-langpack").
9+ entryList(QDir::Dirs | QDir::NoDotAndDotDot));
10+
11 // Remove blacklisted locales.
12 for (unsigned int
13 i(0); i < sizeof(LOCALE_BLACKLIST) / sizeof(const char *); i++)
14@@ -323,7 +326,14 @@
15
16 languageLocale.likely = likelyLocaleForLanguage[language] ==
17 i->left(i->indexOf('.'));
18- languageLocales += languageLocale;
19+
20+ /* Only list locales that are the main ones (=likely) for a language,
21+ or that are a variant of the language which has translations on disk
22+ (by looking if the langpack directories include the locale, without its '.utf-8') */
23+ if (languageLocale.likely ||
24+ installedTranslations.contains(languageLocale.localeName.split(".utf8")[0])) {
25+ languageLocales += languageLocale;
26+ }
27 }
28
29 qSort(languageLocales);

Subscribers

People subscribed via source and target branches