Release 3.2 (4/14/2005)
« Database Conventions | Contents | Appendix: Performance Techniques »
Make sure your code takes account of the Globalization Standards listed on the Web Team Internationalization page.
If your source file is UTF-8 (which it should be - DWMX lets you create UTF-8 source files!), then you should include a page processing directive near the top of each and every source file:
<cfprocessingdirective pageEncoding="utf-8" />
All generated HTML must specify a Content-Type
, a Content-Language
and a character set encoding (which should be UTF-8
). See also
Accessibility
/ Section 508 Guidelines.
This will be in the Application.cfm
file along with setEncoding()
calls for form and URL scope:
<!--- Set encoding to UTF-8. ---> <cfset setEncoding("URL", "UTF-8") /> <cfset setEncoding("Form", "UTF-8") /> <!--- Set the output encoding to UTF-8 --->
<cfcontent type="text/html; charset=UTF-8" /> <!--- Set basic URL values into request scope ---> <cf_getrequestsettings /> <cfheader name="Content-Language" value="#request.language#" />
Any references to URL encoded data needs to use:
#URLEncodedFormat(myvar, "UTF-8")#
Note: the locale will be determined dynamically by
code in Application.cfm
from a combination of the URL (which will
usually include a Macromedia 'region' code) and the query string (which may
specify a loc
parameter). The general outline of that logic, in
pseudo-code would be:
if loc is present in query string then request.locale = loc value else if region is present in the URL then request.locale = default locale for that region else request.locale = "en_US" endif
The language can be derived from the locale mechanically:
<cfset request.language = replace(request.locale,"_","-") />
A 'short locale' would also be needed for content queries - the first two letters of the specified or deduced locale:
<cfset request.loc2 = left(request.locale, 2) />
Here are some examples of the deduction we would do:
URL | loc | Region | request | ||
---|---|---|---|---|---|
locale | loc2 | language | |||
/products/index.cfm | n/a | n/a | en_US | en | en-US |
/products/index.cfm?loc=es | es | n/a | es_ES | es | es-ES |
/products/index.cfm?loc=es_US | es_US | n/a | es_US | es | es-US |
/la/products/index.cfm | n/a | la | es_ES | es | es-ES |
/la/products/index.cfm?loc=pt_BR | pt_BR | la | pt_BR | pt | pt-BR |
« Database Conventions | Contents | Appendix: Performance Techniques »
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/wtg/public/coding_standards/globalization.html
Comments
JackLondon said on Jan 23, 2005 at 1:37 PM : PaulH said on Apr 15, 2005 at 7:41 AM :