Page 1 of 1

Locales and Translation

Posted: Thu Sep 25, 2014 7:26 pm
by RapidTransit
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.

Re: Locales and Translation

Posted: Fri Sep 26, 2014 11:58 am
by phillipuniverse
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.

Re: Locales and Translation

Posted: Tue Nov 18, 2014 3:16 pm
by sami789
How do I stop my static resources from going through BroadleafCookieLocaleResolver?

Re: Locales and Translation

Posted: Tue Nov 18, 2014 4:12 pm
by phillipuniverse
@sami789: Simply remove it from applicationContext-servlet.xml