Search in sources :

Example 1 with Translation

use of org.terasology.engine.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();
            ResourceUrn projectUrn = trans.getProjectUrn();
            if (!projectUrn.getModuleName().isEmpty() && !projectUrn.getResourceName().isEmpty()) {
                TranslationProject proj = projects.computeIfAbsent(projectUrn, e -> new StandardTranslationProject());
                proj.add(trans);
                trans.subscribe(this::onAssetChanged);
                logger.info("Discovered " + trans);
            } else {
                logger.warn("Ignoring invalid project projectUrn: {}", projectUrn);
            }
        }
    }
}
Also used : Translation(org.terasology.engine.i18n.assets.Translation) ResourceUrn(org.terasology.gestalt.assets.ResourceUrn)

Aggregations

Translation (org.terasology.engine.i18n.assets.Translation)1 ResourceUrn (org.terasology.gestalt.assets.ResourceUrn)1