def test_locales_can_translate_colours(self): _ = locales.Locales("polychromatic", "de_DE").init() if os.path.exists(self.paths.colours): os.remove(self.paths.colours) preferences.init(_) colours = preferences.load_file(self.paths.colours) passed = False for item in colours: # EN: Green | DE: Grün if item["name"] == "Grün": passed = True self.assertTrue(passed, "Could not translate colour strings")
def setUpClass(self): self.i18n = locales.Locales("polychromatic") self._ = self.i18n.init() self.dbg = common.Debugging() self.paths = common.paths preferences.init(self._) self.fileman = effects.EffectFileManagement(self.i18n, self._, self.dbg) # Dummy content self.fileman.save_item(self.fileman.init_data("Test 1", effects.TYPE_LAYERED)) self.fileman.save_item(self.fileman.init_data("Test 2", effects.TYPE_LAYERED)) self.fileman.save_item(self.fileman.init_data("Test 3", effects.TYPE_LAYERED))
def setUpClass(self): self.i18n = locales.Locales("polychromatic") self._ = self.i18n.init() self.dbg = common.Debugging() self.paths = common.paths preferences.init(self._) self.fileman = effects.EffectFileManagement(self.i18n, self._, self.dbg) # Dummy content self.fileman.save_item( self.fileman.init_data("Test 1", effects.TYPE_LAYERED)) self.fileman.save_item( self.fileman.init_data("Test 2", effects.TYPE_LAYERED)) self.fileman.save_item( self.fileman.init_data("Test 3", effects.TYPE_LAYERED)) # Unit test resources self.res_path = os.path.join(os.path.dirname(__file__), "files")
def test_locales_can_translate_strings(self): _ = locales.Locales("polychromatic", "de_DE").init() # EN: Breath | DE: Atem self.assertEqual(_("Breath"), "Atem", "Could not translate text in German")
def test_locales_can_be_set(self): i18n = locales.Locales("polychromatic", "de_DE") _ = i18n.init() self.assertEqual(i18n.get_current_locale(), "de_DE", "Could not set up a German locale")
def setUp(self): self._ = locales.Locales("polychromatic").init() self.dbg = common.Debugging() self.paths = common.paths preferences.init(self._)