class PropertiesPerEntityAndLocaleTranslationSupplier : PropertiesBasedTranslationSupplier<String>
(source)
Represents a TranslationSupplier which is based on properties-files which are structured per entity (enum, object or class) and Locale.
For instance, the translations for ch.tutteli.atrium.translations.DescriptionAnyAssertion
and the Locale de_CH
are searched in a properties file named DescriptionAnyAssertion_de_CH.properties
in the directory /ch/tutteli/atrium/translations
.
An entry in such a file would look like as follows:
TO_BE = a translation for TO_BE
It is compatible with Java's Properties - thus properties files should also use ISO-8859-1 as encoding.
PropertiesPerEntityAndLocaleTranslationSupplier()
Represents a TranslationSupplier which is based on properties-files which are structured per entity (enum, object or class) and Locale. |
fun get(translatable: Translatable, locale: Locale): String?
Returns the translation for the given translatable and the given locale or |
fun getFileNameFor(baseName: String, locale: Locale): String
Returns the name of the properties file without extension -- including the package (as prefixed relative path) in which it resides if necessary -- in which we expect to find a translation in the given locale for baseName. |
|
fun getOrLoadProperties(key: T, fileName: 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 fileName 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. |