Default locale not being set
tardinha opened this issue · 14 comments
When a new member is created via the registration form, their locale is not being set (it defaults to the first in the list, Afrikaans).
In SS3, this would default to the default locale.
The Member class sets the default locale in the onBeforeWrite. does that not work?
Doesn't seem to be.
I can confirm this. Although I don't really understand why...
My default locale is configured as 'en_AU' for Australian sites. But the locales provided in the Locale dropdown in the CMS only contain 'en_GB' and 'en_US' as options. So the locale of new Members is probably set corrently to 'en_AU', but this can't be displayed in the CMS.
Any ideas how to fix that?
This is still a thing...
I finally managed to put some time aside to run this module up and dig into this (on SS4.5), but would you believe.. I'm not seeing any issues haha. The following shows 2 users I created in the CMS, and 1 user I created using the member profile registration page:
This might just be because I'm using the default locale, so I'll try something like en_AU
next.
Okay interesting results. So yeah, the locale dropdown for a member in the CMS doesn't contain en_AU
so when I set the default locale to en_AU
, this ends up showing as Afrikaans (South Africa)
. If you hit save, this is actually saved as af_ZA
. If you create a member using the registration page, you get the expected locale of en_AU
as seen below:
So from what I can see, the module is behaving as expected, however it's not ideal that the locale dropdown in the CMS excludes certain locales. Perhaps this is something to follow through with a core issue and/or pull request? Would love to gather your thoughts before I close this however, as perhaps your issues are project specific?
What happens if we set multiple locales, maybe the second can be used if the first is not found? e.g.;
i18n::set_locale('en_AU');
i18n::set_locale('en_GB');
We don't have any multilingual sites, and users will only have access to the front end, so from our point of view, we want all users to be en_GB.
I agree with Mark. Maybe there should be a setting in the module what available CMS locale should be set for new registered users? similar to the group?
@tardinha setting i18n::set_locale('en_GB');
(but preferably using YAML) should solve your problems if I'm understanding you correctly? In regards to having multiple locales, I don't believe i18n supports this outside multilingual SS modules.
I guess it makes sense that en_AU
isn't selectable since it's technically the same as en_GB
in regards to language, but perhaps there are improvements that can be made around this especially if you want newly registered users to have a locale different to the default.
@nglasl it does, but that's kind of a hack. As we should be setting our Aussie sites as en_AU (particularly for frontend stuff).
I guess then we need to make sure we manually set our templates to en_AU and not use $ContentLocale :)
I think ideally the dropdown should include any locale that's valid (including en_AU
), because that's important when you take time zones into account. But yeah, not sure why that isn't the case.
Seems they’re using locale and language interchangably