Example #1
0
 def _get_param_locale(self):
     l10n_service = get_localization_service()
     if l10n_service is None:
         logger.info('No localization service registered')
         return None
     else:
         value = l10n_service.get_locale()
         if value is None:
             return None
         else:
             return value.decode('ascii')
Example #2
0
 def _get_param_locale(self):
     l10n_service = get_localization_service()
     if l10n_service is None:
         logger.info('No localization service registered')
         return None
     else:
         value = l10n_service.get_locale()
         if value is None:
             return None
         else:
             return value.decode('ascii')
Example #3
0
 def _set_param_locale(self, value):
     l10n_service = get_localization_service()
     if l10n_service is None:
         logger.info('No localization service registered')
     else:
         if not value:
             l10n_service.set_locale(None)
         else:
             try:
                 l10n_service.set_locale(value.encode('ascii'))
             except (UnicodeError, ValueError), e:
                 raise InvalidParameterError(e)
Example #4
0
 def _set_param_locale(self, value):
     l10n_service = get_localization_service()
     if l10n_service is None:
         logger.info('No localization service registered')
     else:
         if not value:
             l10n_service.set_locale(None)
         else:
             try:
                 l10n_service.set_locale(value.encode('ascii'))
             except (UnicodeError, ValueError) as e:
                 raise InvalidParameterError(e)