Search in sources :

Example 1 with LanguageLocalizations

use of com.developmentontheedge.be5.metadata.model.LanguageLocalizations in project be5 by DevelopmentOnTheEdge.

the class ProjectGenerator method setLanguages.

private void setLanguages(final Project project) {
    for (final String language : parameters.getLanguages()) {
        final Localizations localizations = project.getApplication().getLocalizations();
        final LanguageLocalizations languageLocalizations = new LanguageLocalizations(language, localizations);
        DataElementUtils.saveQuiet(languageLocalizations);
    }
}
Also used : LanguageLocalizations(com.developmentontheedge.be5.metadata.model.LanguageLocalizations) LanguageLocalizations(com.developmentontheedge.be5.metadata.model.LanguageLocalizations) Localizations(com.developmentontheedge.be5.metadata.model.Localizations)

Example 2 with LanguageLocalizations

use of com.developmentontheedge.be5.metadata.model.LanguageLocalizations in project be5 by DevelopmentOnTheEdge.

the class Serialization method reloadLocalization.

public static LanguageLocalizations reloadLocalization(final Path file, final Localizations localizations) throws ReadException {
    checkProject(localizations.getProject());
    turnOffAutomaticSerialization();
    try {
        return new YamlDeserializer(new LoadContext()).reloadLocalization(file, localizations);
    } finally {
        turnOnAutomaticSerialization();
    }
}
Also used : YamlDeserializer(com.developmentontheedge.be5.metadata.serialization.yaml.YamlDeserializer)

Example 3 with LanguageLocalizations

use of com.developmentontheedge.be5.metadata.model.LanguageLocalizations in project be5 by DevelopmentOnTheEdge.

the class MetaImpl method getLocalization.

private String getLocalization(Project project, String language, String entity, Predicate<LocalizationElement> accept) {
    for (Module module : project.getModulesAndApplication()) {
        Localizations localizations = module.getLocalizations();
        LanguageLocalizations languageLocalizations = localizations.get(language);
        if (languageLocalizations == null)
            continue;
        EntityLocalizations entityLocalizations = languageLocalizations.get(entity);
        if (entityLocalizations == null)
            continue;
        for (LocalizationElement element : entityLocalizations.elements()) if (accept.test(element))
            return element.getValue();
    }
    return "";
}
Also used : EntityLocalizations(com.developmentontheedge.be5.metadata.model.EntityLocalizations) LanguageLocalizations(com.developmentontheedge.be5.metadata.model.LanguageLocalizations) EntityLocalizations(com.developmentontheedge.be5.metadata.model.EntityLocalizations) LanguageLocalizations(com.developmentontheedge.be5.metadata.model.LanguageLocalizations) Localizations(com.developmentontheedge.be5.metadata.model.Localizations) Module(com.developmentontheedge.be5.metadata.model.Module) LocalizationElement(com.developmentontheedge.be5.metadata.model.LocalizationElement)

Example 4 with LanguageLocalizations

use of com.developmentontheedge.be5.metadata.model.LanguageLocalizations in project be5 by DevelopmentOnTheEdge.

the class YamlSerializer method serialize.

public void serialize(final LanguageLocalizations languageLocalizations) throws WriteException {
    this.fileSystem = new ProjectFileSystem(languageLocalizations.getProject());
    new LocalizationSerializer().serialize(languageLocalizations);
}
Also used : ProjectFileSystem(com.developmentontheedge.be5.metadata.serialization.ProjectFileSystem)

Aggregations

LanguageLocalizations (com.developmentontheedge.be5.metadata.model.LanguageLocalizations)2 Localizations (com.developmentontheedge.be5.metadata.model.Localizations)2 EntityLocalizations (com.developmentontheedge.be5.metadata.model.EntityLocalizations)1 LocalizationElement (com.developmentontheedge.be5.metadata.model.LocalizationElement)1 Module (com.developmentontheedge.be5.metadata.model.Module)1 ProjectFileSystem (com.developmentontheedge.be5.metadata.serialization.ProjectFileSystem)1 YamlDeserializer (com.developmentontheedge.be5.metadata.serialization.yaml.YamlDeserializer)1