| 48 | | * '''xmlns="http://josm.openstreetmap.de/tagging-preset-1.0"''' |
| 49 | | * '''author''' - the name of the author of the preset |
| 50 | | * '''version''' - the version number of the file. For automatic version adjustment of presets managed in this wiki you can use two internal variables: `[[revision]]` (the latest version number of the wiki page) and `[[date]]` (the date of the last edit). |
| 51 | | * '''description''' (i18n) - description what the file contains |
| 52 | | * '''shortdescription''' (i18n) - very short overview description i.e. the "name" of the preset |
| 53 | | * '''link''' (i18n) - web link to further details (optional) |
| 54 | | * '''icon''' - informational icon for the whole preset. (This is nedded to display the icon in the table at [wikitr:/Presets Presets].) |
| 55 | | * '''baselanguage''' - when the base language is not English, specify it here (using non English preset texts prevents automatic translation) |
| 56 | | |
| 57 | | (i18n) means the values may also be localized (e.g. de.description). |
| | 51 | * **xmlns="http://josm.openstreetmap.de/tagging-preset-1.0"** |
| | 52 | * **author** - the name of the author of the preset |
| | 53 | * **version** - the version number of the file. For automatic version adjustment of presets managed in this wiki you have to use two internal variables: `[[revision]]` (the latest version number of the wiki page) and `[[date]]` (the date of the last edit), e.g. `version="1.[[revision]]_[[date]]"`. |
| | 54 | * **description** (i18n) - description what the file contains |
| | 55 | * **shortdescription** (i18n) - very short overview description i.e. the "name" of the preset |
| | 56 | * **link** (i18n) - web link to further details (optional) |
| | 57 | * **icon** - icon for the whole preset |
| | 58 | * **baselanguage** - when the base language is not English, specify it here (using non English preset texts will prevent automatic translation, once it is implemented (#11392)) |
| | 59 | |
| | 60 | (i18n) means the values may also be localized (e.g. `de.description`). |
| 88 | | This is required around `<role>` and adds the heading ("Available roles role count elements") to the table which is generated by several `<role>`. |
| 89 | | <role>:: |
| 90 | | To specify possible roles of members in relations. The `key` attribute is required, `text`, `requisite`, `count`, `type` and `member_expression` are optional. |
| 91 | | <preset_link>:: |
| 92 | | Adds a link to an other preset. The `preset_name` attribute is required. |
| | 91 | This is required around `<role />` and adds the heading ("Available roles role count elements") to the table which is generated by several `<role />`. |
| | 92 | <role />:: |
| | 93 | To specify possible roles of members in relations. The `key=""` attribute is required, `text=""`, `requisite=""`, `count=""`, `type=""`, `member_expression=""` and `regexp=""` are optional. |
| | 94 | <preset_link />:: |
| | 95 | Adds a link to an other preset with a label on top. The `preset_name=""` attribute is required, `text=""` to override the label (default is `"Edit also …"`) and `text_context=""` are optional. A sequence of `<preset_link />` without `text=""` or a identical `text=""` value are grouped below one label. \\ |
| | 96 | **Watch out** for presets with identical **`name=""`** as it is not predictable to which preset the link will lead to, see #12716. \\ |
| | 97 | Having the same tag in both presets does not work, see #18992. \\ |
| | 98 | Using `<preset_link />` in presets opened from [wikitr:/Help/Dialog/RelationEditor relation editor] produces exceptions, see #20044. |
| 96 | | <key>:: |
| 97 | | This tag will always set a key to a specific value. `key` is required and if `value` is present, the key will be set. If `value` attribute is omitted, the key is removed. The `match` attribute is optional. |
| 98 | | \\ |
| 99 | | |
| 100 | | ==== Attribute entry and selection dialog boxes ==== |
| 101 | | <text>:: |
| 102 | | A text edit field to enter any arbitrary string from the user. `key` is mandatory, `text`, `default`, `use_last_as_default`, `auto_increment`, `length`, `alternative_autocomplete_keys` and `match` is optional |
| 103 | | <combo>:: |
| 104 | | Displays a multiple choice combo box. `key` and `values` are mandatory, `text`, `default`, `editable`, `delimiter`, `values_from`, `display_values`, `short_descriptions`, `use_last_as_default`, `values_searchable`, `length`, `values_no_i18n`, `values_sort` and `match` is optional.\\ |
| 105 | | If `editable` is `"true"` (default), combo boxes can be edited as if they were text fields (additional to the drop down menu). Non editable combo boxes can only contain one of the specified values. |
| | 102 | <key />:: |
| | 103 | This tag will always set a key to a specific value. `key=""` is required and if `value=""` is present, the key will be set. If `value=""` attribute is omitted, the key is removed. The `match=""` attribute is optional. |
| | 104 | \\ |
| | 105 | |
| | 106 | ==== Attribute entry and selection dialog boxes ====#EntrySelectionBoxes |
| | 107 | <text />:: |
| | 108 | A text edit field to enter any arbitrary string from the user. `key=""` is mandatory, `text=""`, `default=""`, `use_last_as_default=""`, `auto_increment=""`, `length=""`, `alternative_autocomplete_keys=""`, `match=""`, `icon=""` and `icon_size=""` (both since r17605) are optional. |
| | 109 | <combo />:: |
| | 110 | Displays a multiple choice combo box. `key=""` and `values=""` are mandatory, `text=""`, `default=""`, `editable=""`, `delimiter=""`, `values_from=""`, `display_values=""`, `short_descriptions=""`, `use_last_as_default=""`, `values_searchable=""`, `length=""`, `values_no_i18n=""`, `values_sort=""`, `match=""`, `icon=""` and `icon_size=""` (both since r17605) are optional.\\ |
| | 111 | If `editable=""` is `true` (default), combo boxes can be edited as if they were text fields (additional to the drop down menu). Non editable combo boxes can only contain one of the specified values.\\ |
| | 112 | If the key is `colour` or `colour:*` or `*:colour`, a color preview and color picker is added on the right (see #8352). |
| 107 | | <multiselect>:: |
| 108 | | Displays a list from which zero or more items can be chosen. `key` and `values` are mandatory, and `text`, `default`, `delimiter`, `values_from`, `rows`, `display_values`, `short_descriptions`, `use_last_as_default`, `values_searchable`, `values_no_i18n`, `values_sort` and `match` are optional. The selected values will be concatenated with the specified delimiter (default: semicolon) and written to the tag value. If a tag value has already been set when the preset dialog is opened, the `<multiselect>` will attempt to mark the appropriate items in the list as select. If the tag value cannot be represented by a combination of choices in the list, then the list will be disabled so that the user cannot accidentally overwrite a custom value. In contrast to the `<combo>` element, the `<multiselect>` expects the list of values, descriptions etc. to use the specified delimiter, i.e. by default you will have to use a semicolon. You can specify `delimiter=","` but then a comma will also be used in the tag value. |
| 109 | | <list_entry>:: |
| 110 | | Used in <combo> and <multiselect>. More information see `short_descriptions` [#short_description below]. The attributes are `value`, `display_value`, `short_description`, `icon` and `icon_size`. |
| 111 | | <check>:: |
| 112 | | A checkbox which the user can select, deselect or set as unset. The `key` attribute is mandatory. `text`, `default`, `match`, `value_on` , `value_off`, `disable_off`, `icon` and `icon_size` (both since r15437) are optional. |
| | 114 | <multiselect />:: |
| | 115 | Displays a list from which zero or more items can be chosen. `key=""` and `values=""` are mandatory, and `text=""`, `default=""`, `delimiter=""`, `values_from=""`, `rows=""`, `display_values=""`, `short_descriptions=""`, `use_last_as_default=""`, `values_searchable=""`, `values_no_i18n=""`, `values_sort=""`, `match=""`, `icon=""` and `icon_size=""` (both since r17605) are optional. The selected values will be concatenated with the specified delimiter (default: semicolon, `;`) and written to the tag value. If a tag value has already been set when the preset dialog is opened, the `<multiselect />` will attempt to mark the appropriate items in the list as select. If the tag value cannot be represented by a combination of choices in the list, then the list will be disabled so that the user cannot accidentally overwrite a custom value. In contrast to the `<combo />` element, the `<multiselect />` expects the list of values, descriptions etc. to use the specified delimiter, i.e. by default you will have to use a semicolon. You can specify `delimiter=","` but then a comma will also be used in the tag value. |
| | 116 | <list_entry />:: |
| | 117 | Used in `<combo>` and `<multiselect>`. More information see `short_descriptions=""`, [#short_description below]. The attributes are `value=""`, `display_value=""`, `short_description=""`, `icon=""` and `icon_size=""`. |
| | 118 | <check />:: |
| | 119 | A checkbox which the user can select, deselect or set as unset. The `key=""` attribute is mandatory. `text=""`, `default=""`, `match=""`, `value_on=""` , `value_off=""`, `disable_off=""`, `icon=""` and `icon_size=""` (both since r15437) are optional. |
| 129 | | When specified, only objects of the given type will work with this tagging preset. Can be `"node"`, `"way"`, `"closedway"`, `"multipolygon"`, `"relation"` or any comma separated combination of them. Note that `"multipolygon"` is not included in `"relation"`, so if the preset should apply for multipolygons and other relation types, you need to specify both: `"multipolygon,relation"`. Also used in the `<role>` tag to specify which object types are allowed for a specific relation member. |
| | 136 | When specified, only objects of the given type will work with this tagging preset. Can be `"node"`, `"way"`, `"closedway"`, `"multipolygon"`, `"relation"` or any comma separated combination of them. Note that `"multipolygon"` is not included in `"relation"`, so if the preset should apply for multipolygons and other relation types, you need to specify both: `"multipolygon,relation"`. Also used in the `<role>` tag to specify which object types are allowed for a specific relation member. |
| 141 | | An explicitly declared default value for the item. This value is ''only'' applied through a preset when the object the preset is applied to has ''zero keys''. |
| 142 | | If no value for default is specified, no value is set to the key. Used in `<check>`, `<text>`, `<combo>` and `<multiselect>`. |
| | 148 | An explicitly declared default value for the item. This value is ''only'' applied through a preset when the object the preset is applied to has ''zero keys''. |
| | 149 | If no value for default is specified, no value is set to the key. Used in `<check />`, `<text />`, `<combo />` and `<multiselect />`. For `<check />` only the values `"on"` and `"off"` are valid. |
| 148 | | Disables internationalisation for value to avoid mistakes, see #11696. Default is `"false"`. Used in `<combo>` and `<multiselect>`. (Useful e.g. for opening hours or brand names.) |
| 149 | | values_sort="false":: |
| 150 | | Values of `<combo>` and `<multiselect>` are sorted alphabetic in every language. With this attribute you can disable the alphabetic sorting if the values should keep the given order, see #5509 and #11926. (In the JOSM internal preset this is used e.g. for the keys `tracktype`, `direction`, `network`, `smoothness`, `visibility` or `trail_visibility`.) Default is `"true"`.\\ |
| 151 | | Users can globally disable sorting with the preference key `taggingpreset.sortvalues`. |
| | 155 | Disables internationalisation for values to avoid mistakes, see #11696. Default is `"false"`. Used in `<combo />` and `<multiselect />`. (Useful e.g. for keys `opening hours` or `brand`.) Not needed with keys with only numbers as values like `layer` or `level` which are already excluded from translation. |
| | 156 | values_sort="true|false":: |
| | 157 | Values of `<combo />` and `<multiselect />` are sorted alphabetic in every language. With this attribute you can disable the alphabetic sorting if the values should keep the given order, see #5509 and #11926. (In the JOSM internal preset this is used e.g. for the keys `tracktype`, `direction`, `network`, `smoothness`, `visibility` or `trail_visibility`.) Default is `"true"`.\\ |
| | 158 | Users can globally disable sorting with the preference key `taggingpreset.sortvalues`. |
| 173 | | Allows to change the matching process, i.e., determining whether the tags of an OSM object fit into this preset. If a preset fits then it is linked in the [wikitr:/Help/Dialog/TagsMembership Tags/Membership dialog]. |
| 174 | | * `none`: neutral, i.e., do not consider this item for matching |
| 175 | | * `key`: positive if key matches, neutral otherwise |
| 176 | | * `key!`: positive if key matches, negative otherwise |
| 177 | | * `keyvalue`: positive if key and value matches, neutral otherwise |
| 178 | | * `keyvalue!`: positive if key and value matches, negative otherwise |
| 179 | | |
| 180 | | Note that for a match, at least one positive and no negative is required. Default is `"keyvalue!"` for `<key>` and `"none"` for `<text>`, `<combo>`, `<multiselect>` and `<check>`. |
| | 180 | Allows to change the matching process, i.e., determining whether the tags of an OSM object fit into this preset. If a preset fits then it is linked in the [wikitr:/Help/Dialog/TagsMembership Tags/Membership dialog]. |
| | 181 | * `none`: neutral, i.e., do not consider this item for matching |
| | 182 | * `key`: positive if key matches, neutral otherwise |
| | 183 | * `key!`: positive if key matches, negative otherwise |
| | 184 | * `keyvalue`: positive if key and value matches, neutral otherwise |
| | 185 | * `keyvalue!`: positive if key and value matches, negative otherwise \\ |
| | 186 | **Note**: For a match, at least one positive and no negative is required. Default is `"keyvalue!"` for `<key>` and `"none"` for `<text />`, `<combo />`, `<multiselect />` and `<check />`. |
| | 187 | match_expression="search expression":: |
| | 188 | additional criteria for matching primitives, specified in [wikitr:/Help/Action/Search JOSM search] syntax. ''(since r17662)'' \\ |
| | 189 | Quotes (`"`) need to be written as `"`. \\ |
| | 190 | For instance, a preset with `match_expression="foo=bar"` requires OSM objects to have the tag `foo=bar`. You may want to use the `match_expression=""` to exclude certain OSM objects, e.g. when a more specific preset is present. |
| 190 | | How often can a role occur (if not given unlimited number is assumed) |
| 191 | | member_expression="an expression":: |
| 192 | | an expression (cf. search dialog) for objects of this role |
| | 200 | How often can a role occur (if not given unlimited number is assumed) |
| | 201 | member_expression="search expression":: |
| | 202 | an expression, in [wikitr:/Help/Action/Search JOSM search] syntax, for objects of this role \\ |
| | 203 | Quotes (`"`) need to be written as `"`. |
| 204 | | May contain a comma separated list of integer increments or decrements, e.g. `"-2,-1,+1,+2"`. A button will be shown next to the `<text>` field for each value, allowing the user to select auto-increment with the given stepping. Auto-increment only happens if the user selects it. There is also a button to deselect auto-increment. Default is no auto-increment. Mutually exclusive with `use_last_as_default`. |
| | 216 | May contain a comma separated list of integer increments or decrements, e.g. `"-2,-1,+1,+2"`. A button will be shown next to the `<text />` field for each value, allowing the user to select auto-increment with the given stepping. Auto-increment only happens if the user selects it. There is also a button to deselect auto-increment. Default is no auto-increment. Mutually exclusive with `use_last_as_default=""`. |
| 211 | | Whether to search in `<combo>` or `<multiselect>` (display_)values when searching for presets. |
| 212 | | \\ |
| 213 | | |
| 214 | | ===== name_template details ===== |
| 215 | | Name templates can be used to define custom formatting for OSM primitives or GPX waypoints (for example in the Relations or the Selection). |
| | 224 | Whether to search in `values=""` and `display_values=""`, respectively, `value=""` and `display_value=""` of `<combo />` or `<multiselect />` searching for presets. |
| | 225 | value_template="template":: |
| | 226 | A template to generate the value automatically based on other tag values of the object. The same syntax as in `name_template=""` is used, [#NameTemplateSyntax see below]. ''(since r17639)'' \\ |
| | 227 | For instance, `"Bus {ref}: {from} → {to}"` can be used to generate the name of a bus route relation. \\ |
| | 228 | **Note**: There are some minor problems with this attribute, see #20851 and #20861. |
| | 229 | \\ |
| | 230 | |
| | 231 | ===== name_template and value_template details ===== #name_templatedetails |
| | 232 | Name templates can be used to define custom formatting for OSM primitives or GPX waypoints (for example in the Relations or Selection panels). |
| 239 | | ====== Syntax ====== |
| 240 | | * `{var}` - use value of variable var |
| 241 | | * `?{condition1 'value1' | condition2 'value2 | 'value3'}` - use value1 if condition1 is satisfied, value3 is no condition is satisfied. Condition can be either explicit - the same expression as in search or filters is used - or implicit; the value is used when all variables used inside exist |
| | 256 | ====== Syntax ======#NameTemplateSyntax |
| | 257 | * `{tag}` - insert the value of the tag. |
| | 258 | * `?{condition1 'value1' | condition2 'value2' | 'value3'}` - use ''value1'' if ''condition1'' is satisfied, else use ''value2'' if ''condition2'' is satisfied, finally use ''value3'' if no condition is satisfied. Condition can be either explicit - in [wikitr:/Help/Action/Search JOSM search] syntax - or implicit: The value is used when all tags referenced inside exist. |
| 264 | | To support translations, all textual elements (`name`, `text`, `display_values`) may also be localized. E.g. `de.name` would represent the name in case the German language support is loaded. In the preset code the English term must be the first before possible translations are added. |
| 265 | | |
| 266 | | In JOSM internally ([source:josm/trunk/resources/data/defaultpresets.xml internal preset]) all `name`, `text` and `display_values` are translated when no specific translation has been given in XML file. When no `display_values` are supplied, then `values` will be treated as `display_values` and translated instead. When translations of equal words but different meanings may conflict, a translation context should be specified. Use `name_context`, `text_context` or `values_context` for this. The context should be a meaningful short description to help translators. |
| 267 | | |
| 268 | | The translation for the internal preset is done at [https://translations.launchpad.net/josm/trunk Launchpad] (and will probably change to another service in the future, since the Launchpad web interface often produces timeout errors, see #8645). |
| | 282 | To support translations, all textual elements (`name=""`, `text=""`, `display_values=""`) can be localized. E.g. `de.name=""` would represent the name when the German language support is loaded. In the preset XML code the English term must be the first, before possible translations can be added. |
| | 283 | |
| | 284 | === Internal Preset === |
| | 285 | The translation for the internal preset is done at [https://translations.launchpad.net/josm/trunk Launchpad]. |
| | 286 | |
| | 287 | In the [source:josm/trunk/resources/data/defaultpresets.xml internal preset], all `name=""`, `text=""` and `display_values=""` are translated via the above service, as long as no specific translation has been given within XML file. When no `display_values=""` are supplied, then `values=""` will be treated as `display_values=""` and translated instead. |
| | 288 | |
| | 289 | When the same English word has different translations in different contexts, the specific translation context needs to be specified. Use `name_context=""`, `text_context=""` or `values_context=""` for this purpose. The context should be a meaningful short description to help translators. |
| | 290 | |
| | 291 | === External Presets === |
| | 292 | |
| | 293 | The translation of external presets on this website is, so far, only possible inline within the preset XML source code, see #11392. |
| | 294 | |
| | 295 | Presets hosted elsewhere can also add a `data` directory with the JOSM-style {{{.lang}}} files for translation (like in JOSM itself or plugins). |
| | 296 | |
| | 297 | However, when words are used in the external preset that already exist in the internal preset, the translation from the internal preset applies to the external as well. This is useful as long as the context is the same. When the context in the external preset is different, it needs to be distinguished by adding `name_context=""`, `text_context=""` or `values_context=""`. |