0

Give an entity field that has been translated into the target language, how do I retrieve a specific language version using SQL - not php.

Give this query for instance (using an imaginary field called data on an entity form):

SELECT field_method_value 
FROM entityform
LEFT JOIN field_data_field_method
ON entityform.entityform_id = field_data_field_method.entity_id

And assuming that we have a default language of English (en) and Spanish (es) enabled on our site, and that a translated value for the spanish version of the field is stored...

What SQL statement would return the Spanish version rather than the English one?

0

The field language is stored in the language column of each row in the field table.

So you just need to add a simple condition to your SQL, e.g.

language = 'es'
  • Got it - how lovely to find it so simple, even if embarassing to have missed it! - Many thanks Clive. – theTechnaddict Nov 19 '15 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.