def _apply_geolocation_results(self): """Apply the geolocation results if any.""" # Skip timezone and keyboard default setting for kickstart installs. # The user may have provided these values via kickstart and if not, we # need to prompt for them. But do continue if geolocation-with-kickstart # is enabled. if flags.flags.automatedInstall and not geoloc.geoloc.enabled: return if not is_module_available(TIMEZONE): return timezone_proxy = TIMEZONE.get_proxy() loc_timezones = localization.get_locale_timezones( self._l12_module.Language) if geoloc.geoloc.result.timezone: # (the geolocation module makes sure that the returned timezone is # either a valid timezone or None) log.info("using timezone determined by geolocation") timezone_proxy.SetTimezone(geoloc.geoloc.result.timezone) # Either this is an interactive install and timezone.seen propagates # from the interactive default kickstart, or this is a kickstart # install where the user explicitly requested geolocation to be used. # So set timezone.seen to True, so that the user isn't forced to # enter the Date & Time spoke to acknowledge the timezone detected # by geolocation before continuing the installation. timezone_proxy.SetKickstarted(True) elif loc_timezones and not timezone_proxy.Timezone: # no data is provided by Geolocation, try to get timezone from the # current language log.info( "geolocation not finished in time, using default timezone") timezone_proxy.SetTimezone(loc_timezones[0])
def apply(self): (store, itr) = self._localeSelection.get_selected() locale = store[itr][1] locale = localization.setup_locale(locale, self.data.lang, text_mode=False) self._set_lang(locale) # Skip timezone and keyboard default setting for kickstart installs. # The user may have provided these values via kickstart and if not, we # need to prompt for them. But do continue if geolocation-with-kickstart # is enabled. if flags.flags.automatedInstall and not geoloc.geoloc.enabled: return loc_timezones = localization.get_locale_timezones(self.data.lang.lang) if geoloc.geoloc.result.timezone: # (the geolocation module makes sure that the returned timezone is # either a valid timezone or None) log.info("using timezone determined by geolocation") self.data.timezone.timezone = geoloc.geoloc.result.timezone # Either this is an interactive install and timezone.seen propagates # from the interactive default kickstart, or this is a kickstart # install where the user explicitly requested geolocation to be used. # So set timezone.seen to True, so that the user isn't forced to # enter the Date & Time spoke to acknowledge the timezone detected # by geolocation before continuing the installation. self.data.timezone.seen = True elif loc_timezones and not self.data.timezone.timezone: # no data is provided by Geolocation, try to get timezone from the # current language log.info("geolocation not finished in time, using default timezone") self.data.timezone.timezone = loc_timezones[0]
def apply(self): (store, itr) = self._localeSelection.get_selected() locale = store[itr][1] localization.setup_locale(locale, self.data.lang) # Skip timezone and keyboard default setting for kickstart installs. # The user may have provided these values via kickstart and if not, we # need to prompt for them. if flags.flags.automatedInstall: return geoloc_timezone = geoloc.get_timezone() loc_timezones = localization.get_locale_timezones(self.data.lang.lang) if geoloc_timezone: # (the geolocation module makes sure that the returned timezone is # either a valid timezone or None) self.data.timezone.timezone = geoloc_timezone elif loc_timezones and not self.data.timezone.timezone: # no data is provided by Geolocation, try to get timezone from the # current language self.data.timezone.timezone = loc_timezones[0] # setup Gtk direction (RTL/LTR) now that we have the language # configuration applied setup_gtk_direction() self._set_keyboard_defaults(self.data.lang.lang)
def apply(self): (store, itr) = self._localeSelection.get_selected() locale = store[itr][1] locale = localization.setup_locale(locale, self.data.lang, text_mode=False) self._set_lang(locale) # Skip timezone and keyboard default setting for kickstart installs. # The user may have provided these values via kickstart and if not, we # need to prompt for them. if flags.flags.automatedInstall: return geoloc_timezone = geoloc.get_timezone() loc_timezones = localization.get_locale_timezones(self.data.lang.lang) if geoloc_timezone: # (the geolocation module makes sure that the returned timezone is # either a valid timezone or None) self.data.timezone.timezone = geoloc_timezone elif loc_timezones and not self.data.timezone.timezone: # no data is provided by Geolocation, try to get timezone from the # current language self.data.timezone.timezone = loc_timezones[0] self._set_keyboard_defaults(self.data.lang.lang)
def apply(self): (store, itr) = self._localeSelection.get_selected() locale = store[itr][1] locale = localization.setup_locale(locale, self._l12_module.proxy, text_mode=False) self._set_lang(locale) # Skip timezone and keyboard default setting for kickstart installs. # The user may have provided these values via kickstart and if not, we # need to prompt for them. But do continue if geolocation-with-kickstart # is enabled. if flags.flags.automatedInstall and not geoloc.geoloc.enabled: return timezone_proxy = TIMEZONE.get_proxy() loc_timezones = localization.get_locale_timezones(self._l12_module.proxy.Language) if geoloc.geoloc.result.timezone: # (the geolocation module makes sure that the returned timezone is # either a valid timezone or None) log.info("using timezone determined by geolocation") timezone_proxy.SetTimezone(geoloc.geoloc.result.timezone) # Either this is an interactive install and timezone.seen propagates # from the interactive default kickstart, or this is a kickstart # install where the user explicitly requested geolocation to be used. # So set timezone.seen to True, so that the user isn't forced to # enter the Date & Time spoke to acknowledge the timezone detected # by geolocation before continuing the installation. timezone_proxy.SetKickstarted(True) elif loc_timezones and not timezone_proxy.Timezone: # no data is provided by Geolocation, try to get timezone from the # current language log.info("geolocation not finished in time, using default timezone") timezone_proxy.SetTimezone(loc_timezones[0])
def test_locale_timezones(self): self.assertIn("Europe/Oslo", localization.get_locale_timezones("no"))
def test_locale_timezones(self): assert "Europe/Oslo" in localization.get_locale_timezones("no")