From 1d86be75d10f3d5330776f6bab090d14dd1aa3a0 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Wed, 22 Aug 2018 02:29:28 +0200 Subject: I18n fixes for modal components. --- src/main/kotlin/pl/treksoft/kvision/i18n/I18n.kt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/main/kotlin/pl/treksoft/kvision/i18n') diff --git a/src/main/kotlin/pl/treksoft/kvision/i18n/I18n.kt b/src/main/kotlin/pl/treksoft/kvision/i18n/I18n.kt index 9d2ee1db..ee7bad86 100644 --- a/src/main/kotlin/pl/treksoft/kvision/i18n/I18n.kt +++ b/src/main/kotlin/pl/treksoft/kvision/i18n/I18n.kt @@ -127,7 +127,12 @@ object I18n { return I18N_PLURAL_DELIMITER + singularKey + I18N_PLURAL_DELIMITER + pluralKey + I18N_PLURAL_DELIMITER + value } - internal fun trans(text: String): String { + /** + * A dynamic translation function. + * @param text text marked for a dynamic translation. + * @return translated text. + */ + fun trans(text: String): String { return if (text.startsWith(I18N_SINGLE_DELIMITER)) { gettext(text.substring(I18N_SINGLE_DELIMITER.length)) } else if (text.startsWith(I18N_PLURAL_DELIMITER)) { @@ -142,7 +147,12 @@ object I18n { } } - internal fun trans(text: String?): String? { + /** + * A dynamic translation function. + * @param text text marked for a dynamic translation. + * @return translated text. + */ + fun trans(text: String?): String? { return text?.let { trans(it) } -- cgit