default language

classic Classic list List threaded Threaded
6 messages Options
blr
Reply | Threaded
Open this post in threaded view
|

default language

blr
This post was updated on .
Hi,

I run "Good Thymes Virtual Grocery" Example Application.
I throw an exception  with a message "Resolved message cannot be null".
After an hour, i found the solution.
I am a french and there is not home_fr.properties and logo isn't defined in home.properties.
With home_fr.properties, it's good.

- Does not have default language ? for example english ?

- or use the header of request with Accept-Language
   For me, it is fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3

- or a clear message : "logo" is not found in properties file

For example application, perharps, can you put all messages in home.properties because the first impression is bad when example application doesn't run.

Do you want the french version for this example application ?

thanks,
Blr
Reply | Threaded
Open this post in threaded view
|

Re: default language

danielfernandez
Administrator
Hi,

There seems to be a small bug in message resolution that provokes that exception you see when an internationalization message is not found. I'm working to fix it now for 1.1.2.

Also, the home.properties file in the example GTVG application does not contain all the keys it should, as you say. I will also fix that. "home.properties" is in fact the place where messages will be looked for if not found in the specific language of your choice (French, in this case).

And as for the translations for French... would the welcome message be something like "Bienvenue à nôtre épicerie"? My French is not exactly brilliant...

Regards,
Daniel.
blr
Reply | Threaded
Open this post in threaded view
|

Re: default language

blr
your french is good except one letter :
Bienvenue à notre épicerie

thanks for your answer

Blr
 
Reply | Threaded
Open this post in threaded view
|

Re: default language

danielfernandez
Administrator
Thanks. Seems that I used the pronoun instead of the article :-).

I've just uploaded a new snapshot version (1.1.2-SNAPSHOT) fixing this problem (see http://www.thymeleaf.org/faq.html#use-snapshot). Also, I've modified the GTVG application on the SVN trunk so that it now includes French, Portuguese, German and Dutch messages for its home page.

These fixes will go into 1.1.2.

Regards,
Daniel.
blr
Reply | Threaded
Open this post in threaded view
|

Re: default language

blr
ok thanks,

how is the language parameter chosen ?
Can i choose in force this parameter ?

Blr
Reply | Threaded
Open this post in threaded view
|

Re: default language

danielfernandez
Administrator

Hi,

The locale is retrieved from context object used for executing your templates. The context is an implementation of the IContext interface, as you can read from the "Using Thymeleaf" Tutorial.

How this context is created depends on your application. The GTVG example application, for example, which doesn't use Spring MVC, retrieves this locale from the request with:

WebContext ctx = new WebContext(request, request.getLocale());

...but Spring MVC applications will retrieve the locale automatically from Spring's infrastructure (and it will be Spring MVC who will be in charge of defining the current locale to be applied).

Regards,
Daniel.