Search in sources :

Example 1 with TranslationInfo

use of tools.docs.translations.TranslationsGatherer.TranslationInfo 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.getPercentTranslated() * 100);
        String name = Optional.ofNullable(LANGUAGE_NAMES.get(translation.getCode())).orElse("?");
        TagValueHolder valueHolder = TagValueHolder.create().put("code", translation.getCode()).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

TranslationInfo (tools.docs.translations.TranslationsGatherer.TranslationInfo)1 NestedTagValue (tools.utils.TagValue.NestedTagValue)1 TagValueHolder (tools.utils.TagValueHolder)1