Categories

ep.dict()

Categories: CSS

ep.dict( name, [ options ] )

Plugin: ep.dict

Description: Get a dictionary object for translation.

  • ep.dict( name, [ options ] )

    version added: 6.11.0

    name   The name of the dictionary.

    data   An array containing names of other dictionaries, dictionary objects or a map of keyword/translation pairs to add.

    options   A map of additional options pass to the method.

Get a dictionary object for translation.

  • Use an existing dictionary.

    Code:
    // The example dictionary is already defined.
    
    // use default region/language
    ep.dict( 'example' );
    
    // use german
    ep.dict( 'example', {region:'de'} );
    
    
  • Create a foo dictionary.

    Code:
    // The example dictionary is already defined.
    
    // use default region/language
    ep.dict( 'foo', [ 'example', {"strawberry":"Strawberry"} ] );
    
    // use german
    ep.dict( 'foo', [ 'example', {"strawberry":"Erdbeere"} ], {region:'de'} );
    
    
  • Translate keywors and parse text with a dict.

    Code:
    var obj = ep.dict( 'ep.dict', {region:'de'} );
    
    obj.translate('Close')
    //
    
    
    
  • region

    version added: 6.11.0

    A region/language to use for this dict.

    Default: ep.config.region

  • parser

    version added: 6.11.0

    An array of an regular expression to find translate keys and a match index. The match index setup which match will translate.

    Default: [ /([^\\{\\$]{1}

  • .translate()

    • .translate( keyword )

      version added: 6.11.0

      keyword   A keyword to translate.

    Get a translation for a keyword.

  • .parse()

    • .parse( text )

      version added: 6.11.0

      text   A text with keyword markers to translate.

    Parse a text with keyword markers and translate them with the dictionary.

  • .translateData()

    • .translateData( keyword, data )

      version added: 6.11.0

      keyword   A keyword to translate.

      data   A key/value set to fill data markers in the translated keyword

    Get a translation for a keyword and fill the data markers in translation.

  • .parseData()

    • .parseData( text , data )

      version added: 6.11.0

      text   A text with keyword markers to translate.

      data   A key/value set to fill data markers in the translated parsed text.

    Parse a text with keyword markers and translate them with the dictionary and fill the data markers in the parsed text.