freemarker-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Denis Bredelet <brede...@mac.com>
Subject Re: [FM3] Solving FM2 caching problems due to locale etc.
Date Sun, 26 Mar 2017 07:36:17 GMT
Hi,

>> Template.process(...) would be removed, as it's not the duty of the
>> Template to create the Environment anymore.
>> 
>> On the level of the more expert Environment API, this translates to
>> something like this:
>> 
>>    Environment env = new Environment(cfg, dataModel, out);
>>    env.setLocale(aLocale);
>>    env.setCustomLookupCondition(aLookupCondition);
>>    ... // Addjust env further
>>    env.loadMainTemplate(name); // After setting locale and customLookupCond!
>>    env.process();
>>    ... // Get back variables from env if you want
> This looks a lot clearer and more intuitive to me!
> 

The last two lines do not seem intuitive for me. What do they do?

— Denis.

>> 
>> You might notice that Environment now stores the
>> customLookupCondition, while in FM2 the Template stores it. Any
>> template loading from the Environment will happen with that condition
>> (and with env.locale, just as in FM2). In FM2 the
>> customLookupCondition is inherited from the Template that contains the
>> #import/#include statement, but if you think about it, the end results
>> is practically the same.
> Yeah, it's really cool concepts now. Very exciting!!
> 
> Cheers,
> 
> Woonsan


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message