Search in sources :

Example 1 with Translation

use of org.terasology.i18n.assets.Translation in project Terasology by MovingBlocks.

the class TranslationSystemImpl method refresh.

@Override
public void refresh() {
    Set<ResourceUrn> urns = assetManager.getAvailableAssets(Translation.class);
    for (ResourceUrn urn : urns) {
        Optional<Translation> asset = assetManager.getAsset(urn, Translation.class);
        if (asset.isPresent()) {
            Translation trans = asset.get();
            Uri uri = trans.getProjectUri();
            if (uri.isValid()) {
                TranslationProject proj = projects.computeIfAbsent(uri, e -> new StandardTranslationProject());
                proj.add(trans);
                trans.subscribe(this::onAssetChanged);
                logger.info("Discovered " + trans);
            } else {
                logger.warn("Ignoring invalid project uri: {}", uri);
            }
        }
    }
}
Also used : Translation(org.terasology.i18n.assets.Translation) ResourceUrn(org.terasology.assets.ResourceUrn) Uri(org.terasology.engine.Uri) SimpleUri(org.terasology.engine.SimpleUri)

Aggregations

ResourceUrn (org.terasology.assets.ResourceUrn)1 SimpleUri (org.terasology.engine.SimpleUri)1 Uri (org.terasology.engine.Uri)1 Translation (org.terasology.i18n.assets.Translation)1