From 617610787440a754c953206c72f2906bd5e1fe64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Thu, 17 Jan 2019 09:32:07 +0100 Subject: [PATCH] Document twig changes - function 'repoTrans' - properties 'user.*' --- doc/TwigJS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/TwigJS.md b/doc/TwigJS.md index 68eb03c5..bc7fe2aa 100644 --- a/doc/TwigJS.md +++ b/doc/TwigJS.md @@ -45,6 +45,7 @@ When rendering map features, the following properties are available: * `meta.uid` (UID of the user, who changed the object last) * `map.zoom` (Current zoom level) * `const.*` (Values from the 'const' option) +* `user.*` (Values from the user's options, e.g. `user.ui_lang`, `user.data_lang`, ...) For the info-section of a category the following properties are available: * `layer_id` (the id of the category) @@ -57,6 +58,7 @@ There are several extra functions defined for the TwigJS language: * function `tagTransList`: return the translations of the given tag for tags with multiple values separated by ';' (e.g. 'cuisine'). Parameters: key (required, e.g. 'cuisine'), value (required, e.g. 'kebab' or 'kebab;pizza;noodles;burger'). * function `localizedTag`: return a localized tag if available (e.g. 'name:de' for the german translation of the tag). Parameters: tags (the tags property), key prefix (e.g. 'name'). Which language will be returned depends on the "data language" which can be set via Options. If no localized tag is available, the tag value itself will be returned (e.g. value of 'name'). * function `trans`: return the translation of the given string (e.g. 'save', 'unknown', 'unnamed', ...). Parameters: string (the string to translate). +* function `repoTrans`: translate strings from this repositories' language file (located in `lang/xy.json`, where `xy` stands for the current locale). * function `tagsPrefix(tags, prefix)`: return all tags with the specified prefix. The result will be an array with `{ "en": "name:en", "de": "name:de" }` (for the input `{ "name": "foo", "name:en": "english foo", "name:de": "german foo" }` and the prefix "name:"). * function openingHoursState(opening_hours_definition): returns state of object as string: 'closed', 'open' or 'unknown'. * function colorInterpolate(map, value): interpolates between two or more colors. E.g. `colorInterpolate([ 'red', 'yellow', 'green' ], 0.75)`.