[totem] opensubtitles: Improve locale error handling



commit 6833b7f7bf15dbaba6687d56b52230aca5af6b62
Author: Philip Withnall <philip tecnocode co uk>
Date:   Fri Apr 8 14:06:25 2011 +0100

    opensubtitles: Improve locale error handling

 src/plugins/opensubtitles/opensubtitles.py |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/opensubtitles/opensubtitles.py b/src/plugins/opensubtitles/opensubtitles.py
index 341cc43..7a60598 100644
--- a/src/plugins/opensubtitles/opensubtitles.py
+++ b/src/plugins/opensubtitles/opensubtitles.py
@@ -205,8 +205,9 @@ class OpenSubtitlesModel (object):
 
         try:
             import locale
-            self.lang = LANGUAGES[locale.getlocale ()[0].split ('_')[0]]
-        except (ImportError, IndexError):
+            (language_code, _encoding) = locale.getlocale ()
+            self.lang = LANGUAGES[language_code.split ('_')[0]]
+        except (ImportError, IndexError, AttributeError):
             self.lang = 'eng'
 
         self.hash = None



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]