User tests: Successful: Unsuccessful:
This adds the option to set the default language for a language field to the default frontend or backen language. Basically it adds the option to use:
default="site"
default="administrator"
default="active"
This also changes frontend user registration to use the automatically detected
language. Before it was selecting the first language.
It also allows devs to store a dynamic reference to the active language. For exampe if you want to always store the active frontend language you can save "site" and you always get the active language. Without this you would, for example, store en-GB and then if the language is changed you will keep getting en-GB.
Example loading of frontend active language:
<field name="language" type="language"
client="site"
description="COM_USERS_USER_FIELD_FRONTEND_LANGUAGE_DESC"
label="COM_USERS_USER_FIELD_FRONTEND_LANGUAGE_LABEL"
required="true"
filter="cmd"
default="site"
/>
Example loading of backend active language:
<field name="language" type="language"
client="site"
description="COM_USERS_USER_FIELD_FRONTEND_LANGUAGE_DESC"
label="COM_USERS_USER_FIELD_FRONTEND_LANGUAGE_LABEL"
required="true"
filter="cmd"
default="administrator"
/>
Example loading of automatically detected language:
<field name="language" type="language"
client="site"
description="COM_USERS_USER_FIELD_FRONTEND_LANGUAGE_DESC"
label="COM_USERS_USER_FIELD_FRONTEND_LANGUAGE_LABEL"
required="true"
filter="cmd"
default="active"
/>
You can reference frontend active language with:
'site', 'frontend', '0'
You can reference backend active language with:
'admin', 'administrator', 'backend', '1'
You can reference automaically detected language with:
"active", "auto"
I have added the automatically detection of user language.
New options for the default attribute:
default="active"
default="auto"
Tested here:
we do get the defined default site language, but not the language of the page we are in when loading the registration form.