def test_get_region_dump(self): os.environ["LC_ALL"] = "en_ZM.utf8" init_locale() res = self.region._get_region_dumb() self.assertEqual(res["countrycode"], "ZM") self.assertEqual(res["country"], "Zambia") os.environ["LANG"] = ""
def test_init_locale(self): import locale os.environ["LANGUAGE"] = "" os.environ["LC_ALL"] = "en_US.UTF-8" init_locale() self.assertEqual(locale.getlocale(locale.LC_MESSAGES), ("en_US", "UTF-8"))
def test_init_locale(self): import locale os.environ["LANGUAGE"] = "" os.environ["LC_ALL"] = "en_US.UTF-8" init_locale() self.assertEqual( locale.getlocale(locale.LC_MESSAGES), ("en_US", "UTF-8"))
def dbus_main(bus=None): if bus is None: bus = dbus.SessionBus() # apt needs the right locale for the translated package descriptions from softwarecenter.i18n import init_locale init_locale() main_context = GLib.main_context_default() main_loop = GLib.MainLoop(main_context) bus_name = dbus.service.BusName(DBUS_BUS_NAME, bus) data_provider = SoftwareCenterDataProvider(bus_name, main_loop=main_loop) data_provider # pyflakes # run it main_loop.run()