[MAGNOLIA-2097] i18n: MgnlContext.setLocale() is never used while FreemarkerHelper depends on it Created: 27/Mar/08 Updated: 19/Dec/16 Resolved: 04/Nov/15 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | core |
| Affects Version/s: | 3.5.4 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Magnolia International | Assignee: | Unassigned |
| Resolution: | Won't Do | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Template: |
|
| Acceptance criteria: |
Empty
|
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
| Date of First Response: |
| Description |
|
In the DefaultI18nContentSupport, we get/set the locale on the AggregationState. FreemarkerHelper determines the Locale based on the MgnlContext.getLocale(). As a consequence, emails sent with freemarker when no user is logged in are always sent with the anonymous' user's locale instead of whatever the current locale is, as determined by the I18nContentSupport. |
| Comments |
| Comment by Philipp Bracher [ 31/Mar/08 ] |
|
The problem comes from the fact that the FreemarkerHelper is used for rendering the admin GUI (tree, edit bars,..). In that case it is absolutely correct to use the current user's locale retrieved by MgnlContext. There is currently no solution to use the FreemarkerHelper with the content locale (the locale set on the aggregation state). We would have to introduce a new mechanism by providing a locale resolver or an optional parameter. Example: A German user is editing the English content will see the green bars in German but English content |
| Comment by Magnolia International [ 15/Apr/08 ] |
|
Another related issue - is that MessagesManager uses the system default locale - so if this has to be used in "public" code (i.e when publicuserregistration sends emails), it uses the "wrong" default locale (the system one instead of the content one or the anonymous') |
| Comment by Philipp Bracher [ 21/Apr/08 ] |
|
The MessageManager provides system messages only. So the the locale resolving follows this rule
To solve that we could introduce a getMessages(bundle) method in i18nContentSupport which uses the rules defined by the content support But there is no intelligence which can tell automatically what should be used (system or content locale resolving). How ever we 'fix' that we must ensure that it doesn't break the other mechanism. Otherwise we jitter from one to the other fix. |
| Comment by Magnolia International [ 21/Apr/08 ] |
|
absolutely - that is what i tried to point out - that in some places, the distinction between content locale and admin locale wasn't clear yet. As you mentioned in the first comment: maybe a LocaleResolver would help in sharing/reusing components like MM and FreemarkerHelper, which can both be used in both contexts. |
| Comment by Michael Mühlebach [ 04/Nov/15 ] |
|
Given the thousands of other issues we have open that are more highly requested, we won't be able to address this issue in the foreseeable future. Instead we will focus on issues with a higher impact, and more votes. |