use of org.terasology.engine.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));
assertEquals(Locale.GERMANY, data.getLocale());
assertTrue(data.getTranslations().isEmpty());
}
use of org.terasology.engine.i18n.assets.TranslationData in project Terasology by MovingBlocks.
the class TranslationFormatTests method testMultiLine.
@Test
public void testMultiLine() throws IOException, InvalidAssetFilenameException {
byte[] resource = createSimpleMultiLineTranslationFile().getBytes(StandardCharsets.UTF_8);
AssetDataFile assetDataFile = mockAssetDataFile("game.lang", resource);
ResourceUrn urn = createUrnFromFile(format, assetDataFile);
TranslationData data = format.load(urn, Collections.singletonList(assetDataFile));
assertEquals("line 1 \n line 2 \n line 3", data.getTranslations().get("multi-line"));
assertEquals("line 1 \n line 2 \n line 3", data.getTranslations().get("single-line"));
}
use of org.terasology.engine.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));
assertEquals("Einzelspieler", data.getTranslations().get("engine:mainMenuScreen#singleplayer#text"));
}
use of org.terasology.engine.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));
assertEquals(new ResourceUrn("engine:menu"), data.getProjectUrn());
assertEquals(Locale.ROOT, data.getLocale());
}
Aggregations