August 26, 2003

resourceBundleCFC

i've been using resourceBundles in one form or another for some time now. while my idea of resourceBundles is not always confined to file based resources, i have had a UDF--now CFC--resourceBundle file function for a time now. mainly because getProfileString's never properly handled unicode--cf really needs a native resourceBundle-like function. on the off chance somebody's wondering, a resourceBundle is a file holding text label key/value pairs seperated into locale files--the reason for this is to completely seperate text from code and text presentation. for instance: testMsg_th_TH.properties (thai locale) contains welcomeMSG=สวัสดีคะ while testMsg_en_US.properties (american locale) contains welcomeMSG=Well hello there. the application would determine which locale was required (session or application based depending on how you rolled out your application) and then load the relevant resourceBundle. the welcomeMsg text label would then show up in the proper language. simple, easy, scalable. in any case, i've put the resource file CFC in the devnet gallery (should be available sooner or later). you can see an example and download it here if you're in a hurry to trash it. again wandering off-topic, i've been trying to make use of native java resourceBundle (getBundle, etc.) functionality with cf, no dice so far. getBundle never seems able to find the resourceBundle. no idea if this would function any better than the way i'm doing it now but i' sure like to find out. any ideas?

0 Comments:

Post a Comment

<< Home