Force language from a different locale

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Force language from a different locale

Eric DE MAULDE
Hi,

I would like to force default language into ecommerce application,
even if the browser is setted with another language and translations into the browser's language are available.

For example, my browser is setted with English language,
I want to display pages into French (by default, without change language)

Thanks


Eric
Reply | Threaded
Open this post in threaded view
|

Re: Force language from a different locale

Jacques Le Roux
Administrator
Hi Eric,

You will have to force the JVM using -Duser.language=en (there is also  -Duser.country=US for instance)
This was used for another reason in OFBiz before (actually a kind of Sun's bug)

Jacques

From: "Eric DE MAULDE" <[hidden email]>
Hi,

I would like to force default language into ecommerce application,
even if the browser is setted with another language and translations into the browser's language are available.

For example, my browser is setted with English language,
I want to display pages into French (by default, without change language)

Thanks


Eric

Reply | Threaded
Open this post in threaded view
|

Re: Force language from a different locale

Eric DE MAULDE
Hi Jacques,

Where can I type "-Duser.language=fr"
I tried into ${ofbiz dir}/rc.ofbiz

JAVA_VMOPTIONS="-Xms1024M -Xmx1024M -Duser.language=fr"

Always my ecommerce pages are in English with an English browser

Thanks

Eric

P.S. : my server is under Debian Etch, with the cron file
"rc.ofbiz.for.debian" ofbiz doesn't start when I boot my server.
When I restart ofbiz with this file, it works. With the file "rc.ofbiz" it
works in both case.

----- Original Message -----
From: "Jacques Le Roux" <[hidden email]>
To: <[hidden email]>
Sent: Friday, May 01, 2009 4:57 PM
Subject: Re: Force language from a different locale


> Hi Eric,
>
> You will have to force the JVM using -Duser.language=en (there is
> lso  -Duser.country=US for instance)
> This was used for another reason in OFBiz before (actually a kind of Sun's
> bug)
>
> Jacques
>
> From: "Eric DE MAULDE" <[hidden email]>
> Hi,
>
> I would like to force default language into ecommerce application,
> even if the browser is setted with another language and translations into
> the browser's language are available.
>
> For example, my browser is setted with English language,
> I want to display pages into French (by default, without change language)
>
> Thanks
>
>
> Eric
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Force language from a different locale

Adrian Crum-2

The command-line option won't work, because OFBiz sets the default locale when it starts up. The default locale is configured in start.properties.

-Adrian


--- On Sun, 5/3/09, Eric DE MAULDE <[hidden email]> wrote:

> From: Eric DE MAULDE <[hidden email]>
> Subject: Re: Force language from a different locale
> To: [hidden email], "Jacques Le Roux" <[hidden email]>
> Date: Sunday, May 3, 2009, 2:52 AM
> Hi Jacques,
>
> Where can I type "-Duser.language=fr"
> I tried into ${ofbiz dir}/rc.ofbiz
>
> JAVA_VMOPTIONS="-Xms1024M -Xmx1024M
> -Duser.language=fr"
>
> Always my ecommerce pages are in English with an English
> browser
>
> Thanks
>
> Eric
>
> P.S. : my server is under Debian Etch, with the cron file
> "rc.ofbiz.for.debian" ofbiz doesn't start when
> I boot my server.
> When I restart ofbiz with this file, it works. With the
> file "rc.ofbiz" it works in both case.
>
> ----- Original Message ----- From: "Jacques Le
> Roux" <[hidden email]>
> To: <[hidden email]>
> Sent: Friday, May 01, 2009 4:57 PM
> Subject: Re: Force language from a different locale
>
>
> > Hi Eric,
> >
> > You will have to force the JVM using
> -Duser.language=en (there is lso  -Duser.country=US for
> instance)
> > This was used for another reason in OFBiz before
> (actually a kind of Sun's bug)
> >
> > Jacques
> >
> > From: "Eric DE MAULDE"
> <[hidden email]>
> > Hi,
> >
> > I would like to force default language into ecommerce
> application,
> > even if the browser is setted with another language
> and translations into the browser's language are
> available.
> >
> > For example, my browser is setted with English
> language,
> > I want to display pages into French (by default,
> without change language)
> >
> > Thanks
> >
> >
> > Eric
> >
> >


     
Reply | Threaded
Open this post in threaded view
|

Re: Force language from a different locale

Jacques Le Roux
Administrator
Ha yes, this has changed!

Thanks Adrian

Jacques

From: "Adrian Crum" <[hidden email]>

>
> The command-line option won't work, because OFBiz sets the default locale when it starts up. The default locale is configured in
> start.properties.
>
> -Adrian
>
>
> --- On Sun, 5/3/09, Eric DE MAULDE <[hidden email]> wrote:
>
>> From: Eric DE MAULDE <[hidden email]>
>> Subject: Re: Force language from a different locale
>> To: [hidden email], "Jacques Le Roux" <[hidden email]>
>> Date: Sunday, May 3, 2009, 2:52 AM
>> Hi Jacques,
>>
>> Where can I type "-Duser.language=fr"
>> I tried into ${ofbiz dir}/rc.ofbiz
>>
>> JAVA_VMOPTIONS="-Xms1024M -Xmx1024M
>> -Duser.language=fr"
>>
>> Always my ecommerce pages are in English with an English
>> browser
>>
>> Thanks
>>
>> Eric
>>
>> P.S. : my server is under Debian Etch, with the cron file
>> "rc.ofbiz.for.debian" ofbiz doesn't start when
>> I boot my server.
>> When I restart ofbiz with this file, it works. With the
>> file "rc.ofbiz" it works in both case.
>>
>> ----- Original Message ----- From: "Jacques Le
>> Roux" <[hidden email]>
>> To: <[hidden email]>
>> Sent: Friday, May 01, 2009 4:57 PM
>> Subject: Re: Force language from a different locale
>>
>>
>> > Hi Eric,
>> >
>> > You will have to force the JVM using
>> -Duser.language=en (there is lso  -Duser.country=US for
>> instance)
>> > This was used for another reason in OFBiz before
>> (actually a kind of Sun's bug)
>> >
>> > Jacques
>> >
>> > From: "Eric DE MAULDE"
>> <[hidden email]>
>> > Hi,
>> >
>> > I would like to force default language into ecommerce
>> application,
>> > even if the browser is setted with another language
>> and translations into the browser's language are
>> available.
>> >
>> > For example, my browser is setted with English
>> language,
>> > I want to display pages into French (by default,
>> without change language)
>> >
>> > Thanks
>> >
>> >
>> > Eric
>> >
>> >
>
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Force language from a different locale

Eric DE MAULDE
In reply to this post by Adrian Crum-2
Hi Adrian,

I've configured start.properties with :

ofbiz.locale.default=fr

Always I have the same problem !
Do you have another idea ?

Thanks

Eric

----- Original Message -----
From: "Adrian Crum" <[hidden email]>
To: <[hidden email]>
Sent: Sunday, May 03, 2009 12:03 PM
Subject: Re: Force language from a different locale


>
> The command-line option won't work, because OFBiz sets the default locale
> when it starts up. The default locale is configured in start.properties.
>
> -Adrian
>
>
> --- On Sun, 5/3/09, Eric DE MAULDE <[hidden email]> wrote:
>
>> From: Eric DE MAULDE <[hidden email]>
>> Subject: Re: Force language from a different locale
>> To: [hidden email], "Jacques Le Roux"
>> <[hidden email]>
>> Date: Sunday, May 3, 2009, 2:52 AM
>> Hi Jacques,
>>
>> Where can I type "-Duser.language=fr"
>> I tried into ${ofbiz dir}/rc.ofbiz
>>
>> JAVA_VMOPTIONS="-Xms1024M -Xmx1024M
>> -Duser.language=fr"
>>
>> Always my ecommerce pages are in English with an English
>> browser
>>
>> Thanks
>>
>> Eric
>>
>> P.S. : my server is under Debian Etch, with the cron file
>> "rc.ofbiz.for.debian" ofbiz doesn't start when
>> I boot my server.
>> When I restart ofbiz with this file, it works. With the
>> file "rc.ofbiz" it works in both case.
>>
>> ----- Original Message ----- From: "Jacques Le
>> Roux" <[hidden email]>
>> To: <[hidden email]>
>> Sent: Friday, May 01, 2009 4:57 PM
>> Subject: Re: Force language from a different locale
>>
>>
>> > Hi Eric,
>> >
>> > You will have to force the JVM using
>> -Duser.language=en (there is lso  -Duser.country=US for
>> instance)
>> > This was used for another reason in OFBiz before
>> (actually a kind of Sun's bug)
>> >
>> > Jacques
>> >
>> > From: "Eric DE MAULDE"
>> <[hidden email]>
>> > Hi,
>> >
>> > I would like to force default language into ecommerce
>> application,
>> > even if the browser is setted with another language
>> and translations into the browser's language are
>> available.
>> >
>> > For example, my browser is setted with English
>> language,
>> > I want to display pages into French (by default,
>> without change language)
>> >
>> > Thanks
>> >
>> >
>> > Eric
>> >
>> >
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Force language from a different locale

Jacques Le Roux
Administrator
Hi Eric,

Did you check also in general.properties ?
locale.properties.fallback
locales.available

Jacques

From: "Eric DE MAULDE" <[hidden email]>

> Hi Adrian,
>
> I've configured start.properties with :
>
> ofbiz.locale.default=fr
>
> Always I have the same problem !
> Do you have another idea ?
>
> Thanks
>
> Eric
>
> ----- Original Message -----
> From: "Adrian Crum" <[hidden email]>
> To: <[hidden email]>
> Sent: Sunday, May 03, 2009 12:03 PM
> Subject: Re: Force language from a different locale
>
>
>>
>> The command-line option won't work, because OFBiz sets the default locale
>> when it starts up. The default locale is configured in start.properties.
>>
>> -Adrian
>>
>>
>> --- On Sun, 5/3/09, Eric DE MAULDE <[hidden email]> wrote:
>>
>>> From: Eric DE MAULDE <[hidden email]>
>>> Subject: Re: Force language from a different locale
>>> To: [hidden email], "Jacques Le Roux"
>>> <[hidden email]>
>>> Date: Sunday, May 3, 2009, 2:52 AM
>>> Hi Jacques,
>>>
>>> Where can I type "-Duser.language=fr"
>>> I tried into ${ofbiz dir}/rc.ofbiz
>>>
>>> JAVA_VMOPTIONS="-Xms1024M -Xmx1024M
>>> -Duser.language=fr"
>>>
>>> Always my ecommerce pages are in English with an English
>>> browser
>>>
>>> Thanks
>>>
>>> Eric
>>>
>>> P.S. : my server is under Debian Etch, with the cron file
>>> "rc.ofbiz.for.debian" ofbiz doesn't start when
>>> I boot my server.
>>> When I restart ofbiz with this file, it works. With the
>>> file "rc.ofbiz" it works in both case.
>>>
>>> ----- Original Message ----- From: "Jacques Le
>>> Roux" <[hidden email]>
>>> To: <[hidden email]>
>>> Sent: Friday, May 01, 2009 4:57 PM
>>> Subject: Re: Force language from a different locale
>>>
>>>
>>> > Hi Eric,
>>> >
>>> > You will have to force the JVM using
>>> -Duser.language=en (there is lso  -Duser.country=US for
>>> instance)
>>> > This was used for another reason in OFBiz before
>>> (actually a kind of Sun's bug)
>>> >
>>> > Jacques
>>> >
>>> > From: "Eric DE MAULDE"
>>> <[hidden email]>
>>> > Hi,
>>> >
>>> > I would like to force default language into ecommerce
>>> application,
>>> > even if the browser is setted with another language
>>> and translations into the browser's language are
>>> available.
>>> >
>>> > For example, my browser is setted with English
>>> language,
>>> > I want to display pages into French (by default,
>>> without change language)
>>> >
>>> > Thanks
>>> >
>>> >
>>> > Eric
>>> >
>>> >
>>
>>
>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Force language from a different locale

Wei Zhang
In reply to this post by Eric DE MAULDE
I think you have to change getLocale() function in OFBIZ_HOME\framework\base\src\org\ofbiz\base\util\UtilHttp.java(in trunk) and hard code the locale, see below

    public static Locale getLocale(HttpServletRequest request, HttpSession session, Object appDefaultLocale) {
        // check session first, should override all if anything set there
        Object localeObject = session != null ? session.getAttribute("locale") : null;

        // next see if the userLogin has a value
        if (localeObject == null) {
            Map<?, ?> userLogin = (Map<?, ?>) session.getAttribute("userLogin");
            if (userLogin == null) {
                userLogin = (Map<?,?>) session.getAttribute("autoUserLogin");
            }

            if (userLogin != null) {
                localeObject = userLogin.get("lastLocale");
            }
        }

        // no user locale? before global default try appDefaultLocale if specified
        if (localeObject == null && !UtilValidate.isEmpty(appDefaultLocale)) {
            localeObject = appDefaultLocale;
        }

        // finally request (w/ a fall back to default)
        if (localeObject == null) {
            localeObject = request != null ? request.getLocale() : null;
        }

        localeObject="zh_CN";

        return UtilMisc.ensureLocale(localeObject);
    }


程序羊