You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by "Dan Haywood (JIRA)" <ji...@apache.org> on 2014/09/30 08:03:33 UTC

[jira] [Commented] (ISIS-903) Improve i18n support (in NamedFacetDecorator etc) to honour client-side locale.

    [ https://issues.apache.org/jira/browse/ISIS-903?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14152834#comment-14152834 ] 

Dan Haywood commented on ISIS-903:
----------------------------------

some notes on how to go about doing this ticket:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

the first thing to do is to create a fork of our github repo [1], and then make sure you can build Isis locally from this [2].

Then, set up the todo app (in examples/application/todoapp) to run from your IDE... it's a useful playground.

In the todoapp's WEB-INF/isis.properties you should see that there is the line:

isis.reflector.facet-decorators=org.apache.isis.core.metamodel.facetdecorator.i18n.resourcebundle.I18nDecoratorUsingResourceBundleInstaller

Set a breakpoint in I18nDecoratorUsingResourceBundleInstaller and then watch what it does: basically it's a factory that returns a NamedFacet (or DescribedAsFacet or HelpFacet) that decorates/wraps the original facet.  Facets are the bits of metadata that we associate with the classes and class members.

What you then could do is to copy I18nDecoratorUsingResourceBundleInstaller and related classes (eg NamedFacetWrapI18n), and then configure your copy in isis.properties.

The main bit of the puzzle is to get hold of the locale.  This will need to be in your (copy of) NamedFacetWrapI18n, so that it gets hold of the locale of the current user (eg using AuthenticatedWebSessionForIsis.get().getLocale() or similar) and uses that to lookup the correct resource bundle.

[1] https://github.com/apache/isis
[2] http://isis.apache.org/contributors/building-isis.html


> Improve i18n support (in NamedFacetDecorator etc) to honour client-side locale.
> -------------------------------------------------------------------------------
>
>                 Key: ISIS-903
>                 URL: https://issues.apache.org/jira/browse/ISIS-903
>             Project: Isis
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: core-1.6.0
>            Reporter: Dan Haywood
>            Assignee: Dan Haywood
>            Priority: Minor
>             Fix For: core-1.8.0
>
>
> from the mailing list: http://markmail.org/message/wifsrte2p2q6tces
> ok, here's the scoop.
> It *is* possible to add i18n for Isis apps, but the implementation we have reflects the locale of the server, rather than the client. 
> If client-side i18n is what you require then it ought to be possible to implement a different implementation of I18nFacetDecoratorInstaller.  You can get hold of the user's locale using:
> AuthenticatedWebSessionForIsis.get().getLocale()



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)