Class

Locale (utils)

@ckeditor/ckeditor5-utils/src/locale

class

Represents the localization services.

Filtering

Properties

Methods

  • constructor( [ options ] = { [options.uiLanguage], [options.contentLanguage] } )

    Creates a new instance of the Locale class. Learn more about configuring language of the editor.

    Parameters

    [ options ] : Object

    Locale configuration.

    Properties
    [ options.uiLanguage ] : String

    The editor UI language code in the ISO 639-1 format. See uiLanguage.

    Defaults to 'en'

    [ options.contentLanguage ] : String

    The editor content language code in the ISO 639-1 format. If not specified, the same as options.language. See contentLanguage.

  • t( str, [ values ] )

    Translates the given string to the uiLanguage. 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.