UserFrosting icon indicating copy to clipboard operation
UserFrosting copied to clipboard

WELCOME message not in user's locale

Open apple314159 opened this issue 8 years ago • 6 comments

The first page (dashboard) is rendered in the user's locale but the alert sent along with it is rendered in the default locale.

Forum discussion: https://forums.userfrosting.com/t/welcome-message-not-in-users-locale/93/4

apple314159 avatar Nov 03 '17 18:11 apple314159

As stated on the forum, it's because the alert is generated before the user locale is loaded. The user locale is loaded after the redirect.

See : https://github.com/userfrosting/UserFrosting/blob/master/app/sprinkles/account/src/Controller/AccountController.php#L361

Maybe addMessageTranslated could accept the locale name as an additional argument.

lcharette avatar Nov 06 '17 01:11 lcharette

Duplicate of #718. (well, a consequence of at least)

Silic0nS0ldier avatar Nov 30 '17 19:11 Silic0nS0ldier

Yes and no... #718 would partly solve this. But if the browser is in French and the account in Spanish, it's still an issue.

lcharette avatar Nov 30 '17 19:11 lcharette

Ah. I see. Hmm... Updating the language service to use the new language (if its different) would be a more useful change wouldn't it? That way any messages generated afterward (either from UF code, or user customisations) would be covered.

Silic0nS0ldier avatar Nov 30 '17 20:11 Silic0nS0ldier

Actually, forcing a locale when using translate would be more useful... but the way the translator is made, it needs to load all of the translation key... which isn't optimal...

lcharette avatar Nov 30 '17 21:11 lcharette

Note this can be experienced when changing the locale in the user setting page.

A more powerful fix would be to register the alert using the translation key/slug + placeholder array, and let the actual translation be done only when displaying the alert.

lcharette avatar Nov 29 '19 03:11 lcharette

This is fixed (6 yrs later 😅) in dd98b7f for the 5.1 release.

lcharette avatar Dec 17 '23 15:12 lcharette