diff --git a/nuxt/app.vue b/nuxt/app.vue
index 8e52080..a289121 100644
--- a/nuxt/app.vue
+++ b/nuxt/app.vue
@@ -1,12 +1,19 @@
diff --git a/nuxt/components/Pojem.vue b/nuxt/components/Pojem.vue
index a6068f6..d2cfb0c 100644
--- a/nuxt/components/Pojem.vue
+++ b/nuxt/components/Pojem.vue
@@ -6,6 +6,7 @@ const { etherFetch } = useEtherpadApi()
const { poskrolaj } = useUi()
const store = usePojmiStore()
+const nastavitveStore = useNastavitveStore()
const route = useRoute()
const props = defineProps({
@@ -16,6 +17,11 @@ if (props.naslov && !(props.naslov in store.pojmi)) {
await store.naloziPojme()
}
+const { izbraniJezik } = storeToRefs(nastavitveStore)
+watch(izbraniJezik, jezik => {
+ store.naloziPojme(jezik)
+})
+
const pojem = computed(() => store.pojmi[props.naslov])
const revisionId = computed(() => pojem.value ? pojem.value.id : null)
diff --git a/nuxt/composables/api.js b/nuxt/composables/api.js
index d1c89d8..4a26bc6 100644
--- a/nuxt/composables/api.js
+++ b/nuxt/composables/api.js
@@ -1,9 +1,18 @@
import jsonapi from 'jsonapi-serializer'
+function idmap(arr, idattr = 'id') {
+ if (!arr) { return {} }
+
+ return arr.reduce((vse, i) => {
+ const id = i[idattr]
+ vse[id] = i
+ return vse
+ }, {})
+}
+
export const useApi = () => {
const { baseUrl, jsonapiPath } = useRuntimeConfig().public
- const apiBaseUrl = `${baseUrl}${jsonapiPath}`
const headers = {
'Content-Type': 'application/vnd.api+json'
}
@@ -16,20 +25,18 @@ export const useApi = () => {
return idmap(ds.map(mapfun), idAttr)
}
+ const jsonApiUrl = jezik => {
+ if (!jezik) {
+ jezik = 'sl'
+ }
+
+ return `${baseUrl}/${jezik}${jsonapiPath}`
+ }
+
return {
baseUrl: baseUrl,
- jsonApiUrl: apiBaseUrl,
+ jsonApiUrl,
headers,
deserialize
}
}
-
-export const idmap = (arr, idattr = 'id') => {
- if (!arr) { return {} }
-
- return arr.reduce((vse, i) => {
- const id = i[idattr]
- vse[id] = i
- return vse
- }, {})
-}
diff --git a/nuxt/lang/en-US.json b/nuxt/lang/en-US.json
deleted file mode 100644
index 1010d29..0000000
--- a/nuxt/lang/en-US.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "domov": "home",
- "jugofuturizem": "yugofuturism"
-}
diff --git a/nuxt/lang/en.json b/nuxt/lang/en.json
index 1010d29..2e1420e 100644
--- a/nuxt/lang/en.json
+++ b/nuxt/lang/en.json
@@ -1,4 +1,7 @@
{
"domov": "home",
- "jugofuturizem": "yugofuturism"
+ "jugofuturizem": "yugofuturism",
+ "Nazaj": "Back",
+ "Vsak lahko prispeva k vsebinam manifesta. Predlaga lahko nov pojem ali ureja, dopolni ali predela obstoječe.": "Anyone can add content to the manifesto. You can suggest a new concept or edit, amend or adjust an existing one.",
+ "Dodaj nov pojem": "Add new concept"
}
diff --git a/nuxt/lang/si.json b/nuxt/lang/sl.json
similarity index 100%
rename from nuxt/lang/si.json
rename to nuxt/lang/sl.json
diff --git a/nuxt/nuxt.config.js b/nuxt/nuxt.config.js
index 2b5f7a3..a79325a 100644
--- a/nuxt/nuxt.config.js
+++ b/nuxt/nuxt.config.js
@@ -58,8 +58,8 @@ export default defineNuxtConfig({
},
i18n: {
locales: [{
- code: 'si',
- file: 'si.json'
+ code: 'sl',
+ file: 'sl.json'
}, {
code: 'en',
file: 'en.json'
@@ -68,7 +68,7 @@ export default defineNuxtConfig({
file: 'hr.json'
}],
langDir: 'lang',
- defaultLocale: 'si',
- fallbackLocale: 'si'
+ defaultLocale: 'sl',
+ fallbackLocale: 'sl'
}
})
diff --git a/nuxt/pages/index.vue b/nuxt/pages/index.vue
index 79c9861..84c464d 100644
--- a/nuxt/pages/index.vue
+++ b/nuxt/pages/index.vue
@@ -1,12 +1,20 @@
+watch(izbraniJezik, jezik => {
+ store.naloziStrani(jezik)
+})
+
+
-
+
diff --git a/nuxt/pages/manifest/dodaj.vue b/nuxt/pages/manifest/dodaj.vue
index 74d5a78..1717057 100644
--- a/nuxt/pages/manifest/dodaj.vue
+++ b/nuxt/pages/manifest/dodaj.vue
@@ -31,7 +31,7 @@ onMounted(() => {
diff --git a/nuxt/pages/manifest/index.vue b/nuxt/pages/manifest/index.vue
index bdcc82f..b2b342a 100644
--- a/nuxt/pages/manifest/index.vue
+++ b/nuxt/pages/manifest/index.vue
@@ -17,9 +17,9 @@ onMounted(() => {
- Vsak lahko prispeva k vsebinam manifesta. Predlaga lahko nov pojem ali ureja, dopolni ali predela obstoječe.
+ {{ $t('Vsak lahko prispeva k vsebinam manifesta. Predlaga lahko nov pojem ali ureja, dopolni ali predela obstoječe.') }}
- Dodaj Nov Pojem
+ {{ $t('Dodaj nov pojem') }}
({
- izbraniJezik: 'hr',
+ izbraniJezik: 'sl',
mozniJeziki: {
- si: 'Slovensko',
+ sl: 'Slovensko',
hr: 'Hrvatski',
en: 'English'
}
@@ -11,8 +11,6 @@ export const useNastavitveStore = defineStore('nastavitve', {
izberiJezik(jezik) {
if (Object.keys(this.mozniJeziki).indexOf(jezik) >= 0) {
this.izbraniJezik = jezik
- console.log(useNuxtApp().$i18n.availableLocales)
- //useNuxtApp().$i18n.setLocale(jezik)
}
}
}
diff --git a/nuxt/stores/pojmi.js b/nuxt/stores/pojmi.js
index 1b83922..8308649 100644
--- a/nuxt/stores/pojmi.js
+++ b/nuxt/stores/pojmi.js
@@ -3,10 +3,10 @@ export const usePojmiStore = defineStore('pojmi', {
pojmi: {}
}),
actions: {
- async naloziPojme() {
+ async naloziPojme(jezik) {
const { jsonApiUrl, headers, deserialize } = useApi()
- const data = await $fetch(`${jsonApiUrl}/node/concept?sort=-changed`, { headers })
+ const data = await $fetch(`${jsonApiUrl(jezik)}/node/concept?sort=-changed`, { headers })
this.pojmi = await deserialize(data, s => ({
id: s.id,
naslov: s.title,
diff --git a/nuxt/stores/strani.js b/nuxt/stores/strani.js
index bcaa10b..9ea411d 100644
--- a/nuxt/stores/strani.js
+++ b/nuxt/stores/strani.js
@@ -3,10 +3,10 @@ export const useStraniStore = defineStore('strani', {
strani: {}
}),
actions: {
- async naloziStrani () {
+ async naloziStrani (jezik) {
const { jsonApiUrl, headers, deserialize } = useApi()
- const data = await $fetch(`${jsonApiUrl}/node/page`, { headers })
+ const data = await $fetch(`${jsonApiUrl(jezik)}/node/page`, { headers })
this.strani = await deserialize(data, s => ({
id: s.id,
naslov: s.title,
diff --git a/web/sites/default/default.services.yml b/web/sites/default/default.services.yml
index a2eb26d..c4b964f 100644
--- a/web/sites/default/default.services.yml
+++ b/web/sites/default/default.services.yml
@@ -206,14 +206,16 @@ parameters:
# for more information about the topic in general.
# Note: By default the configuration is disabled.
cors.config:
- enabled: true
+ enabled: false
# Specify allowed headers, like 'x-allowed-header'.
allowedHeaders: []
# Specify allowed request methods, specify ['*'] to allow all possible ones.
allowedMethods: []
# Configure requests allowed from specific origins. Do not include trailing
# slashes with URLs.
- allowedOrigins: ['yufu.kompot.si', 'localhost']
+ allowedOrigins: ['*']
+ # Configure requests allowed from origins, matching against regex patterns.
+ allowedOriginsPatterns: []
# Sets the Access-Control-Expose-Headers header.
exposedHeaders: false
# Sets the Access-Control-Max-Age header.