/** * Enables/disables localized template lookup. Enabled by default. * * <p> * With the default {@link TemplateLookupStrategy}, localized lookup works like this: Let's say your locale setting * is {@code Locale("en", "AU")}, and you call {@link Configuration#getTemplate(String) cfg.getTemplate("foo.ftl")}. * Then FreeMarker will look for the template under these names, stopping at the first that exists: * {@code "foo_en_AU.ftl"}, {@code "foo_en.ftl"}, {@code "foo.ftl"}. See the description of the default value at * {@link #setTemplateLookupStrategy(TemplateLookupStrategy)} for a more details. If you need to generate different * template names, use {@link #setTemplateLookupStrategy(TemplateLookupStrategy)} with your custom * {@link TemplateLookupStrategy}. * * <p>Note that changing the value of this setting causes the template cache to be emptied so that old lookup * results won't be reused (since 2.3.22). * * <p> * Historical note: Despite what the API documentation said earlier, this method is <em>not</em> thread-safe. While * setting it can't cause any serious problems, and in fact it works well on most hardware, it's not guaranteed that * FreeMarker will see the update in all threads. */ public void setLocalizedLookup(boolean localizedLookup) { this.localizedLookup = localizedLookup; cache.setLocalizedLookup(localizedLookup); }
private void recreateTemplateCacheWith( TemplateLoader loader, CacheStorage storage, TemplateLookupStrategy templateLookupStrategy, TemplateNameFormat templateNameFormat, TemplateConfigurationFactory templateConfigurations) { TemplateCache oldCache = cache; cache = new TemplateCache( loader, storage, templateLookupStrategy, templateNameFormat, templateConfigurations, this); cache.clear(); // for fully BC behavior cache.setDelay(oldCache.getDelay()); cache.setLocalizedLookup(localizedLookup); }
/** * Enables/disables localized template lookup. Enabled by default. * This method is thread-safe and can be called while the engine works. */ public void setLocalizedLookup(boolean localizedLookup) { this.localizedLookup = localizedLookup; cache.setLocalizedLookup(localizedLookup); }
/** * Enables/disables localized template lookup. Enabled by default. * * <p> * With the default {@link TemplateLookupStrategy}, localized lookup works like this: Let's say your locale setting * is {@code Locale("en", "AU")}, and you call {@link Configuration#getTemplate(String) cfg.getTemplate("foo.ftl")}. * Then FreeMarker will look for the template under these names, stopping at the first that exists: * {@code "foo_en_AU.ftl"}, {@code "foo_en.ftl"}, {@code "foo.ftl"}. See the description of the default value at * {@link #setTemplateLookupStrategy(TemplateLookupStrategy)} for a more details. If you need to generate different * template names, use {@link #setTemplateLookupStrategy(TemplateLookupStrategy)} with your custom * {@link TemplateLookupStrategy}. * * <p>Note that changing the value of this setting causes the template cache to be emptied so that old lookup * results won't be reused (since 2.3.22). * * <p> * Historical note: Despite what the API documentation said earlier, this method is <em>not</em> thread-safe. While * setting it can't cause any serious problems, and in fact it works well on most hardware, it's not guaranteed that * FreeMarker will see the update in all threads. */ public void setLocalizedLookup(boolean localizedLookup) { this.localizedLookup = localizedLookup; cache.setLocalizedLookup(localizedLookup); }
/** * Enables/disables localized template lookup. Enabled by default. * * <p> * With the default {@link TemplateLookupStrategy}, localized lookup works like this: Let's say your locale setting * is {@code Locale("en", "AU")}, and you call {@link Configuration#getTemplate(String) cfg.getTemplate("foo.ftl")}. * Then FreeMarker will look for the template under these names, stopping at the first that exists: * {@code "foo_en_AU.ftl"}, {@code "foo_en.ftl"}, {@code "foo.ftl"}. See the description of the default value at * {@link #setTemplateLookupStrategy(TemplateLookupStrategy)} for a more details. If you need to generate different * template names, use {@link #setTemplateLookupStrategy(TemplateLookupStrategy)} with your custom * {@link TemplateLookupStrategy}. * * <p>Note that changing the value of this setting causes the template cache to be emptied so that old lookup * results won't be reused (since 2.3.22). * * <p> * Historical note: Despite what the API documentation said earlier, this method is <em>not</em> thread-safe. While * setting it can't cause any serious problems, and in fact it works well on most hardware, it's not guaranteed that * FreeMarker will see the update in all threads. */ public void setLocalizedLookup(boolean localizedLookup) { this.localizedLookup = localizedLookup; cache.setLocalizedLookup(localizedLookup); }
private void recreateTemplateCacheWith( TemplateLoader loader, CacheStorage storage, TemplateLookupStrategy templateLookupStrategy, TemplateNameFormat templateNameFormat, TemplateConfigurationFactory templateConfigurations) { TemplateCache oldCache = cache; cache = new TemplateCache( loader, storage, templateLookupStrategy, templateNameFormat, templateConfigurations, this); cache.clear(); // for fully BC behavior cache.setDelay(oldCache.getDelay()); cache.setLocalizedLookup(localizedLookup); }
private void createTemplateCache(TemplateLoader loader, CacheStorage storage) { TemplateCache oldCache = cache; cache = new TemplateCache(loader, storage); cache.setDelay(oldCache.getDelay()); cache.setConfiguration(this); cache.setLocalizedLookup(localizedLookup); } /**
private void recreateTemplateCacheWith( TemplateLoader loader, CacheStorage storage, TemplateLookupStrategy templateLookupStrategy, TemplateNameFormat templateNameFormat, TemplateConfigurationFactory templateConfigurations) { TemplateCache oldCache = cache; cache = new TemplateCache( loader, storage, templateLookupStrategy, templateNameFormat, templateConfigurations, this); cache.clear(); // for fully BC behavior cache.setDelay(oldCache.getDelay()); cache.setLocalizedLookup(localizedLookup); }