Score:0

How can I get a list of all languages translation that a node has?

ng flag

I'm trying to get a list of language translations that a node has in theme_preprocess_node(). I have the node object and can check for a translation on a one-by-one basis, if I have the list of languages. What I need is a list of all the translations for the node.

Score:1
cn flag

Use getTranslationLanguages():

$languages = $node->getTranslationLanguages();

foreach ($languages as $id => $language) {
  print $node->getTranslation($id)->label();
}
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.