August 08, 2005

i18n calendars updated

i've updated the i18nCalendars CFCs to include the new coptic and ethiopic calendars added to icu4j 3.4. and that makes a total of nine calendars. i don't imagine having any use for either of these calendars right now but given the recent focus on africa and ethiopia in particular, you never know. if you're interested in using icu4j's new AcceptLanguage method, you'll need to wrapper it. this method makes use of an 'out-parameter' method to return a boolean as to whether the method used a fallback locale (ie. it couldn't find a suitable locale among the server's installed locales, so it returns a fallback locale instead). coldfusion won't pick up on that returned boolean array. below find some java code for this (it returns a structure with the selected locale and whether or not it was a fallback locale):
import java.util.*;

public class ULocaleAcceptLanguage {
   class:      ULocaleAcceptLanguage
   version:   15-jul-2005
   author:      Paul Hastings
   notes:      simple wrapper class for ICU4J acceptLanguage

   public final static HashMap getULocale(String httpAcceptLanguage){
      HashMap results = new HashMap();
      boolean[] fallback = new boolean[1];
      ULocale thisLocale = ULocale.acceptLanguage(httpAcceptLanguage,fallback);
      Boolean fallB= new Boolean(fallback[0]);
      return results;      
compile this and drop it in your cfinstall classes dir. you can then make use of it:

<cfdump var="#uL#">


Post a Comment

<< Home