localeSelect
Purpose
Creates a select to select from a list of available localesExamples
// create a locale select
<g:localeSelect name="myLocale" value="${locale}" />
Description
Attributes
name
- The name to be used for the select box
value
(optional) - The set locale, defaults to the current request locale if not specified
Source
Show Source
def localeSelect = {attrs ->
attrs['from'] = Locale.getAvailableLocales()
attrs['value'] = (attrs['value'] ? attrs['value'] : RCU.getLocale(request))
// set the key as a closure that formats the locale
attrs['optionKey'] = {"${it.language}_${it.country}"}
// set the option value as a closure that formats the locale for display
attrs['optionValue'] = {"${it.language}, ${it.country}, ${it.displayName}"} // use generic select
out << select(attrs)
}