I have re-opened a couple very old issues on entity translation as i was thinking the issue was with them; but possibly it is more of a views issue.

my use case (pretty simple):

- i have content (single bundle) using entity translation on some fields
- i have a page view which spits out a json array of the fields from my bundle
- the page path is json/data

- if i go to en/json/data, i get the correct English data
- if i go to da/json/data, i get the correct Danish data

perfect!! :)

next, i have a cron routine which loads the data from above and creates a hash on the data (for each language)

i use views_embed_view() to call the view; but have not found a way to set language such that i do not just get English all the time.

i have tried the following:
- within cron loop on language, set global language
- use hints from ET setting a relationship to translations and then use either filter or contextual filter
- set Views Field language to Danish - NOTE, this actually does work except for the Title field (special module to use with ET to replace title property; but this must be a bug in that module). Possibly this can be made to work by using hook_views_pre_execute() to dynamically modify the field language in the view..

is there an easier way of doing this which i have missed?

CommentFileSizeAuthor
view.txt56.38 KBliquidcms
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

liquidcms’s picture

Status: Active » Closed (works as designed)

i was using the wrong global in my cron script. it should be $language_content rather than $language. This now works.