Class Index | File Index

Classes


Class ilib.NameFmt

Creates a formatter that can format person name instances (ilib.Name) for display to a user. The options may contain the following properties:

Formatting names is a locale-dependent function, as the order of the components depends on the locale. The following explains some of the details:

Depends directive: !depends namefmt.js
Defined in: ilib-dyn-full.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
ilib.NameFmt(options)
Method Summary
Method Attributes Method Name and Description
 
format(name)
Format the name for display in the current locale with the options set up in the constructor of this formatter instance.
 
Return the list of components used to format names in this formatter
 
Return the locale for this formatter instance.
 
Return the style of names returned by this formatter
Class Detail
ilib.NameFmt(options)
Parameters:
{Object} options
A set of options that govern how the formatter will behave
Method Detail
{string|undefined} format(name)
Format the name for display in the current locale with the options set up in the constructor of this formatter instance.

If the name does not contain all the parts required for the style, those parts will be left blank.

There are two basic styles of formatting: European, and Asian. If this formatter object is set for European style, but an Asian name is passed to the format method, then this method will format the Asian name with a generic Asian template. Similarly, if the formatter is set for an Asian style, and a European name is passed to the format method, the formatter will use a generic European template.

This means it is always safe to format any name with a formatter for any locale. You should always get something at least reasonable as output.

Parameters:
{ilib.Name} name
the name to format
Returns:
{string|undefined} the name formatted according to the style of this formatter instance

{string} getComponents()
Return the list of components used to format names in this formatter
Returns:
{string} the list of components

{ilib.Locale} getLocale()
Return the locale for this formatter instance.
Returns:
{ilib.Locale} the locale instance for this formatter

{string} getStyle()
Return the style of names returned by this formatter
Returns:
{string} the style of names returned by this formatter

Documentation generated by JsDoc Toolkit 2.4.0 on Tue Feb 02 2016 16:00:49 GMT-0800 (PST)