diff --git a/src/components/fields/CustomDataTypeLink.svelte b/src/components/fields/CustomDataTypeLink.svelte index 8a1f498..5f44a04 100644 --- a/src/components/fields/CustomDataTypeLink.svelte +++ b/src/components/fields/CustomDataTypeLink.svelte @@ -1,4 +1,6 @@ -{fdata.url} \ No newline at end of file +{bestLanguage(fdata.text, $dataLanguagesStore)} \ No newline at end of file diff --git a/src/lib/l10n.js b/src/lib/l10n.js index 5be0d03..60e64fd 100644 --- a/src/lib/l10n.js +++ b/src/lib/l10n.js @@ -3,14 +3,17 @@ const language_priority = ["de-DE", "en-US"]; // Select the best language from the given data export function bestLanguage(data, lang) { // If the selected language exists, we take it - if (lang in data) { - return data[lang]; + for (let l of lang) { + if ((l in data) && (data[l] !== "")) { + return data[l]; + } } // Otherwise we select the language with the highest priority - for (let l in language_priority) { - if (l in data) + for (let l of language_priority) { + if ((l in data) && (data[l] !== "")) { return data[l]; + } } // Finally, we select any language that we can find