Search in sources :

Example 6 with TagValueHolder

use of tools.utils.TagValueHolder in project AuthMeReloaded by AuthMe.

the class TranslationPageGenerator method executeDefault.

@Override
public void executeDefault() {
    TranslationsGatherer gatherer = new TranslationsGatherer();
    NestedTagValue translationValuesHolder = new NestedTagValue();
    for (TranslationInfo translation : gatherer.getTranslationInfo()) {
        int percentage = (int) Math.round(translation.percentTranslated * 100);
        String name = firstNonNull(LANGUAGE_NAMES.get(translation.code), "?");
        TagValueHolder valueHolder = TagValueHolder.create().put("code", translation.code).put("name", name).put("percentage", Integer.toString(percentage)).put("color", computeColor(percentage));
        translationValuesHolder.add(valueHolder);
    }
    TagValueHolder tags = TagValueHolder.create().put("languages", translationValuesHolder);
    FileIoUtils.generateFileFromTemplate(TEMPLATE_FILE, DOCS_PAGE, tags);
    System.out.println("Wrote to '" + DOCS_PAGE + "'");
}
Also used : TagValueHolder(tools.utils.TagValueHolder) NestedTagValue(tools.utils.TagValue.NestedTagValue) TranslationInfo(tools.docs.translations.TranslationsGatherer.TranslationInfo)

Aggregations

TagValueHolder (tools.utils.TagValueHolder)6 NestedTagValue (tools.utils.TagValue.NestedTagValue)4 HashAlgorithm (fr.xephi.authme.security.HashAlgorithm)2 SettingsManager (ch.jalu.configme.SettingsManager)1 YamlFileResource (ch.jalu.configme.resource.YamlFileResource)1 CommandDescription (fr.xephi.authme.command.CommandDescription)1 File (java.io.File)1 IOException (java.io.IOException)1 Map (java.util.Map)1 TranslationInfo (tools.docs.translations.TranslationsGatherer.TranslationInfo)1