Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
A problem on multilingual sites when embedding media objects in the body text area is that each object has to be translated manually. This is due to that title, alt and other attributes are managed where the HTML tags are statistically added.
From what I understand, the media module will manage embedding of media objects quite differently, dynamically embedding them when they are viewed.
Will this also mean that managing translations will be easier and more user friendly?
Comments
Comment #1
JacobSingh CreditAttribution: JacobSingh commentedTo be honest, we really haven't tried to push the limits of i18n support in media yet. It would be *great* if you could and tell us what use cases are missing. since Media is based on the fields / entity APIs, it should be possible to have translatable fields and media entities. But please give it a shot and let us know what's missing.
Thanks,
Jacob
Comment #2
tsvenson CreditAttribution: tsvenson commentedHi Jacob,
I haven't been able to test the media module yet as I am waiting for a dev/alpha to be available.
From what I have seen in some of the demos media object will be embedded in content differently from for example images inserted using traditional Drupal modules, such as the Insert module.
Currently when translating content it works like this:
1 - Click the add translation and select the new language
2 - Translate all the content needed to be translated
3 - Manually edit embedded media files so title/alt etc are in the new language
Step 3 only stores the translation for the embedded media files, uploaded files to the node still has the original language and needs to be translated separately. This makes it a bit confusing since some of these media files might be embedded, while others are not and displayed by for example views.
From what I understand how the media module will work, it will manage the media files as objects and then dynamically create the view code when they are viewed - i.e. not add any static HTML when for example embedded using a WYSIWYG editor.
If that is correct, it will dramatically improve the way translations will be managed since they will only be needed to be done in one place, namely to the media object itself.
So, at least for me, I see two ways of how translations can be administrated for these media object.
- When a node is translated, all media module managed files can be translated at the same time
- Using the admin media browser to locate and add missing translations
In both cases the translations would be stored to the media object and automatically be used in every place that particular media object is being viewed in the language the user is viewing the page in.
I suppose the translation UI should probably be a separate module since not all sites that will use the media module will have need for i18n support.
However, there might be need for some support in the media module for this. For example how to manage translation of public and private files, if only the owner should be able to or that anyone that has the right to embed an object can do it.
Another issue could be if its possible to use a media object, but write a title, alt or text caption that is unique for that particular node, thus not using the global one.
Comment #3
shawn_smiley CreditAttribution: shawn_smiley commentedI'm working on implementing some support related to this for a project. I'd love to hear some feedback from the module maintainers on if this is the best approach.
First, here is our use case:
It's the last point that is really driving our need for a custom module as we need a way of grouping the translated files so that we can tell which languages a given resource file is available in and displaying download links for each file in each available language.
My thoughts on this is to take advantage of the Translation Sets feature of i18n and basically implement the same type of functionality for media/files that the i18n module does for Taxonomy, Menus, and File Paths.
I did look at the entity_translation module, but it only works with fields attached to files right now and not the files themselves. Also it didn't seem to play very well with the i18n module in it's current development state.
Hopefully I'll be able to contribute this work back to either the Media module itself or as a separate project in a couple months.
Does this approach seem reasonable? Are there better approaches that you can recommend?
Thanks,
Shawn.
Comment #4
bmx269 CreditAttribution: bmx269 commented@Shawn_Smiley - I am looking to be able to do this as well, with up to 20 separate languages, any advice or feedback into the problems you had, and how you worked them out would be great.
Comment #5
shawn_smiley CreditAttribution: shawn_smiley commentedWhat I ended up doing was to apply the i18n translation sets concept to files. So for any given file and assigned fields you can select a language and then add that file to a translation set.
This gives you an easy way during the display of a file to check the current site language and either swap out the file display or grab a list of the file in different languages.
The biggest challenge I've found so far (and one that I haven't fully solved) is related to dynamically swapping out the media file based on the site language without having to have the content author select different files in each language. I have it sort of working, but I'm not at all happy with the implementation right now.
Hopefully we'll be able to contribute this module back to the community once the project is completed.
Comment #6
kingjohnnet CreditAttribution: kingjohnnet commentedsub
Comment #7
arthurf CreditAttribution: arthurf commentedComment #8
wzoom CreditAttribution: wzoom commentedHello Shawn,
could you provide your solution for selecting language mutation in File Types /admin/config/media/file-types ?
I hope there is a way to make the file bundles language specific.
Thank you.
Comment #9
shawn_smiley CreditAttribution: shawn_smiley commentedWe're preparing a release here on D.O. for a media translation module. It'll hopefully be up with a release in the next few days. I'll post a link here once we get things in place.
Comment #10
shawn_smiley CreditAttribution: shawn_smiley commentedThe Media Translation module is now up on d.o.: http://drupal.org/project/media_translation
We also have a blog post about it at http://achieveinternet.com/blogs/drupal-7/media-translation
Comment #11
tsvenson CreditAttribution: tsvenson commented@Shawn_Smiley: Read your post and its looks great. However, you should probably have a look at what has happened with especially the 2.x branch of the Media module. There have been big architectural changes especially with a lot of stuff moved to the file_entity module and then the views integration that went in yesterday.
Comment #12
shawn_smiley CreditAttribution: shawn_smiley commentedThanks for the feedback tsvenson. We will definitely be taking a look at the 2.x branch and making updates as things stabilize. This release is pretty much a raw release of what we built for a recent client project that is about to go live.
Comment #13
Dave ReidI think supporting translating files in contrib with media_update is a great way to start! Likely supporting translation of files is out of scope of the Media module itself, so I'm going to mark this issue as fixed. I also added the project to the integration wiki at http://groups.drupal.org/node/168009 - feel free to edit that wiki as desired!