예제 #1
0
 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"] = ""
예제 #2
0
 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"] = ""
예제 #3
0
 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"))
예제 #4
0
파일: test_i18n.py 프로젝트: cs2c/AppStream
 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"))
예제 #5
0
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()