atrium-impl-robstoll / ch.tutteli.atrium.reporting.translating / PropertiesBasedTranslationSupplier

PropertiesBasedTranslationSupplier

abstract class PropertiesBasedTranslationSupplier<in T> : ITranslationSupplier

A base class for properties based ITranslationSuppliers which provides a loading and caching mechanism of properties files.

There is no way to purge the cache. This class is intended for a one run process where translations do not change in between.

Constructors

<init>

PropertiesBasedTranslationSupplier()

A base class for properties based ITranslationSuppliers which provides a loading and caching mechanism of properties files.

Functions

getOrLoadProperties

fun getOrLoadProperties(key: T, name: String, keyCreator: (String) -> String): Map<String, String>

Gets the cached Properties content as Map for the given key or loads the properties file with the given name and creates a map out of it using the given keyCreator function to create the keys of the map, based on a key of a property.

Inherited Functions

get

abstract fun get(translatable: ITranslatable, locale: Locale): String?

Returns the translation for the given translatable for the given locale or null if it does not have any.

Inheritors

PropertiesPerEntityAndLocaleTranslationSupplier

class PropertiesPerEntityAndLocaleTranslationSupplier : PropertiesBasedTranslationSupplier<String>

Represents an ITranslationSupplier which is based on properties-files which are structured per entity (enum, object or class) and Locale.

PropertiesPerLocaleTranslationSupplier

class PropertiesPerLocaleTranslationSupplier : PropertiesBasedTranslationSupplier<Locale>

Represents an ITranslationSupplier which is based on properties-files which are structured per Locale.