#Translated fields don't display the corresponding language value in views
1 messages ยท Page 1 of 1 (latest)
Solved with a crappy hack : add the language code field somewhere in the view and hide it with a custom style (.null { display: none; })
the language code field isn't fetched by the collection request, so the translation filter condition or indexed array can't work...
maybe there is an issue with my language code field ? What can I check ?
Can you elaborate on what you're expecting to see and what you're seeing instead?
Hello Tim, I want to see the translated value corresponding to my user selected language.
But for bypass this issue, I duplicated all my translated fields in the main table...
The translation interface should show you the values for the language you've selected (or the default selected). Not quite sure what's not working for you, and where in the app, sorry.
When I switch my user language, the value stay in the original language
But If I add the language code column in the collection table, it works
a query relation issue
the result don't contains the languages values (join)
language_code.code can't works
it works only when you add this language_code in the view fields
did you see my screencast ?
I did not, just going off the info in this thread ๐ฌ
Does it persist when refreshing the page after changing the user language?
yes
logout / login too
Now I'm working with another data model : collection (name, desc, translations) => translations (name, desc)
I would be to do : collection (translations) => translations (name, desc)
but apparently Directus don't like this kind of structure, lof of bugs (this one, m2m relation, ...)
did you create an issue for this?
no because I thought that's not the correct usage of the translation feature
I remember this display still showing "2 Items" (or however many translations you had) so this feature is new to me ๐ฌ but looks like it was changed to try and show a configured language or the user language as fallback. so this would be a bug ๐
ok
the 2 items display it's when you disable the translation display extension
wait
in displays/translations/translations.vue
the line : item = props.value.find((val) => val?.[langField]?.[langPkField] === user.currentUser?.language) ?? item;
I fixed with this : item = props.value.find((val) => (val?.[langField]?.[langPkField] ?? val?.[langField]) === user.currentUser?.language) ?? item;
for loading the correct value with only the language code ("en-US", ...) and without the linked languages table