/plugins/keyvalue_dictionary

A keyvalue_dictionary can be configured in the locale. The keyvalue_dictionary plugin method will parse the mapview.locale for properties with key/value pairs matching entries in the dictionary. The property value will be replaced with a language lookup in the dictionary or the default value.

"keyvalue_dictionary": [
  {
    "key": "name",
    "value": "OSM",
    "default": "OpenStreetMap",
    "uk": "Sława OpenStreetMap 🇺🇦"
  }
]

Methods

(inner) isArrayObject(item, dictionary) → {boolean}

Checks if an item is an array or an object and recursively applies the parsing logic.

Parameters:
NameTypeDescription
item*

The item to check.

dictionaryArray

An array of dictionary entries.

Returns:

Returns true if the item is an array or an object, false otherwise.

Type: 
boolean

(inner) keyvalue_dictionary(keyvalue_dictionary, mapview)

Replaces key-value pairs in the mapview locale object with dictionary entries.

Parameters:
NameTypeDescription
keyvalue_dictionaryArray

An array of dictionary entries.

mapviewmapview

The mapview object.

Properties
NameTypeDescription
mapview.localeObject

The locale object of the mapview.

(inner) parseObject(obj, dictionary)

Parses an object and replaces its string values with dictionary entries.

Parameters:
NameTypeDescription
objObject

The object to parse.

dictionaryArray

An array of dictionary entries.

(inner) replaceKeyValue(obj, key, value, dictionary)

Replaces a key-value pair in an object with a dictionary entry.

Parameters:
NameTypeDescription
objObject

The object containing the key-value pair.

keystring

The key of the value to replace.

valuestring

The value to replace.

dictionaryArray

An array of dictionary entries.