UNB Components Code Reference

UnbLocale class

UNB localisation class.

Public methods

S AddDict

Adds more words to a locale's dictionary.

S AutoPrefer

Automatically determines the locales to prefer from the user agent.

S AutoRegister

Automatically loads and registers all locale classes in a directory.

S Capital

Converts the first letter to upper case.

S Colon

Gets the localised colon.

S ContentType

Translates a file content type description.

S DataSize

Formats a data or file size in bytes.

S GetCode

Gets the code of the currently most-preferred locale.

S GetPreferredLocaleCodes

Gets all preferred locale codes, in their order of preference.

S NoBreak

Prevents a line break between digits and the following text.

S Number

Formats a number.

S OrdinalNumber

Formats an ordinal number.

S Parentheses

Puts the specified string in parentheses.

S Prefer

Prefer the specified locale.

S Quote

Puts the specified string in quotation marks.

S Register

Registers a new locale object.

S RelativeTime

Formats a relative time description.

S SetTimeZone

Sets the default time zone to display time specifications in.

S Time

Formats an absolute time description.

S Translate

Gets the translation of a text.

Protected methods

   FormatNumber No description available.
   FormatOrdinalNumber No description available.
   FormatRelativeTime No description available.
   FormatTime No description available.

Protected fields

code  –  default: null

Locale code, to be set by sub-classes.

colon  –  default: ':'
dependsOn  –  default: null

Locale code that the locale depends on for dictionary translations. To be set by sub-classes that contain an incomplete dictionary and need a certain other locale available as fallback, like for example en-GB only includes deviations from en-US and otherwise needs to fall back to en-US.

dict  –  default: array()

The text dictionary, to be set by sub-classes.

importance  –  default: 0

Locale importance for its language, used to sort known locales when only a language is requested. This should be roughly the number of people affected by the locale, divided by 1000.

parentheseEnd  –  default: ')'

Ending parentheses character.

parentheseStart  –  default: '('

Starting parentheses character.

quoteEnd  –  default: '"'

Ending quotation mark.

quoteStart  –  default: '"'

Starting quotation mark.

Private fields

knownLocales  –  default: array()

Known available locale objects.

prefLocales  –  default: array()

Preferred locale objects to use, in this order.

timezone  –  default: null

(DateTimeZone) Current timezone. If unset, the server-default will be used.

Implementation file: locale.class.php, line 52

© 2011 Yves Goergen. UNB Components Homepage. Reference generated on 2011-02-22.