Catalog I18N support
Read I18N satrings form aircraft data and add to the catalog
This commit is contained in:
@@ -7,6 +7,17 @@
|
||||
|
||||
<primary-set type="bool">true</primary-set>
|
||||
|
||||
|
||||
<localized>
|
||||
<de>
|
||||
<long-description>Describe the F16-A in German</long-description>
|
||||
</de>
|
||||
|
||||
<fr>
|
||||
<long-description>Describe the F16-A in French</long-description>
|
||||
</fr>
|
||||
</localized>
|
||||
|
||||
<rating>
|
||||
<FDM type="int">3</FDM>
|
||||
<systems type="int">1</systems>
|
||||
|
||||
@@ -6,6 +6,16 @@
|
||||
<long-description>The F16-B is an upgraded version of the F16A.</long-description>
|
||||
<variant-of>f16a</variant-of>
|
||||
|
||||
<localized>
|
||||
<de>
|
||||
<long-description>Describe the F16-B in German</long-description>
|
||||
</de>
|
||||
|
||||
<fr>
|
||||
<long-description>Describe the F16-B in French</long-description>
|
||||
</fr>
|
||||
</localized>
|
||||
|
||||
<authors n="0">
|
||||
<author n="0">
|
||||
<name>James T Kirk</name>
|
||||
|
||||
+11
-1
@@ -40,6 +40,9 @@ class UpdateCatalogTests(unittest.TestCase):
|
||||
self.assertEqual(authors.getValue('author[0]/email'), 'ww@wright.com')
|
||||
self.assertEqual(authors.getValue('author[1]/name'), 'Orville Wright')
|
||||
|
||||
locDe = info['localized']['de']
|
||||
self.assertEqual(locDe["long-description"], "Describe the F16-A in German")
|
||||
|
||||
|
||||
def test_scan_dir(self):
|
||||
(pkg, variants) = catalog.scan_aircraft_dir("testData/Aircraft/f16", ["testData/OtherDir"])
|
||||
@@ -60,6 +63,9 @@ class UpdateCatalogTests(unittest.TestCase):
|
||||
self.assertEqual(f16b['variant-of'], 'f16a')
|
||||
self.assertEqual(f16b['primary-set'], False)
|
||||
|
||||
locFr = f16b['localized']['fr']
|
||||
self.assertEqual(locFr["long-description"], "Describe the F16-B in French")
|
||||
|
||||
authorsArray = f16b['authors']
|
||||
self.assertNotIn('author', f16b)
|
||||
|
||||
@@ -135,8 +141,9 @@ class UpdateCatalogTests(unittest.TestCase):
|
||||
self.assertEqual(parsedPkgNode.getValue('rating/cockpit'), 2)
|
||||
self.assertEqual(parsedPkgNode.getValue('rating/model'), 5)
|
||||
|
||||
self.assertEqual(parsedPkgNode.getValue('localized/de/long-description'), "Describe the F16-A in German")
|
||||
|
||||
# author data verification
|
||||
# author data verification
|
||||
self.assertFalse(parsedPkgNode.hasChild('author'));
|
||||
parsedAuthors = parsedPkgNode.getChild("authors").getChildren('author')
|
||||
|
||||
@@ -172,6 +179,9 @@ class UpdateCatalogTests(unittest.TestCase):
|
||||
self.assertEqual(author1.getValue("email"), "shatner@enterprise.com")
|
||||
self.assertEqual(author1.getValue("description"), "Everything")
|
||||
|
||||
self.assertEqual(pv.getValue('localized/de/long-description'), "Describe the F16-B in German")
|
||||
|
||||
|
||||
def test_node_creation2(self):
|
||||
(pkg, variants) = catalog.scan_aircraft_dir("testData/Aircraft/dc3", ["testData/OtherDir"])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user