Class: I18nMixin

@aofl/i18n-mixin~ I18nMixin


new I18nMixin()

Source:

Extends

  • superClass

Members


<static> properties :Object

Type:
  • Object
Source:

Methods


<async> __(id, str)

Language translation function.
Parameters:
Name Type Description
id String
str String
Source:
Returns:
Type
String

<async> _c(id, str, args)

Conditional translation function. When invoked it finds the correct string based on the labels specified in ...args.
Parameters:
Name Type Argument Description
id *
str *
args * <repeatable>
Source:
Returns:
Type
String

<async> _r(str, args)

Replace function. When invoked it will replace %r(number)% with the number matching the index of the arguments passed to the _r function.
Parameters:
Name Type Argument Description
str String
args * <repeatable>
Source:
Returns:
Type
String

attributeChangedCallback(name, oldValue, newValue)

Listen for component's lang attribute mutations
Parameters:
Name Type Description
name String
oldValue String
newValue String
Source:
Returns:
Type
void

connectedCallback()

Sets initial lang
Source:

disconnectedCallback(args)

Parameters:
Name Type Argument Description
args * <repeatable>
Source:

getCachedTemplate(id, templateParts)

Check if templateParts matches previously cached template and prevent unnecessary render updates
Parameters:
Name Type Description
id *
templateParts *
Source:
Returns:
Type
templateParts

langListener()

Listens for html lang mutations
Source:
Returns:
Type
MutationObserver

render(templates, args)

Parameters:
Name Type Argument Description
templates Object
args * <repeatable>
Source:
Returns:
Type
Object