ColdBox Platform Version 2.6.3

coldbox.system.plugins
Class i18n

WEB-INF.cftags.component
        extended by coldbox.system.frameworkSupertype
            extended by coldbox.system.plugin
                extended by coldbox.system.plugins.i18n

public class i18n
extends plugin

This is the i18N plugin based on Paul Hastings cfc. It uses standard Java locale names and has its own storage mechanism via RBundles['Locale']. In order to use the plugin, you must instantiate it and call its setfwLocale() method with the appropriate locale to initialize with. Then you may use its methods.


Constructor Summary
init(any controller)
          Constructor
 
Method Summary
private any buildLocale(string thisLocale)
          creates valid core java locale from java style locale ID
 any dateLocaleFormat(coldbox.system.plugins.date date, [string style='LONG'])
          locale version of dateFormat. Needs object instantiation. That is your job not mine.
 any datetimeLocaleFormat(coldbox.system.plugins.date date, [string dateStyle='SHORT'], [string timeStyle='SHORT'])
          locale date/time format. Needs object instantiation. That is your job not mine.
 string formatDateTime(numeric thisOffset, string thisPattern, [any tz='[runtime expression]'])
          formats a date/time to given pattern
 coldbox.system.plugins.date fromEpoch(numeric thisOffset)
          converts java epoch offset to datetime
 array getAvailableTZ()
          returns an array of timezones available on this server
 string getCurrencySymbol([boolean localized='true'])
          returns currency symbol for this locale
 numeric getDST([any thisTZ='[runtime expression]'])
          returns DST savings in hours
 string getDateTimePattern([numeric thisDateFormat='1'], [numeric thisTimeFormat='3'])
          returns locale date/time pattern
 numeric getDay(numeric thisOffset, [any tz='[runtime expression]'])
          returns day from epoch offset
 struct getDecimalSymbols()
          returns strucure holding decimal format symbols for this locale
 numeric getHour(numeric thisOffset, [any tz='[runtime expression]'])
          returns hour of day, 24 hr format, from epoch offset
 array getISOcountries()
          returns array of 2 letter ISO countries
 array getISOlanguages()
          returns array of 2 letter ISO languages
 string getLocaleNames()
          returns list of locale names, UNICODE direction char (LRE/RLE) added as required
 query getLocaleQuery()
          returns a sorted query of locales (locale,country,language,dspName,localname. 'localname' will contain the locale's name in its native characters). Suitable for use in creating select lists.
 array getLocales()
          returns array of locales
 any getLocalizedDays()
          Facade to getShortWeedDays. For compatability
 string getLocalizedMonth(numeric month)
          Returns localized month.
 string getLocalizedYear(numeric thisYear)
          Returns localized year, probably only useful for BE calendars like in thailand, etc.
 numeric getMinute(numeric thisOffset, [any tz='[runtime expression]'])
          returns minute from epoch offset
 numeric getMonth(numeric thisOffset, [any tz='[runtime expression]'])
          returns month from epoch offset
 numeric getRawOffset([any tZ='[runtime expression]'])
          returns rawoffset in hours
 numeric getSecond(numeric thisOffset, [any tz='[runtime expression]'])
          returns second from epoch offset
 any getServerTZ()
          returns server TZ
 array getShortWeekDays([boolean calendarOrder='true'])
          returns short day names for this calendar
 array getTZByOffset(numeric thisOffset)
          returns a list of timezones available on this server for a given raw offset
 string getTZDisplayName([any thisTZ='[runtime expression]'], [string dspType=''])
          returns the display name of the timezone requested in either long, short, or default style
 any getTZOffset(numeric thisOffset, [any thisTZ='[runtime expression]'])
          returns offset in hours
 query getTZQuery(boolean returnUnique='true')
          returns a sorted query of timezones, optionally filters for only unique display names (fields:id,offset,dspName,longname,shortname,usesDST). Suitable for use in creating select lists.
 struct getVersion()
           returns version of this CFC and icu4j library it uses.
 numeric getYear(numeric thisOffset, [any tz='[runtime expression]'])
          returns year from epoch offset
 numeric i18nDateAdd(numeric thisOffset, string thisDatePart, numeric dateUnits, [any thisTZ='[runtime expression]'])
 numeric i18nDateDiff(numeric thisOffset, numeric thatOffset, string thisDatePart, [any thisTZ='[runtime expression]'])
 string i18nDateFormat(numeric thisOffset, [numeric thisDateFormat='1'], [any tz='[runtime expression]'])
 numeric i18nDateParse(string thisDate)
          parses localized date string to datetime object or returns blank if it can't parse
 string i18nDateTimeFormat(numeric thisOffset, [numeric thisDateFormat='1'], [numeric thisTimeFormat='1'], [any tz='[runtime expression]'])
 numeric i18nDateTimeParse(string thisDate)
          parses localized datetime string to datetime object or returns blank if it can't parse
 string i18nTimeFormat(numeric thisOffset, [numeric thisTimeFormat='1'], [any tz='[runtime expression]'])
 boolean inDST(numeric thisOffset, [any tzToTest='[runtime expression]'])
          determines if a given date in a given timezone is in DST
 void init_i18N(string rbFile, [string rbLocale='en_US'])
          Reads,parses,saves the locale and resource bundles defined in the config. Called only internally by the framework. Use at your own risk
 boolean isBidi()
          determines if given locale is BIDI
 boolean isValidLocale(string thisLocale)
          Validate a locale
 void loadLocale([string locale='en_US'])
          Loads a locale.
 any setfwLocale([string locale='[runtime expression]'], [boolean dontloadRBFlag='false'])
          Set the default locale to use in the framework.
 string showCountry()
          returns display country name for given locale
 string showISOCountry()
          returns 2-letter ISO country name for given locale
 string showLanguage()
          returns display country name for given locale
 string showLocaleCountry()
          returns display country name for given locale
 string showLocaleLanguage()
          returns display country name for given locale
 any timeLocaleFormat(coldbox.system.plugins.date date, [string style='SHORT'])
          locale version of timeFormat. Needs object instantiation. That is your job not mine.
 numeric toEpoch(coldbox.system.plugins.date thisDate)
          converts datetime to java epoch offset
 boolean usesDST([any tz='[runtime expression]'])
          determines if a given timezone uses DST
 string weekStarts()
          Determines the first DOW.
 
Methods inherited from class coldbox.system.plugin
getPluginDescription, getPluginName, getPluginVersion, getpluginPath, setPluginDescription, setPluginName, setPluginVersion
 
Methods inherited from class coldbox.system.frameworkSupertype
abort, announceInterception, dump, getColdboxOCM, getDatasource, getDebugMode, getHash, getInstance, getInterceptor, getMailSettings, getModel, getMyPlugin, getPlugin, getResource, getSetting, getSettingStructure, getSettingsBean, getcontroller, getfwLocale, htmlhead, include, includeUDF, locateDirectoryPath, locateFilePath, persistVariables, populateModel, relocate, renderExternalView, renderView, rethrowit, runEvent, setDebugMode, setNextEvent, setNextRoute, setSetting, setcontroller, settingExists, throw
 
Methods inherited from class WEB-INF.cftags.component
 

Constructor Detail

init

public init(any controller)

Method Detail

buildLocale

private any buildLocale(string thisLocale)
creates valid core java locale from java style locale ID

Parameters:
thisLocale

dateLocaleFormat

public any dateLocaleFormat(coldbox.system.plugins.date date, [string style='LONG'])
locale version of dateFormat. Needs object instantiation. That is your job not mine.

Parameters:
date
style - FULL=0, LONG=1, MEDIUM=2, SHORT=3

datetimeLocaleFormat

public any datetimeLocaleFormat(coldbox.system.plugins.date date, [string dateStyle='SHORT'], [string timeStyle='SHORT'])
locale date/time format. Needs object instantiation. That is your job not mine.

Parameters:
date
dateStyle - FULL=0, LONG=1, MEDIUM=2, SHORT=3
timeStyle - FULL=0, LONG=1, MEDIUM=2, SHORT=3

formatDateTime

public string formatDateTime(numeric thisOffset, string thisPattern, [any tz='[runtime expression]'])
formats a date/time to given pattern

Parameters:
thisOffset
thisPattern
tz

fromEpoch

public coldbox.system.plugins.date fromEpoch(numeric thisOffset)
converts java epoch offset to datetime

Parameters:
thisOffset - java epoch offset to convert to datetime

getAvailableTZ

public array getAvailableTZ()
returns an array of timezones available on this server


getCurrencySymbol

public string getCurrencySymbol([boolean localized='true'])
returns currency symbol for this locale

Parameters:
localized - return international (USD, THB, etc.) or localized ($,etc.) symbol

getDST

public numeric getDST([any thisTZ='[runtime expression]'])
returns DST savings in hours

Parameters:
thisTZ

getDateTimePattern

public string getDateTimePattern([numeric thisDateFormat='1'], [numeric thisTimeFormat='3'])
returns locale date/time pattern

Parameters:
thisDateFormat - FULL=0, LONG=1, MEDIUM=2, SHORT=3
thisTimeFormat - FULL=0, LONG=1, MEDIUM=2, SHORT=3

getDay

public numeric getDay(numeric thisOffset, [any tz='[runtime expression]'])
returns day from epoch offset

Parameters:
thisOffset - java epoch offset
tz

getDecimalSymbols

public struct getDecimalSymbols()
returns strucure holding decimal format symbols for this locale


getHour

public numeric getHour(numeric thisOffset, [any tz='[runtime expression]'])
returns hour of day, 24 hr format, from epoch offset

Parameters:
thisOffset - java epoch offset
tz

getISOcountries

public array getISOcountries()
returns array of 2 letter ISO countries


getISOlanguages

public array getISOlanguages()
returns array of 2 letter ISO languages


getLocaleNames

public string getLocaleNames()
returns list of locale names, UNICODE direction char (LRE/RLE) added as required


getLocaleQuery

public query getLocaleQuery()
returns a sorted query of locales (locale,country,language,dspName,localname. 'localname' will contain the locale's name in its native characters). Suitable for use in creating select lists.


getLocales

public array getLocales()
returns array of locales


getLocalizedDays

public any getLocalizedDays()
Facade to getShortWeedDays. For compatability


getLocalizedMonth

public string getLocalizedMonth(numeric month)
Returns localized month.

Parameters:
month

getLocalizedYear

public string getLocalizedYear(numeric thisYear)
Returns localized year, probably only useful for BE calendars like in thailand, etc.

Parameters:
thisYear

getMinute

public numeric getMinute(numeric thisOffset, [any tz='[runtime expression]'])
returns minute from epoch offset

Parameters:
thisOffset - java epoch offset
tz

getMonth

public numeric getMonth(numeric thisOffset, [any tz='[runtime expression]'])
returns month from epoch offset

Parameters:
thisOffset - java epoch offset
tz

getRawOffset

public numeric getRawOffset([any tZ='[runtime expression]'])
returns rawoffset in hours

Parameters:
tZ

getSecond

public numeric getSecond(numeric thisOffset, [any tz='[runtime expression]'])
returns second from epoch offset

Parameters:
thisOffset - java epoch offset
tz

getServerTZ

public any getServerTZ()
returns server TZ


getShortWeekDays

public array getShortWeekDays([boolean calendarOrder='true'])
returns short day names for this calendar

Parameters:
calendarOrder

getTZByOffset

public array getTZByOffset(numeric thisOffset)
returns a list of timezones available on this server for a given raw offset

Parameters:
thisOffset

getTZDisplayName

public string getTZDisplayName([any thisTZ='[runtime expression]'], [string dspType=''])
returns the display name of the timezone requested in either long, short, or default style

Parameters:
thisTZ
dspType

getTZOffset

public any getTZOffset(numeric thisOffset, [any thisTZ='[runtime expression]'])
returns offset in hours

Parameters:
thisOffset
thisTZ

getTZQuery

public query getTZQuery(boolean returnUnique='true')
returns a sorted query of timezones, optionally filters for only unique display names (fields:id,offset,dspName,longname,shortname,usesDST). Suitable for use in creating select lists.

Parameters:
returnUnique

getVersion

public struct getVersion()
returns version of this CFC and icu4j library it uses.


getYear

public numeric getYear(numeric thisOffset, [any tz='[runtime expression]'])
returns year from epoch offset

Parameters:
thisOffset - java epoch offset
tz

i18nDateAdd

public numeric i18nDateAdd(numeric thisOffset, string thisDatePart, numeric dateUnits, [any thisTZ='[runtime expression]'])

Parameters:
thisOffset
thisDatePart
dateUnits
thisTZ

i18nDateDiff

public numeric i18nDateDiff(numeric thisOffset, numeric thatOffset, string thisDatePart, [any thisTZ='[runtime expression]'])

Parameters:
thisOffset
thatOffset
thisDatePart
thisTZ

i18nDateFormat

public string i18nDateFormat(numeric thisOffset, [numeric thisDateFormat='1'], [any tz='[runtime expression]'])

Parameters:
thisOffset - java epoch offset
thisDateFormat - FULL=0, LONG=1, MEDIUM=2, SHORT=3
tz

i18nDateParse

public numeric i18nDateParse(string thisDate)
parses localized date string to datetime object or returns blank if it can't parse

Parameters:
thisDate

i18nDateTimeFormat

public string i18nDateTimeFormat(numeric thisOffset, [numeric thisDateFormat='1'], [numeric thisTimeFormat='1'], [any tz='[runtime expression]'])

Parameters:
thisOffset - java epoch offset
thisDateFormat - FULL=0, LONG=1, MEDIUM=2, SHORT=3
thisTimeFormat - FULL=0, LONG=1, MEDIUM=2, SHORT=3
tz

i18nDateTimeParse

public numeric i18nDateTimeParse(string thisDate)
parses localized datetime string to datetime object or returns blank if it can't parse

Parameters:
thisDate

i18nTimeFormat

public string i18nTimeFormat(numeric thisOffset, [numeric thisTimeFormat='1'], [any tz='[runtime expression]'])

Parameters:
thisOffset - java epoch offset
thisTimeFormat - FULL=0, LONG=1, MEDIUM=2, SHORT=3
tz

inDST

public boolean inDST(numeric thisOffset, [any tzToTest='[runtime expression]'])
determines if a given date in a given timezone is in DST

Parameters:
thisOffset
tzToTest

init_i18N

public void init_i18N(string rbFile, [string rbLocale='en_US'])
Reads,parses,saves the locale and resource bundles defined in the config. Called only internally by the framework. Use at your own risk

Parameters:
rbFile - This must be the path + filename UP to but NOT including the locale. We auto-add .properties to the end.
rbLocale

isBidi

public boolean isBidi()
determines if given locale is BIDI


isValidLocale

public boolean isValidLocale(string thisLocale)
Validate a locale

Parameters:
thisLocale - Locale to validate

loadLocale

public void loadLocale([string locale='en_US'])
Loads a locale.

Parameters:
locale

setfwLocale

public any setfwLocale([string locale='[runtime expression]'], [boolean dontloadRBFlag='false'])
Set the default locale to use in the framework.

Parameters:
locale - The locale to change and set. Must be Java Style: en_US
dontloadRBFlag - Flag to load the resource bundle for the specified locale (If not already loaded) or just change the framework's locale.

showCountry

public string showCountry()
returns display country name for given locale


showISOCountry

public string showISOCountry()
returns 2-letter ISO country name for given locale


showLanguage

public string showLanguage()
returns display country name for given locale


showLocaleCountry

public string showLocaleCountry()
returns display country name for given locale


showLocaleLanguage

public string showLocaleLanguage()
returns display country name for given locale


timeLocaleFormat

public any timeLocaleFormat(coldbox.system.plugins.date date, [string style='SHORT'])
locale version of timeFormat. Needs object instantiation. That is your job not mine.

Parameters:
date
style - FULL=0, LONG=1, MEDIUM=2, SHORT=3

toEpoch

public numeric toEpoch(coldbox.system.plugins.date thisDate)
converts datetime to java epoch offset

Parameters:
thisDate - datetime to convert to java epoch

usesDST

public boolean usesDST([any tz='[runtime expression]'])
determines if a given timezone uses DST

Parameters:
tz

weekStarts

public string weekStarts()
Determines the first DOW.


ColdBox Platform Version 2.6.3