You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Jacques Le Roux <ja...@les7arts.com> on 2020/08/09 10:01:42 UTC

ofbiz.locale.default in start.properties

Hi,

While explaining to a customer how the default language is picked, I stumbled upon ofbiz.locale.default in start.properties.

I still remember the old days where you had to set the user.language system property manually from CLI when launching OFBiz to set the default language.

This is no longer true for a while. The language used by default is taken from the browser*:

This is done by UtilHttp::getLocale which ultimately uses:

    Locale javax.servlet.ServletRequest.getLocale()

    Returns the preferred Locale that the client will accept content in, based on the Accept-Language header.
    If the client request doesn't provide an Accept-Language header, this method returns the default locale for the server.
    Returns: the preferred Locale for the client

We also use initialLocaleComplete in the screens for JavaScript part.

I see no reasons to keep ofbiz.locale.default in start.properties and the related Config::getDefaultLocale
Also locale.properties.fallback in general.properties have no effects.

If you want to give a try: I use French by default, if I set ofbiz.locale.default=de_DE and locale.properties.fallback=ar: no effects**. I still have 
French labels showing.

I thought about removing them for clarity sake. But the point ** below makes me rather think that we should simply change the properties 
documentation. I'll do so in a week if nobody see a better solution

Also it should be noted that you can force the language by store using the Default Locale String, eg [1]. THis is only for frontends (ecommerce, 
webpos, etc.)

I hope this will useful for everybody, it was not quite clear to me :)

Jacques

* If no one has forced the value using the changing language feature, done by setSessionLocale which also sets lastLocale to remind.
** Apart things like this due to jobs pending that run before any UI interactions. There are most often because of demo data:
2020-08-09 11:13:49,349 |OFBiz-JobQueue-0     |UtilProperties                |I| ResourceBundle ServiceErrorUiLabels (de_DE) created in 0.048s with 6 
properties
2020-08-09 11:13:49,349 |OFBiz-JobQueue-0 |UtilProperties                |W| ServicePermissionErrorDefinitionProblem is missing in 
ServiceErrorUiLabels for locale de_DE
2020-08-09 11:13:49,349 |OFBiz-JobQueue-0 |ServiceUtil                   |E| {errorMessage=ServicePermissionErrorDefinitionProblem, responseMessage=error}
2020-08-09 11:13:49,349 |OFBiz-JobQueue-0 |UtilProperties                |W| ServicePermissionError is missing in ServiceErrorUiLabels for locale de_DE
2020-08-09 11:13:49,349 |OFBiz-JobQueue-0 |ServiceDispatcher             |T| [[Sync service failed...- total:0.0,since last(Begin):0.0]] - 'default / 
createMaintsFromTimeInterval'
2020-08-09 11:13:49,350 |OFBiz-JobQueue-0 |TransactionUtil               |W| Transaction rollback only not set, status is STATUS_NO_TRANSACTION
2020-08-09 11:13:49,351 |OFBiz-JobQueue-0 |GenericServiceJob             |E| Async-Service failed.

https://demo-trunk.ofbiz.apache.org/catalog/control/EditProductStore?productStoreId=9000 (Localization block)

Re: ofbiz.locale.default in start.properties

Posted by Jacques Le Roux <ja...@les7arts.com>.
Done

Le 09/08/2020 à 12:01, Jacques Le Roux a écrit :
> Hi,
>
> While explaining to a customer how the default language is picked, I stumbled upon ofbiz.locale.default in start.properties.
>
> I still remember the old days where you had to set the user.language system property manually from CLI when launching OFBiz to set the default 
> language.
>
> This is no longer true for a while. The language used by default is taken from the browser*:
>
> This is done by UtilHttp::getLocale which ultimately uses:
>
>    Locale javax.servlet.ServletRequest.getLocale()
>
>    Returns the preferred Locale that the client will accept content in, based on the Accept-Language header.
>    If the client request doesn't provide an Accept-Language header, this method returns the default locale for the server.
>    Returns: the preferred Locale for the client
>
> We also use initialLocaleComplete in the screens for JavaScript part.
>
> I see no reasons to keep ofbiz.locale.default in start.properties and the related Config::getDefaultLocale
> Also locale.properties.fallback in general.properties have no effects.
>
> If you want to give a try: I use French by default, if I set ofbiz.locale.default=de_DE and locale.properties.fallback=ar: no effects**. I still 
> have French labels showing.
>
> I thought about removing them for clarity sake. But the point ** below makes me rather think that we should simply change the properties 
> documentation. I'll do so in a week if nobody see a better solution
>
> Also it should be noted that you can force the language by store using the Default Locale String, eg [1]. THis is only for frontends (ecommerce, 
> webpos, etc.)
>
> I hope this will useful for everybody, it was not quite clear to me :)
>
> Jacques
>
> * If no one has forced the value using the changing language feature, done by setSessionLocale which also sets lastLocale to remind.
> ** Apart things like this due to jobs pending that run before any UI interactions. There are most often because of demo data:
> 2020-08-09 11:13:49,349 |OFBiz-JobQueue-0 |UtilProperties                |I| ResourceBundle ServiceErrorUiLabels (de_DE) created in 0.048s with 6 
> properties
> 2020-08-09 11:13:49,349 |OFBiz-JobQueue-0 |UtilProperties                |W| ServicePermissionErrorDefinitionProblem is missing in 
> ServiceErrorUiLabels for locale de_DE
> 2020-08-09 11:13:49,349 |OFBiz-JobQueue-0 |ServiceUtil                   |E| {errorMessage=ServicePermissionErrorDefinitionProblem, 
> responseMessage=error}
> 2020-08-09 11:13:49,349 |OFBiz-JobQueue-0 |UtilProperties                |W| ServicePermissionError is missing in ServiceErrorUiLabels for locale de_DE
> 2020-08-09 11:13:49,349 |OFBiz-JobQueue-0 |ServiceDispatcher             |T| [[Sync service failed...- total:0.0,since last(Begin):0.0]] - 'default 
> / createMaintsFromTimeInterval'
> 2020-08-09 11:13:49,350 |OFBiz-JobQueue-0 |TransactionUtil               |W| Transaction rollback only not set, status is STATUS_NO_TRANSACTION
> 2020-08-09 11:13:49,351 |OFBiz-JobQueue-0 |GenericServiceJob             |E| Async-Service failed.
>
> https://demo-trunk.ofbiz.apache.org/catalog/control/EditProductStore?productStoreId=9000 (Localization block)