We've long wanted this functionality.
I brought it up
July 21 2020
🐛
Token for entity reference returns default language instead of translation
Needs work
wondering if it would be possible to allow the tokens to process a language suffix in the token to get the specific language value otherwise grab the current interface language
@berdir had this to say July 22 2020 🐛 Token for entity reference returns default language instead of translation Needs work :
The language is passed in as an option, token syntax simply isn't flexible enough to allow arguments like that. Each token has one type and has to pass things to its children.
In response to @berdir, obviously for us wanting this functionality, it should only be enabled when there are multiple languages available so I don't see the argument for concern about the number of tokens. It could be also an optional functionality which could be disabled by default but enableable.
(examples):
[term:field_company_code:fr]
and [term:field_company_code:nl]
[node:field_name:fr]
and [node:field_name:nl]
(examples):
[node:fr:field_company_code]
and [node:nl:field_company_code]
[node:fr:field_name]
and [node:nl:field_name]
(examples):
[node_fr:field_company_name]
and [node_nl:field_company_name]
node_xx
, string parse it and set the langcode to xx
.[node:field_company_name_fr]
and [node_nl:field_company_name_fr]
field_company_name_xx
, string parse it and set the langcode to xx
.We need to have standard tokens for things like nodes which are for a specific language. For things like multi-language emails it is not sufficient to simply use the current context language to determine the language of the token value.
So for a token like this: [node:field_shared_node:entity:title], we need something like [node:field_shared_node:entity:title:fr]
not sure the best format for this, just adding langcode to the end seems like it would be difficult to parse as not being for something else. Looking at date tokens as an example they do not seem to worry about this as these are all valid:
date:custom:?
date:format_1
date:format_2
Maybe something like: [node:field_shared_node:entity:title:language:fr] would be preferred?
I have seen a few other language specific token issues and this exact issue reported in one of them but the reply was that it was out of scope of that particular issue - so guessing this hasn't yet been requested in its own issue. Apologies if it has been.
Also, not sure if this would be part of this module or perhaps its own contrib module?
Active
1.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.