Internationalized in CFMX
Jul 27
Folks,.. As you know, getprofilestring doesn't support unicode format. That's why we don't have to create our projects for multi-language. Because, I'm doing project for Vietnamese, which is unicode format. That's why I need to solve this problem. I stuck on this solution for 5 hours. Finally, I gotcha..!!
You can use my coding, but please don't forget to credit to me.
udf_Translate.cfm
2function udf_Translate(Name, Filename) {
3infile = FileOpen(Filename, "read", "UTF-8");
4i = 0;
5flag = 0;
6while (! FileIsEOF(infile)) {
7i++;
8x = FileReadLine(infile);
9Org = trim(listFirst(x,"="));
10Lang = trim(listRest(x,"="));
11MyArray.array[i][1] = Org;
12MyArray.array[i][2] = Lang;
13if (MyArray.array[i][1] == Name)
14{
15WriteOutput(MyArray.array[i][2]);
16flag = 1;
17}
18}
19if (flag == 0) WriteOutput(Name);
20FileClose(infile);
21MyArray = StructNew();
22MyArray.array = ArrayNew(2);
23}
24</cfscript>
Client.cfm
2 #udf_translate("User Name", "D:\GREEK.properties"")#
3</cfoutput>
How? It's easy, isn't it?

Android



Top of Page