Report an issue
Class

Locale (utils)

@ckeditor/ckeditor5-utils/src/locale

class

Represents the localization services.

Filtering

Properties

Methods

  • constructor( [ language ] )

    Creates a new instance of the Locale class.

    Parameters

    [ language ] : String

    The language code in ISO 639-1 format.

    Defaults to 'en'

  • t( str, [ values ] )

    Translates the given string to the language. This method is also available in t and t.

    The strings may contain placeholders (%<index>) for values which are passed as the second argument. <index> is the index in the values array.

    editor.t( 'Created file "%0" in %1ms.', [ fileName, timeTaken ] );

    This method's context is statically bound to Locale instance, so it can be called as a function:

    const t = this.t;
    t( 'Label' );

    Parameters

    str : String

    The string to translate.

    [ values ] : Array.<String>

    Values that should be used to interpolate the string.

  • _t()

    private

    Base for the t method.