LanguageUtils
This object provides access to common language utilities.
This object contains language codes for English and Welsh and a function to return the current language based on a request header.
Additionally, a Dates object is provided which provides helper functions to return correctly formatted dates in both English and Welsh.
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
Members list
Type members
Classlikes
Helper object to correctly display and format dates in both English and Welsh.
Helper object to correctly display and format dates in both English and Welsh.
This object provides a default implementation of the Dates trait in order to provide support for Welsh and English dates.
Attributes
A trait that correctly displays and formats dates in multiple languages.
A trait that correctly displays and formats dates in multiple languages.
This object contains helper methods to correctly format dates in any language supported by the IBM ICU library.
This trait requires a default timezone to be defined, as well as String values for the English words:
- to
- day
- days
These values should come from a Messages file for each language that needs to be supported.
Attributes
Value members
Concrete methods
Returns the current language as a Lang object.
Returns the current language as a Lang object.
This function returns the current language as an i18n Lang object. It first checks that the PLAY_LANG cookie exists from the request object and then gets the value from it. If it does not exist then it returns the accepted language from the request object. If there is no Play application then it just defaults to return the accepted language in the request or use the default language.
Value parameters
- request
-
The RequestHeader object to extract the language information from.
Attributes
- Returns
-
Lang object containing the current langugage.
Returns true if the lang passed exists within play.i18n.langs config value
Returns true if the lang passed exists within play.i18n.langs config value
Value parameters
- lang
-
The language to check against
Attributes
- Returns
-
A boolean on wether this language is supported in the current application
Filters a Map of languages against what languages are enabled in the current application
Filters a Map of languages against what languages are enabled in the current application
This function returns a filtered Map containing only languages which are enabled in the play.i18n.langs configuration value. This function is to be used to dynamically populate which languages should be displayed on the applications language switcher.
Value parameters
- langMap
-
List of all supported languages
Attributes
- Returns
-
filtered list of enabled languages