Locales and Translation

Broadleaf Commerce Discussion Forum

Moderator: jocanas

RapidTransit
Intermediate
Intermediate
Posts: 79
Joined: Wed Feb 20, 2013 7:42 am

Locales and Translation

Postby RapidTransit » Thu Sep 25, 2014 7:26 pm

3.2 Snapshot
How do I stop my static resources from going through BroadleafCookieLocaleResolver?

I've tried, with no luck:

Code: Select all

<mvc:resources order="-10" location="/js/, classpath:/js/" mapping="/js/**" />


Why isn't this a join that gets eagerly loaded? In my setup getName() only gets invoked at the template layer. This was adding anywhere from 100-150ms per request. I originally thought it was my templating engine slowing down.

Code: Select all

    @Override
    public String getName() {
        if (name == null && hasDefaultSku()) {
            return lookupDefaultSku().getName();
        }
       
        return DynamicTranslationProvider.getValue(this, "name", name);
    }


And after trying X-Rebel, JProfiler, and Yourkit, only X-Rebel was able to easily track this down... and Yourkit was causing problems with the JpaTransformer and/or Spring Instrument in my setup. Something to keep in mind for anyone thinking of purchasing Yourkit.

phillipuniverse
Team Member
Team Member
Posts: 1563
Joined: Tue Dec 20, 2011 12:11 pm

Re: Locales and Translation

Postby phillipuniverse » Fri Sep 26, 2014 11:58 am

If you want to restrict the URLs that the BroadleafCookieLocaleResolver is active for, the easiest thing to do would be to extend the class and then override the component. The component is hooked up in applicationContext-servlet.xml.

For the translations, you could disable them gobally via the i18n.translation.enabled system property. This property is set by the TranslationRequestProcessor that you could also extend/override if you want to selectively disable translations per URL.

sami789
Newbie
Newbie
Posts: 1
Joined: Tue Nov 18, 2014 3:16 pm

Re: Locales and Translation

Postby sami789 » Tue Nov 18, 2014 3:16 pm

How do I stop my static resources from going through BroadleafCookieLocaleResolver?

phillipuniverse
Team Member
Team Member
Posts: 1563
Joined: Tue Dec 20, 2011 12:11 pm

Re: Locales and Translation

Postby phillipuniverse » Tue Nov 18, 2014 4:12 pm

@sami789: Simply remove it from applicationContext-servlet.xml

Durwin
Newbie
Newbie
Posts: 1
Joined: Mon Nov 02, 2015 5:37 am

Re: Locales and Translation

Postby Durwin » Mon Nov 02, 2015 5:40 am

Thanks for your suggestion. I really appreciate that you took all this time to try and help us. Keep up the good work. Keep on taking action.

dickswall
Newbie
Newbie
Posts: 1
Joined: Sun Jun 12, 2016 10:29 am

Re: Locales and Translation

Postby dickswall » Sun Jun 12, 2016 10:32 am

amazing article and facts that are cool and funny more interesting facts and fun facts


Return to “Broadleaf Commerce”

Who is online

Users browsing this forum: Bing [Bot] and 1 guest