Home Reference Source
import Localizer from 'potassium-es/src/Localizer.js'
public class | source

Localizer

Extends:

EventHandler → Localizer

Localizer provides the functionality necessary to:

  • pick a string translation based on language
  • format dates based on locale and time zone

TODO:

  • detect language, locale, and timezone
  • load translations

Static Member Summary

Static Public Members
public static get

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public get
public get
public get
public get

Method Summary

Public Methods
public

formatDate(date: *, long: boolean, options: undefined): *

public

formatDateObject(date: *, options: *): *

public

formatDateTime(date: *, long: boolean, options: undefined): *

public

translate(key: *, defaultValue: undefined): *

Inherited Summary

From class EventHandler
public get

listeners: EventListener[]: *

public

addListener(callback: function(eventName: string, eventSource: EventHandler), eventName: Object | Symbol, once: bool)

public
public

removeListener(callback: *, eventName: undefined)

public

trigger(eventName: *, params: ...*)

Send an event to listeners

Static Public Members

public static get Singleton: * source

Public Constructors

public constructor() source

Public Members

public get defaultLanguage: * source

public get defaultLocale: * source

public get defaultTimeZone: * source

public get monthNames: * source

Public Methods

public formatDate(date: *, long: boolean, options: undefined): * source

Params:

NameTypeAttributeDescription
date *
long boolean
  • optional
  • default: false
options undefined
  • optional
  • default: undefined

Return:

*

public formatDateObject(date: *, options: *): * source

Params:

NameTypeAttributeDescription
date *
options *

Return:

*

public formatDateTime(date: *, long: boolean, options: undefined): * source

Params:

NameTypeAttributeDescription
date *
long boolean
  • optional
  • default: false
options undefined
  • optional
  • default: undefined

Return:

*

public translate(key: *, defaultValue: undefined): * source

Params:

NameTypeAttributeDescription
key *
defaultValue undefined
  • optional
  • default: undefined

Return:

*