Skip to content

Commit

Permalink
Search bar language selector according to the vocabulary config langu…
Browse files Browse the repository at this point in the history
…ages
  • Loading branch information
Takala Joeli A committed Oct 3, 2024
1 parent 3386c6d commit 70dc769
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
2 changes: 1 addition & 1 deletion resource/js/vocab-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const vocabSearch = Vue.createApp({
this.languages = window.SKOSMOS.languageOrder
this.selectedLanguage = this.parseSearchLang()
this.searchCounter = 0 // used for matching the query and the response in case there are many responses
this.languageStrings = window.SKOSMOS.language_strings[window.SKOSMOS.lang] ?? window.SKOSMOS.language_strings.en
this.languageStrings = window.SKOSMOS.language_strings
this.msgs = window.SKOSMOS.msgs[window.SKOSMOS.lang] ?? window.SKOSMOS.msgs.en
this.renderedResultsList = []
this.showNotation = window.SKOSMOS.showNotation
Expand Down
40 changes: 25 additions & 15 deletions src/view/scripts.inc
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
<!-- Skosmos variables passed from the backend to the frontend code-->
<!-- NB: Do not add comments inside the JS object as it would break JSON parsing -->
<script id="skosmos-global-vars">
{% set mockup_translations = {
"fi": {
"fi": "suomi",
"en": "englanti",
"se": "pohjoissaame",
"sv": "ruotsi",
"all": "kaikilla kielillä"
},
"sv": {
"fi": "finska",
"en": "engelska",
"se": "nordsamiska",
"sv": "svenska",
"all": "på alla språk"
},
"en": {
"fi": "Finnish",
"en": "English",
"se": "Northern Sami",
"sv": "Swedish",
"all": "In all languages"
}
} %}
window.SKOSMOS = {
"content_lang": "{{ request.contentLang }}",
"explicitLangCodes": {{ explicit_langcodes ? "true" : "false" }},
Expand Down Expand Up @@ -33,21 +56,8 @@ window.SKOSMOS = {
},
{%- endif -%}
"baseHref": "{{ BaseHref }}",
"language_strings": { "fi": { "fi": "suomi",
"en": "englanti",
"se": "pohjoissaame",
"sv": "ruotsi",
"all": "kaikilla kielillä"},
"sv": { "fi": "finska",
"en": "engelska",
"se": "nordsamiska",
"sv": "svenska",
"all": "på alla språk"},
"en": { "fi": "Finnish",
"en": "English",
"se": "Northern Sami",
"sv": "Swedish",
"all": "In all languages"}},
"language_strings": { {% for lang in request.vocab.config.languages %}"{{ lang }}": "{{ mockup_translations[request.lang][lang] }}", {% endfor -%}
"all": "{{ mockup_translations[request.lang].all }}" },
"msgs" : { "fi": { "No results": "Ei hakutuloksia",
"http://www.yso.fi/onto/yso-meta/Concept": "Yleiskäsite",
"http://www.yso.fi/onto/yso-meta/Hierarchy": "Hierarkisoiva käsite",
Expand Down

0 comments on commit 70dc769

Please sign in to comment.