Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default locale not being set #143

Open
tardinha opened this issue Jul 11, 2018 · 14 comments
Open

Default locale not being set #143

tardinha opened this issue Jul 11, 2018 · 14 comments

Comments

@tardinha
Copy link

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.

@xini
Copy link
Contributor

xini commented Sep 14, 2018

The Member class sets the default locale in the onBeforeWrite. does that not work?

@tardinha
Copy link
Author

Doesn't seem to be.

@xini
Copy link
Contributor

xini commented Sep 18, 2018

I can confirm this. Although I don't really understand why...

@xini
Copy link
Contributor

xini commented Sep 19, 2018

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?

@tardinha
Copy link
Author

This is still a thing...

@nglasl
Copy link
Contributor

nglasl commented Jun 2, 2020

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:

1

This might just be because I'm using the default locale, so I'll try something like en_AU next.

@nglasl
Copy link
Contributor

nglasl commented Jun 2, 2020

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:

1

@nglasl
Copy link
Contributor

nglasl commented Jun 2, 2020

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?

@tardinha
Copy link
Author

tardinha commented Jun 2, 2020

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.

@xini
Copy link
Contributor

xini commented Jun 2, 2020

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?

@nglasl
Copy link
Contributor

nglasl commented Jun 3, 2020

@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.

@tardinha
Copy link
Author

tardinha commented Jun 3, 2020

@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 :)

@nglasl
Copy link
Contributor

nglasl commented Jun 3, 2020

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.

@tardinha
Copy link
Author

tardinha commented Jun 3, 2020

Seems they’re using locale and language interchangably

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants