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

WELCOME message not in user's locale #811

Closed
apple314159 opened this issue Nov 3, 2017 · 7 comments
Closed

WELCOME message not in user's locale #811

apple314159 opened this issue Nov 3, 2017 · 7 comments
Assignees
Labels
confirmed bug Something isn't working internationalization Related to the localization feature
Milestone

Comments

@apple314159
Copy link
Contributor

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

@alexweissman alexweissman added confirmed bug Something isn't working internationalization Related to the localization feature labels Nov 3, 2017
@lcharette
Copy link
Member

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.

@Silic0nS0ldier
Copy link
Member

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

@lcharette
Copy link
Member

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.

@Silic0nS0ldier
Copy link
Member

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.

@lcharette
Copy link
Member

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 lcharette added this to the 4.2.0 milestone Dec 16, 2017
@lcharette lcharette self-assigned this Mar 28, 2018
@lcharette lcharette modified the milestones: 4.2.0, 4.3.0 Aug 21, 2018
@lcharette lcharette modified the milestones: 4.3.0, 4.4.0 Jan 14, 2019
@lcharette
Copy link
Member

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 lcharette modified the milestones: 4.4.0, 4.5.0 Jan 11, 2020
@Silic0nS0ldier Silic0nS0ldier linked a pull request Apr 24, 2021 that will close this issue
@lcharette lcharette modified the milestones: 4.x.x, 5.0.1 Nov 25, 2023
@lcharette lcharette moved this to Todo 5.0.1 in UserFrosting Task Planner Nov 26, 2023
@lcharette lcharette moved this from Todo 5.0.1 to Todo 5.1.0 in UserFrosting Task Planner Dec 11, 2023
@lcharette lcharette modified the milestones: 5.0.1, 5.1.0 Dec 12, 2023
lcharette added a commit to userfrosting/framework that referenced this issue Dec 17, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@lcharette
Copy link
Member

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

@github-project-automation github-project-automation bot moved this from Todo 5.1.0 to Done in UserFrosting Task Planner Dec 17, 2023
@lcharette lcharette moved this from Done (5.1) to Done in UserFrosting Task Planner Apr 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed bug Something isn't working internationalization Related to the localization feature
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants