We have alt and title fields now (https://drupal.org/node/1307054)

But they are language neutral, the same text is shown on all languages.

Files: 
CommentFileSizeAuthor
#15 interdiff-10-15.txt1.47 KBidebr
#15 media-popup_translations-2017647-15.patch5.19 KBidebr
PASSED: [[SimpleTest]]: [MySQL] 1,095 pass(es). View
#10 media-popup_translations-2017647-10.patch4.36 KBLeksat
PASSED: [[SimpleTest]]: [MySQL] 922 pass(es). View
#4 Screen Shot 2013-06-25 at 10.35.07 AM.png102.93 KBmgifford

Comments

rob_johnston’s picture

I think this is related: #1470018: Provide Entity Translation integration. Still working through this myself.

mgifford’s picture

Ok, so that issue for Entity Translation was fixed in October, but I think this is still a problem with at least the released version of Media.

@rob_johnston did you get it working?

rob_johnston’s picture

That issue gave me some clues as to what to expect and let me try to list them here (hope I don't skip a step):

  1. I went to /admin/config/regional/entity_translation and under "Translatable entity types" I enabled "File".
  2. On the same page, for the "File" type I now have the "Image" set to default to the current language and to exclude language neutral (my preference).
  3. I then went to /admin/structure/file-types and for the "Image" type, under "Manage fields", I edited the "Alt Text" and "Title Text" and clicked "Enable translation" at the bottom.
  4. I then edited the content type and synchronized the image field across translations

So when I do that, after creating the content in English, saving, and creating the translation in French, I click the edit button for the image. I then see a new button up on the top left (easy to miss) that says "Add French translation" and a drop-down that indicated that I'm currently editing the English version. This is the clue that I got from the referenced issue. This form that pops-up is very similar to the full file edit form (e.g. if I know my file is saved as number 1234 then I could go to /file/1234/edit).

So, does this work for anybody else? Non-intuitive, I'd say, and I think that this pop-up form should be in the current language so the "Add French translation" button could disappear. It's an extra step that would be easy for a user to forget to do.

mgifford’s picture

I'm trying to replicate this, but having trouble. I've got the alt text translation enabled here:
eng/admin/structure/file-types/manage/image/fields/field_file_image_alt_text

But I'm also using the media module so that might be messing things up. When I edit an image here:
eng/admin/content/file/edit-multiple/34

I don't see anything that allows me to edit the image.

In step 4 when I edit an image I'm not seeing anything for the translation:

Screen Shot of Media module pop-up

But ya, definitely not intuitive.

rob_johnston’s picture

It's possible that I forgot a step, but I can't think what it might be.

When you go to edit an individual file from the /admin/content/file/edit-multiple page, do you get the "Translate" link on the top-right of the screen?

It wasn't until I synchronized the image field between translations that I saw the "Add French translation" button appear on the top left of that pop-up form that you attached. If the image has a different file number in both languages then the button doesn't appear. If you were to add a line to the "entity_translation" table where entity_type=file, entity_id=34, language=fr, source=en, status=1, and translate=0, etc, would you then see the button?

supermoos’s picture

Did any of you find a way to enable alt and title translations? I have enabled the alt & title fields as translatable under the file types. And under /admin/config/regional/entity_translation, I've also tried both enabling and disabling field translation of the image field on my content type - seems to make no difference. The only thing that seems weird is that under my node content type edit form and the "Synchronize translations"-tab, no fields are available for synchronization?

davidk2’s picture

re: #3 rob_johnston - it works for me. Both fields (alt + title) are translated now, but title + alt atributes in HTML code has still only one language in all translated entities/images.

pikku-h’s picture

Im not sure if this should be separate issue, but the same thing happens without translations:

  1. Node 1 has image with title "Title 1"
  2. Create Node 2, pick (the same image as in Node 1) image from library and set image title to "Title 2"
  3. Node 1 image title is now "Title 2"
mgifford’s picture

Issue summary:View changes
Issue tags:+accessibility, +i18n
Leksat’s picture

Version:7.x-2.0-unstable7» 7.x-2.0-alpha4
Status:Active» Needs review
FileSize
4.36 KB
PASSED: [[SimpleTest]]: [MySQL] 922 pass(es). View

Here is a patch providing basic support for entity translation. I've tested in only with media field.

The translation support works only if both parent entity and file entity are managed by entity_translation module.

The file entity translation handler in the media popup form inherits form/source language from the parent entity translation handler when it's possible.

I've made the patch on the base of 7.x-2.0-alpha4 because latest 7.x-2.x (3fc13e9) does not work for me at all.

J-Lee’s picture

Patch #10 is working for me (7.x-2.0-alpha4). Thank you Leksat!

Edit: If you use fields for alt and title text:
I noticed that the file/image default language should set to "current language" at the entity translation settings. If not, alt and title text won't shown after uploading new imagesbecause they are in a wrong language.

Sebbon’s picture

Patch works on alpha4. It does not give me a language/translation switcher button in the mediabrowser popup when editing a image in a node. However, if I switch to the other language during editing of the node (using the language switch of the node) and then open the image file media browser with the edit button I see the translatable fields for Alt and Title. Works like a charm.

Drupal 7.36
Media 7.x-2.0-alpha4+37-dev

Ahmad Abbad’s picture

Patch #10 is working for me (7.x-2.0-alpha4).

FiNeX’s picture

Im' using the latest -dev version ( 2015-Jun-30 ) and the parent entity is translated using i18n (not entity translation).

The file entity is translatable: on file/edit/ID the "translate" tab is visible and it works fine (switching the language the alt/tab attributes are correctly loaded) but the media browser popup always loads the file entity using the default language and it doesn't show the translation switcher.

idebr’s picture

Version:7.x-2.0-alpha4» 7.x-2.x-dev
FileSize
5.19 KB
PASSED: [[SimpleTest]]: [MySQL] 1,095 pass(es). View
1.47 KB

I updated the patch with the use case from #14

hefterbrumi’s picture

I am having a problem with this. I am using media module, the language switcher is loaded correctly (3 language site). However if I empty all caches, all my images alt and title field becomes "stuck" in the language that was the current one when I emptied the cache (so If a user changes language with the language switcher alt and tilte texts stays the same).
If I resave a contect (e.g portfolio Item) the alt and title field will change and stuck in the language that was active when I resaved the content.

I dont know if this is a media or entity translation issue. I am using the latest dev releases of them.

I have to correct this:
If I empty all caches or resave the content type my alt text (and title) translations behaves abnormally. They become mixed up. If I browse an image through the file browser, click view and change the language with the language switcher it works fine, however if I do the same on any content types (or views) where the images are served through media module it will be mixed up.

mgifford’s picture

Can you tell us how to replicate it on SimplyTest.me?

Will be the best way to determine if it is an issue with your site or this patch.

hefterbrumi’s picture

I learned that this might not be a media issue but entity translation. I have posted my tests here, plese take a look:
https://www.drupal.org/node/1511446

stefan.r’s picture

Priority:Normal» Major
Status:Needs review» Reviewed & tested by the community

#15 works like a charm and the code looks OK!

IMO this should be major as Alt and Title fields really ought to be translatable.

#18 seems to be referring to the issue in #16, so it should not block this patch

doitDave’s picture

@#19 +1 for the priority, subscribed. i18n should be considered #1, it is one of Drupal's best powers.

james.williams’s picture

Patch #15 only covers the case of a translatable parent entity (with translatable fields on the referenced file entity). The case of an untranslatable parent entity referencing file entity that is translatable will need resolving. But in order to to avoid holding up the work on the case that patch #15 is aiming for, it may be best to deal with that in a second issue (which would be blocked on this work until this first case is resolved).

stefan.r’s picture

Title:Media browser translatable alt and title fields» Media browser translatable alt and title fields for translatable parent entity
hefterbrumi’s picture

I think my issue is related to this as well. It makes media useless for me to translate alt and title fileds of translatable image entities. Although Now I think it is likely a file entity problem.

Image Alt and Title displayed in the wrong language IF field format is not "rendered file"