From 6ac0b0d71501d838b859dd25472e80ff9197ca4e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 1 May 2014 22:23:30 +0530 Subject: [PATCH] Fix #1315064 [locale 'C' prevents linux installation from completing](https://bugs.launchpad.net/calibre/+bug/1315064) --- src/calibre/spell/dictionary.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/spell/dictionary.py b/src/calibre/spell/dictionary.py index c0c891da27..839468ec94 100644 --- a/src/calibre/spell/dictionary.py +++ b/src/calibre/spell/dictionary.py @@ -101,7 +101,10 @@ def custom_dictionaries(reread=False): return _custom default_en_locale = 'en-US' -ul = parse_lang_code(get_system_locale() or 'en-US') +try: + ul = parse_lang_code(get_system_locale() or 'en-US') +except ValueError: + ul = None if ul is not None and ul.langcode == 'eng' and ul.countrycode in 'GB BS BZ GH IE IN JM NZ TT'.split(): default_en_locale = 'en-' + ul.countrycode default_preferred_locales = {'eng':default_en_locale, 'deu':'de-DE', 'spa':'es-ES', 'fra':'fr-FR'}