Florian Motteau created FREEMARKER-208:
------------------------------------------

             Summary: Allow to provide a specific locale for lower_case / 
upper_case
                 Key: FREEMARKER-208
                 URL: https://issues.apache.org/jira/browse/FREEMARKER-208
             Project: Apache Freemarker
          Issue Type: Improvement
            Reporter: Florian Motteau


lower_case and upper_case filters rely on toLowerCase / toUpperCase methods. 
They use the current environment locale as first and only parameter for these 
methods.

[https://github.com/apache/freemarker/blob/201533eb7c15e3cfc55b38da37f730a3492bec0f/src/main/java/freemarker/core/BuiltInsForStringsBasic.java#L433]

In rare cases, we might want to provide a specific/fixed locale, to avoid some 
weird problems, such as the Turkish/Azeri dotless i problem :
{code:java}
// lowercasing an uppercase i, using turkish locale
System.out.println("I".toLowerCase(new Locale("tr", "TR")));{code}
...will output "ı" (which is a dotless "i").

We faced this problem in OFBiz 
(https://issues.apache.org/jira/browse/OFBIZ-12660), and although we can fix 
this for our specific use case, it may be a good idea to be able to pass a 
locale (which sould defaults to the environment locale if not provided) as 
parameter for lower_case and upper_case :
{code:java}
myVar?lower_case("en", "EN") {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to