Package dev.orne.i18n.context
Interface I18nContext
- All Known Implementing Classes:
DefaultI18nContext
,I18nSpringContext
@API(status=STABLE,
since="0.1")
public interface I18nContext
Interface for I18N context. Contains the data required to return the I18N
texts in user's language.
- Since:
- 0.1
- Version:
- 1.0, 2021-01
- Author:
- (w) Iker Hernaez
-
Method Summary
Modifier and TypeMethodDescriptiondefault @NotNull Locale[]
Returns the languages supported by the application.default @NotNull I18nResources
Returns the default I18N resources of the application.default @NotNull I18nResources
getI18nResources
(String key) Returns the I18N resources identified by the specified key.static @NotNull I18nContext
Return theI18nContext
associated with the currentThread
.@NotNull Locale
Returns the user's language.@NotNull UUID
Returns the UUID of the provider owner of this context.void
Sets the user's language.
-
Method Details
-
getInstance
Return theI18nContext
associated with the currentThread
.- Returns:
- The I18N context.
-
getProviderUUID
Returns the UUID of the provider owner of this context.- Returns:
- The UUID of the provider owner of this context
-
getLocale
Returns the user's language.- Returns:
- The user's language
-
setLocale
Sets the user's language. If the argument isnull
the JVM default language is set.- Parameters:
language
- The user's language to set
-
getAvailableLocales
Returns the languages supported by the application.- Returns:
- The languages supported by the application
-
getI18nResources
Returns the default I18N resources of the application.- Returns:
- The default I18N resources
-
getI18nResources
Returns the I18N resources identified by the specified key. If key isnull
or no resources is associated for such key returns the default I18N resources.- Parameters:
key
- The key of the alternative I18N resources- Returns:
- The I18N resources to use for the key
-