DigitalCommons / mykomap

A web application for mapping initiatives in the Solidarity Economy
3 stars 0 forks source link

Add support for localised title of a drop-down filter in the search panel #200

Closed ColmDC closed 11 months ago

ColmDC commented 1 year ago

Is your feature request related to a problem? Please describe. In order to support multiple filters using the same vocabulary in the search panel, we can no longer easily provide localisation for drop down titles. Specifically, by enabling support for having a filter for the combined Primary and Secondary activities and also one for just primary activities, we then broke the localised titles for the ICA filters. We were able to support the ICA localised titles before, because it had only one filter per vocab.

Describe the solution you'd like Make it possible to configure localised titles for filters in the search panel. It needs to support the old ICA arrangement in sea-map@1.3.2_981470f as well as support nice titles (not identifier names in camel format) for the OBO panel.

Considerations When looking at this, consider if this change would also easily support other map specific localisations. For example, we may have the localised label of a field to hand, but it was chosen by someone technical and is an accurate title, but we are displaying a map for a non technical audience, so want something friendlier, can we support that?

Estimate I've not looked at that closely yet, estimate it might be hours to a day on mykomap,

ColmDC commented 1 year ago

From element thread I think the sensible thing might be just to hand-craft these sorts of vocabs and include the json file along with things like the HTML and CSS, in the map project, to be deployed on the website.)

An example of the kind of thing I mean: this file is deployed along with a map website. It has one vocab, activities-modified, in English only. (Ignore the meta field, it's informational only, not required.) https://dev.maps.solidarityeconomy.coop/temp/obo-public/vocabs.json

Which is approximately equivalent to: https://github.com/DigitalCommons/map-sse/blob/ica10-draft-locality-vocabs/vocabs/standard/activities-modified.ttl

(Although that vocabs.json is still there only by historical accident. It should be removed. ObO should be using one generated by the sausage factory and deployed with the ObO RDF and CSV files if we want it to update whenever - if! - the vocab changes.)

ColmDC commented 1 year ago

So what would the workflow of this look like for both ICA and OBO requirements?

wu-lee commented 1 year ago

For ICA, perhaps define a field-vocabs.json file, and add it to the ICA map project as an asset deployed along with the HTML and JS. It might look like this (abbreviated) example:

{
  "prefixes": {
    "https://dev.lod.coop/ica/ui/": "ui"
  },
  "meta": { // elided...
  },
  "vocabs": {
    "ui:": {
      "EN": {
        "title": "ICA Map UI phrases",
        "terms": {
          "ui:primaryActivity": "Primary Activity",
          "ui:activities": "Secondary Activities",
          "ui:regOrg": "Organisational Structure",
          "ui:baseMembershipType": "Typology",
          // etc...
        }
      }
    }
  }
}

Mykomap already knows how to load these files, which are currently used to define vocabs. We would need to teach Mykomap that custom fields should be localised using a vocab, perhaps by telling it which vocab (or vocabs) to use in the config. Then, when it renders a field called primaryActivity it looks up the localised title for the current language in this vocab and gets "Primary Activity".

We can use this for other localisation purposes - it probably solves the problem we have from having hard-wired localisation in Mykomap's source code for just EN, FR, ES, KO, because we could define the entire UI's localisation like this, and use it to add or over-ride built-in phrases. Perhaps with a bit of thought it would work for spacial-casing things like "All Countries" too? (Although there still needs some way of recognising the need to special-case.)

(Ditto for Owned by Oxford, but with different languages and phrases)

ColmDC commented 1 year ago

teach Mykomap

Finally we are going to use AI in this project!

wu-lee commented 1 year ago

Possible duplicate of #199?

ColmDC commented 1 year ago

Perhaps they are both addressed with the same new finctionality, but with this ticket I wanted to be support the ability for an ICA map to call the Typology Filter 'Typology' and other maps to call it 'Base Member Type', say, which I didn't think would necessaroity be a consequence of solving #199.

wu-lee commented 1 year ago

I think it would be solved by #199 - the localisations for the ICA could be different. See also https://github.com/DigitalCommons/mykomap/issues/178#issuecomment-1547543206

wu-lee commented 11 months ago

This is now implemented in the 3.1.0 release of Mykomap, and is utilised in the latest Dotcoop2023 demo map here: https://dev.maps.solidarityeconomy.coop/temp/dotcoop2023/

ColmDC commented 11 months ago

Possible duplicate of #199?

So did we decide if this was Duplicate of this? #199 seems to have suggestions for some documentation there, so wouldn't want to close it too quickly.

ColmDC commented 11 months ago

This is now implemented in the 3.1.0 release of Mykomap, and is utilised in the latest Dotcoop2023 demo map here: https://dev.maps.solidarityeconomy.coop/temp/dotcoop2023/

Looking good. Can we also validate by upgrading the ICA map on dev to 3.1.0 and use the old terms for Topology etc.?

ColmDC commented 11 months ago

Which other recently updated map(s) demonstrates this functionality working? @wu-lee

ColmDC commented 11 months ago

Which other recently updated map(s) demonstrates this functionality working? @wu-lee

https://dev.maps.solidarityeconomy.coop/ncba/ of course.

So closing this. Will be nice upgrade other to 3.1.0 in good time.