#Translated fields don't display the corresponding language value in views

1 messages ยท Page 1 of 1 (latest)

languid mountain
#

I just checked on the cloud version, same behaviour.

languid mountain
#

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 ?

hollow fulcrum
#

Can you elaborate on what you're expecting to see and what you're seeing instead?

languid mountain
#

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...

hollow fulcrum
#

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.

languid mountain
#

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 ?

hollow fulcrum
languid mountain
hollow fulcrum
#

Does it persist when refreshing the page after changing the user language?

languid mountain
#

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, ...)

hollow fulcrum
#

did you create an issue for this?

languid mountain
#

no because I thought that's not the correct usage of the translation feature

hollow fulcrum
#

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 ๐Ÿ˜‰

languid mountain
#

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