Search in sources :

Example 11 with AssetDataFile

use of org.terasology.assets.format.AssetDataFile 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"));
}
Also used : AssetDataFile(org.terasology.assets.format.AssetDataFile) TranslationData(org.terasology.i18n.assets.TranslationData) ResourceUrn(org.terasology.assets.ResourceUrn) Test(org.junit.Test)

Aggregations

AssetDataFile (org.terasology.assets.format.AssetDataFile)11 IOException (java.io.IOException)4 InputStreamReader (java.io.InputStreamReader)4 JsonParser (com.google.gson.JsonParser)3 JsonReader (com.google.gson.stream.JsonReader)3 Test (org.junit.Test)3 ResourceUrn (org.terasology.assets.ResourceUrn)3 TranslationData (org.terasology.i18n.assets.TranslationData)3 UIElement (org.terasology.rendering.nui.asset.UIElement)3 UISkin (org.terasology.rendering.nui.skin.UISkin)3 JsonTree (org.terasology.rendering.nui.widgets.treeView.JsonTree)3 SimpleUri (org.terasology.engine.SimpleUri)2 JsonElement (com.google.gson.JsonElement)1 JsonParseException (com.google.gson.JsonParseException)1 BufferedInputStream (java.io.BufferedInputStream)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 Locale (java.util.Locale)1 Name (org.terasology.naming.Name)1 UIWidget (org.terasology.rendering.nui.UIWidget)1