You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
are not applicable for fetching the short name in another language than the UI language (which, I guess, is the usual use case).
However, now, if one wants to display the vocabulary short name in a plugin in the content language, it simply can not be done in a straightforward way (I know that it is possible to make parametrized plugins but it would feel a bit awkward way to convey vocabulary configuration related information via parameters to the plugin).
It could be possible to change the signature of the getShortName() method in VocabularyConfig.php so that the required information could be fetched and used directly in twig templates and exposed to JavaScript (via the normal https://github.com/NatLibFi/Skosmos/blob/master/view/scripts.twig procedure).
There is just one problem here, the current implementation of getLiteral() in BaseConfig.php limits the values returned (may be arbitrary in case of a non-existing literal language value) as default value is only returned in case no value is found for the property in question (this could be solved by following the language order of the vocabulary).
I agree that the short name of the vocabulary needs to be exported to the plugins, probably as a javascript variable like other similar information (vocabulary id, concept URI etc).
However, now, if one wants to display the vocabulary short name in a plugin in the content language, it simply can not be done in a straightforward way (I know that it is possible to make parametrized plugins but it would feel a bit awkward way to convey vocabulary configuration related information via parameters to the plugin).
I don't see a need for expressing the vocabulary name in the content language. For one, it may not be defined at all (consider e.g. Lexvo which has many content languages) since the vocabulary names and short names are usually defined only in the UI languages in the configuration file.
As @osma said in #1084 (comment), short names for vocabularies can be language specific. However, it turns out the related code parts (listed below)
Skosmos/model/VocabularyConfig.php
Lines 106 to 114 in 5a7175e
Skosmos/model/BaseConfig.php
Lines 39 to 64 in 5a7175e
Skosmos/model/Concept.php
Lines 207 to 210 in 5a7175e
Skosmos/model/Vocabulary.php
Lines 633 to 635 in 5a7175e
are not applicable for fetching the short name in another language than the UI language (which, I guess, is the usual use case).
However, now, if one wants to display the vocabulary short name in a plugin in the content language, it simply can not be done in a straightforward way (I know that it is possible to make parametrized plugins but it would feel a bit awkward way to convey vocabulary configuration related information via parameters to the plugin).
It could be possible to change the signature of the getShortName() method in VocabularyConfig.php so that the required information could be fetched and used directly in twig templates and exposed to JavaScript (via the normal https://github.com/NatLibFi/Skosmos/blob/master/view/scripts.twig procedure).
There is just one problem here, the current implementation of getLiteral() in BaseConfig.php limits the values returned (may be arbitrary in case of a non-existing literal language value) as default value is only returned in case no value is found for the property in question (this could be solved by following the language order of the vocabulary).
@osma do you think this is a plausible solution?
The text was updated successfully, but these errors were encountered: