use of org.terasology.i18n.assets.TranslationData in project Terasology by MovingBlocks.
the class TranslationFormatTests method testEmptyDataGenGermany.
@Test
public void testEmptyDataGenGermany() throws IOException, InvalidAssetFilenameException {
AssetDataFile assetDataFile = mockAssetDataFile("menu_de-DE.lang", "{}".getBytes(StandardCharsets.UTF_8));
ResourceUrn urn = createUrnFromFile(format, assetDataFile);
TranslationData data = format.load(urn, Collections.singletonList(assetDataFile));
Assert.assertEquals(Locale.GERMANY, data.getLocale());
Assert.assertTrue(data.getTranslations().isEmpty());
}
use of org.terasology.i18n.assets.TranslationData in project Terasology by MovingBlocks.
the class TranslationFormatTests method testEmptyDataGenRoot.
@Test
public void testEmptyDataGenRoot() throws IOException, InvalidAssetFilenameException {
AssetDataFile assetDataFile = mockAssetDataFile("menu.lang", "{}".getBytes(StandardCharsets.UTF_8));
ResourceUrn urn = createUrnFromFile(format, assetDataFile);
TranslationData data = format.load(urn, Collections.singletonList(assetDataFile));
Assert.assertEquals(new SimpleUri("engine:menu"), data.getProjectUri());
Assert.assertEquals(Locale.ROOT, data.getLocale());
}
use of org.terasology.i18n.assets.TranslationData in project Terasology by MovingBlocks.
the class TranslationFormatTests method testDataGenGerman.
@Test
public void testDataGenGerman() throws IOException, InvalidAssetFilenameException {
byte[] resource = createSimpleTranslationFile().getBytes(StandardCharsets.UTF_8);
AssetDataFile assetDataFile = mockAssetDataFile("menu_de-DE.lang", resource);
ResourceUrn urn = createUrnFromFile(format, assetDataFile);
TranslationData data = format.load(urn, Collections.singletonList(assetDataFile));
Assert.assertEquals("Einzelspieler", data.getTranslations().get("engine:mainMenuScreen#singleplayer#text"));
}
Aggregations