Hi Cuneyt,

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.

Let me know if you need more guidance,

Cheers
Dan






On 25 September 2014 21:48, Cuneyt Ozen <[email protected]> wrote:

> Hi Dan,
>
> I'd like to give it a shot If you can provide me some guidance.
>
> Cuneyt
>
> On Thu, Sep 25, 2014 at 4:02 PM, Dan Haywood <[email protected]
> >
> wrote:
>
> > I've raised a ticket ISIS-903 for this [1]
> >
> >
> > [1] https://issues.apache.org/jira/browse/ISIS-903
> >
> > On 20 September 2014 18:20, Dan Haywood <[email protected]>
> > wrote:
> >
> > > Hi Cuneyt,
> > >
> > > 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. This may or
> > may
> > > not be what you want.  If it isn't (that is, if you want i18n for the
> > > calling client), then some custom coding will be required... nothing
> too
> > > difficult, though it's probably that the core framework should probably
> > > support out-of-the-bx.
> > >
> > > But, if server-side i18n is what you need, then we have the
> > > I18nFacetDecoratorInstaller which is enabled by default in
> > isis.properties
> > > [1].  Then create a resource bundle in the root package, for
> > > i18n_en.properties.  This can hold the "name" (=@Named) and
> "description"
> > > (=@DescribedAs) facets; see for example this commit [2].
> > >
> > > 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()
> > >
> > > HTH
> > > Dan
> > >
> > >
> > > [1]
> > >
> >
> https://github.com/danhaywood/isis-i18napp/blob/56eaa9c940e00090a227a37863ca31d797bc3398/webapp/src/main/webapp/WEB-INF/isis.properties#L140
> > > [2]
> > >
> >
> https://github.com/danhaywood/isis-i18napp/commit/ce1421376b461d436c3e9d7c9ffc9d9b32e836ae
> > >
> > >
> > >
> > > On 20 September 2014 16:52, Cuneyt Ozen <[email protected]> wrote:
> > >
> > >> I am all eyes and ears Dan :)
> > >>
> > >> On Sat, Sep 20, 2014 at 10:34 AM, Dan Haywood <
> > >> [email protected]>
> > >> wrote:
> > >>
> > >> > Hi Cuneyt,
> > >> > welcome to the mailing list
> > >> >
> > >> > I'm just working on an example, will upload it to github shortly.
> > >> >
> > >> > Watch this space...
> > >> >
> > >> > Cheers
> > >> > Dan
> > >> >
> > >> >
> > >> > On 18 September 2014 22:30, Cuneyt Ozen <[email protected]> wrote:
> > >> >
> > >> > > Hi All,
> > >> > >
> > >> > > I have seen the following note below on documentation titled "*How
> > to
> > >> > > specify a name and/or description for an object*".
> > >> > > So what is the seperate mechanism for deailing with
> > >> internationalisation?
> > >> > >
> > >> > > *"Note*
> > >> > >
> > >> > > There is an entirely separate mechanism for dealing with
> > >> > > Internationalisation (to document... ask on mailing list...)"
> > >> > >
> > >> >
> > >>
> > >
> > >
> >
>

Reply via email to