KeyValue Dictionary - merge from layer #1827
Replies: 4 comments
-
This wouldn't benefit the framework itself. I think we should re think the current structure and shift out the dictionaries into files that are read from a remote source like what was originally discussed :) |
Beta Was this translation helpful? Give feedback.
-
If I understand this right the issue is that the keyvalue dictionary imported from a file [template] into the locale is too big? The layer decorate method does also call plugins. It would therefor be possible to define a keyvalue_dictionary object on the layer which would be executed before the layer is returned from the decorator method. |
Beta Was this translation helpful? Give feedback.
-
@dbauszus-glx Yes that's right. When you have a template with lots of key value dictionary objects in it, it can get huge and hard to maintain. Being able to define the key value dictionary on each layer would provide separation and make maintain easier, more isolated |
Beta Was this translation helpful? Give feedback.
-
This worked for me. The OSM value first became OpenStreetMap from the locale dictionary and then OpenStreetMap_layer from the layer dictionary. "locale": {
"keyvalue_dictionary": [
{
"key": "name",
"value": "OSM",
"default": "OpenStreetMap"
}
],
"layers": {
"OSM": {
"display": true,
"name":"OSM",
"format": "tiles",
"URI": "https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png",
"attribution": {
"© OpenStreetMap": "http://www.openstreetmap.org/copyright"
},
"keyvalue_dictionary": [
{
"key": "name",
"value": "OpenStreetMap",
"default": "OpenStreetMap_layer"
}
]
}
}
} |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
The current implementation of keyvalue dictionary is proving very hard to maintain.
Currently, we have a
translations.json
that is already over 3000 lines long containing replacements for all layers, infoj, themes etc in the whole locale.It would be really nice if a template (layer) could have its own keyvalue_dictionary array that would allow us to maintain the translations on a layer level, rather than having these gigantic files that try to hold everything.
These large files are hard to maintain, hard to find anything in, hard to keep up to date. But a smaller array on the layer would be easier to maintain as you could keep it updated when you made changes to the file.
My thought process was:
Template is loaded > keyvalue_dictionary array is on the template > loop over all layers in the locale and assign the
layer.keyvalue_dictionary
tolocale.keyvalue_dictionary
.Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions