def test_lang_code(self): subproject = SubProject() subproject.filemask = 'Solution/Project/Resources.*.resx' self.assertEqual( subproject.get_lang_code('Solution/Project/Resources.es-mx.resx'), 'es-mx' ) self.assertEqual( subproject.get_lang_code('Solution/Project/Resources.resx'), '' ) self.assertRaisesMessage( ValidationError, 'Got empty language code for ' 'Solution/Project/Resources.resx, please check filemask!', subproject.clean_lang_codes, [ 'Solution/Project/Resources.resx', 'Solution/Project/Resources.de.resx', 'Solution/Project/Resources.es.resx', 'Solution/Project/Resources.es-mx.resx', 'Solution/Project/Resources.fr.resx', 'Solution/Project/Resources.fr-fr.resx', ] )
def test_lang_code_double(self): subproject = SubProject() subproject.filemask = 'path/*/resources/MessagesBundle_*.properties' self.assertEqual( subproject.get_lang_code( 'path/pt/resources/MessagesBundle_pt_BR.properties'), 'pt_BR') self.assertEqual( subproject.get_lang_code( 'path/el/resources/MessagesBundle_el.properties'), 'el')
def test_lang_code_double(self): subproject = SubProject() subproject.filemask = 'path/*/resources/MessagesBundle_*.properties' self.assertEqual( subproject.get_lang_code( 'path/pt/resources/MessagesBundle_pt_BR.properties' ), 'pt_BR' ) self.assertEqual( subproject.get_lang_code( 'path/el/resources/MessagesBundle_el.properties' ), 'el' )
def test_lang_code_template(self): subproject = SubProject(project=Project()) subproject.filemask = 'Solution/Project/Resources.*.resx' subproject.template = 'Solution/Project/Resources.resx' self.assertEqual( subproject.get_lang_code('Solution/Project/Resources.resx'), 'en' )
def test_lang_code(self): subproject = SubProject() subproject.filemask = "Solution/Project/Resources.*.resx" self.assertEqual(subproject.get_lang_code("Solution/Project/Resources.es-mx.resx"), "es-mx") self.assertEqual(subproject.get_lang_code("Solution/Project/Resources.resx"), "") self.assertRaisesMessage( ValidationError, "Got empty language code for " "Solution/Project/Resources.resx, please check filemask!", subproject.clean_lang_codes, [ "Solution/Project/Resources.resx", "Solution/Project/Resources.de.resx", "Solution/Project/Resources.es.resx", "Solution/Project/Resources.es-mx.resx", "Solution/Project/Resources.fr.resx", "Solution/Project/Resources.fr-fr.resx", ], )
def test_lang_code_template(self): subproject = SubProject() subproject.filemask = "Solution/Project/Resources.*.resx" subproject.template = "Solution/Project/Resources.resx" self.assertEqual(subproject.get_lang_code("Solution/Project/Resources.resx"), "en")