[MAGNOLIA-6316] Provide templating functions to i18nize links Created: 13/Jul/15  Updated: 15/Apr/16  Resolved: 22/Jul/15

Status: Closed
Project: Magnolia
Component/s: templating
Affects Version/s: None
Fix Version/s: 5.4.1

Type: New Feature Priority: Neutral
Reporter: Philip Mundt Assignee: Philip Mundt
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 1h
Time Spent: 1.25d
Original Estimate: 3h

Issue Links:
dependency
depends upon MGNLSITE-22 Resolve i18nContentSupport from sites... Closed
is depended upon by MGNLDEMO-67 When I browse the demo I can switch t... Closed
relation
is related to MAGNOLIA-6181 Expose i18n functionality via context... Closed
Template:
Acceptance criteria:
Empty
Release notes required:
Yes
Date of First Response:
Sprint: Sprint 2 (Basel)
Story Points: 1

 Description   

Pre 5.4 work was done on i18n templating functions. These would be a good addition to MTE and would actually provide the solution for MGNLDEMO-67.

Instead of exposing the info.magnolia.cms.i18n.I18nContentSupport in the info.magnolia.templating.functions.TemplatingFunctions we're only going to provide a method to return a list of localized links, e.g. /travel.html:

"en": "/travel.html"
"de_CH": "/de_CH/travel.html"

Known limitations

Travel demo makes heavy use of URI2RepositoryMapping in combination with VirtualURIMapping for tour links. These use forwards and currently cannot be i18nized.



 Comments   
Comment by Federico Grilli [ 22/Jul/15 ]

Looks good, the only thing I would change is the label to be displayed to the user. Currently it is
obtained with locale.toString() (at TemplatingFunctions.localizedLinks(..) method) whereas I'd use locale.getDisplayName() to show a human readable version of the locale. E.g. on my system with English settings, if the locale is

Locale locale = Locale.CANADA_FRENCH;
I get

System.out.println(locale.toString()); // fr_CA
System.out.println(locale.getDisplayName()); // French (Canada)
System.out.println(locale.getDisplayName(Locale.GERMAN)); //(simulating a different system language settings) Französisch (Kanada)

I guess this change would likely entail an adjustment in the navigation.ftl template but I'm not completely sure about it

Comment by Federico Grilli [ 22/Jul/15 ]

For the release notes/documentation: please add the new functions to https://documentation.magnolia-cms.com/display/DOCS/cmsfn

Comment by Philip Mundt [ 22/Jul/15 ]

Decided to stay with this approach and rather provide beautifications in the actual travel-demo (see MGNLDEMO-67).

Generated at Mon Feb 12 04:13:21 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.