Closed (fixed)
Project:
Translation Management Tool
Version:
7.x-1.x-dev
Component:
Core
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
3 Dec 2012 at 11:36 UTC
Updated:
6 Jan 2013 at 14:51 UTC
Jump to comment: Most recent file
Comments
Comment #1
bforchhammer commentedBetter title.
Comment #2
miro_dietikerSeems a severe bug to me. Source is source and should never contain any translated item.
There is plan to add a feature to deal with changes but it will never behave that way. It will present the diffs to the editors when creating the job.
This however will not be introduced by TMHMT OHT but TMGMT core instead.
However, can you please provide a clean description on how to reproduce this? (step-by-step conditions, settings chosen)
We need to reproduce this easily to fix it.
Comment #3
berdirI assume you're using entity translation?
Could be that we are somehow fetching the wrong field values from the source. Maybe some sort of language fallback configuration that gets in the way?
Something to help track this down would be to try another translator (e.g. file export or the test translator) if this is something that happens in TMGMT core.
Comment #4
berdirAlso, I think you known translatable fields/entity translation quite well, I suspect the error is in text_tmgmt_source_translation_structure() in tmgmt_field.module. We're calling field_language() there, which is probably wrong as something could change it to English.
Comment #5
bforchhammer commentedYes, I'm using entity translation. And this does indeed also happen with the file translator, so I'm moving this to the tmgmt queue...
Yes, that sounds off. AFAIK
field_language()falls back to the current display language (active content language) if the last parameter ($landcode) is not supplied... sounds like the fix might be to force that to the correct source language...I'll see if I can produce a patch.
Comment #6
bforchhammer commentedHere's a patch... :)
Steps to reproduce (with "file export translation"):
Comment #7
berdirThanks!
Wondering if we should already pass the field values in the correct language to the hook, that would simplify that a lot.
Comment #8
bforchhammer commentedHm, we could just pass the result of field_get_items()... I can't say whether you'd ever need the entity object in a hook implementation.
Comment #9
berdirYes, I like this, looks much easier, I know that @swentel is doing some crazy things on saving the values back, see #1428900: Provide a hook for field types when populating translations., maybe check with him to see if this would affect him sowhoe.
I guess we need to update the api docs here, in case we actually have some :)
The fact that this did pass the tests might mean that we don't need that $field_translation flag anymore. Need to look at it again in detail. If that's so, the we can throw it away completely.
And we should also add some test coverage for this.
Comment #10
swentel commentedbforchhammer asked me to quickly chime in. I'm fine with the changes, I can still do what I want with the code I have in a custom project, I just need to track this in case the api changes :) However, you never know someone really really wants to check something on the entity object - although I can't think of a use case at this point, so I guess that's for the tmgmt's maintainers to decide.
Comment #11
berdirRight, so what about this. We use the same arguments as hook_field_formatter_view() except $display, which means "$entity_type, $entity, $field, $instance, $langcode, $items". The advantage of that:
- $items is right there and easy to use
- If needed, you get all the information you need, the entity, language, field and field instance to do all kinds of crazy things
- It is familiar to everyone who is used to write field formatters/types, and that's developers likely do if they have to implement this hook.
I have a strange fail locally, let's see if this works here.
Comment #12
bforchhammer commentedCool, makes sense and works for me! :-)
Thanks for chiming in, @swentel!
Comment #13
berdirGreat, commited and documented in http://drupal.org/node/1873034.