Skip to content

Commit

Permalink
Set lang param of Korp/Strix urls
Browse files Browse the repository at this point in the history
  • Loading branch information
arildm committed Nov 15, 2023
1 parent 5a4bbd3 commit b6150c7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ As this project is a user-facing application, the places in the semantic version

## [Unreleased]

### Fixed

- Set `lang` param of Korp/Strix urls

## [1.0.4] (2023-10-24)

### Fixed
Expand Down
6 changes: 4 additions & 2 deletions src/corpus/exports/Exports.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
:link-text="$t('exports.tools.help.korp.manual.text')"
:can-install="canInstall"
:is-installed="korpStatus.isDone"
:show-url="`${korpUrl}?mode=mink#?corpus=${corpusId}`"
:show-url="`${korpUrl}?mode=mink#?corpus=${corpusId}&lang=${locale3}`"
@install="korpInstall()"
/>

Expand All @@ -25,7 +25,7 @@
:info="$t('exports.tools.help.strix')"
:can-install="canInstall"
:is-installed="strixStatus.isDone"
:show-url="`${strixUrl}?filters=corpus_id:${corpusId}&modeSelected=mink`"
:show-url="`${strixUrl}?modeSelected=mink&filters=corpus_id:${corpusId}&lang=${locale3}`"
@install="strixInstall()"
/>
</div>
Expand Down Expand Up @@ -67,13 +67,15 @@ import { useCorpusState } from "@/corpus/corpusState.composable";
import useJob from "@/corpus/job/job.composable";
import PendingContent from "@/spin/PendingContent.vue";
import ToolPanel from "./ToolPanel.vue";
import useLocale from "@/i18n/locale.composable";
const corpusId = useCorpusIdParam();
const { exports, loadExports, downloadResult, getDownloadFilename } =
useExports(corpusId);
const { isDone } = useCorpusState(corpusId);
const { installKorp, installStrix, sparvStatus, korpStatus, strixStatus } =
useJob(corpusId);
const { locale3 } = useLocale();
const korpUrl = ensureTrailingSlash(import.meta.env.VITE_KORP_URL);
const strixUrl = ensureTrailingSlash(import.meta.env.VITE_STRIX_URL);
Expand Down
8 changes: 7 additions & 1 deletion src/i18n/locale.composable.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { inject, watch } from "vue";
import { computed, inject, watch } from "vue";
import { useI18n } from "vue-i18n";
import { useStorage } from "@vueuse/core";
import { filesize } from "filesize";
Expand All @@ -14,6 +14,11 @@ export default function useLocale() {
document.querySelector("html")?.setAttribute("lang", locale.value);
};

// The ISO 639-3 code is used in many parts of the Språkbanken infrastructure.
const locale3 = computed(
() => console.log(locale.value) || (locale.value == "en" ? "eng" : "swe")
);

// Sync from storage once, if present
if (storedLocale.value) {
locale.value = storedLocale.value;
Expand Down Expand Up @@ -50,6 +55,7 @@ export default function useLocale() {

return {
locale,
locale3,
th,
filesize: myFilesize,
};
Expand Down

0 comments on commit b6150c7

Please sign in to comment.