Like text, files can be in different languages and it is something we need to support for File Entity, especially considering one of the goals is Dupal 8 Core.

Any file can be language dependent, and it would be a great addition if we could add that with the File Entity module.

Like when nodes are translated, we also need relations between the language versions. If for example a Swedish version exists for the English version I am looking at.

It would be brilliant if we then also can get this working with node/entity translations.

I spoke briefly with Gabor Hojtsy about this in IRC and he said step one would be to add a 'langcode' field on files, like there is one for nodes and comments for example. However, langcode will only be possible for Drupal 8 at this moment.

The node table has a language column, but the file_managed does not, so how can we add that without having to alter a core table?

Gabor said this to me in IRC:
- well, it would basically need to start off copying the node module language assignment
- IMHO
- first of all the most basic functionality is to saying "X is in language Y"
- and that is very simple and solved if you can assign a language to the entity

Can we make this happen?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dave Reid’s picture

Priority: Major » Normal
Status: Active » Postponed

I'm hesitant to support this since I'm a little unsure how much this makes sense for 80% of our users. I'm still pretty firmly in the camp that file_entity should make it possible for another module (either http://drupal.org/project/media_translation or http://drupal.org/project/entity_translation) to enable translation of files but not actually do anything itself.

tsvenson’s picture

Will take a deeper look on those modules. Entity Translation I already use.

However, there might be things we can/need to add to this module to make it easier to add support for multilingual for other modules. I'm not a coder, so basically just thinking out loud about this.

Dave Reid’s picture

Likely we'll need something like this to support multilingual files in file_entity. Still warrants discussion.

tsvenson’s picture

Not sure, but if I understood Gabor correct, langcode is Drupal 8 stuff. Or is it available in D7 as well?

Dave Reid’s picture

You can name a language field whatever you want. Naming it langcode would save us an update step in D8.

tsvenson’s picture

Smart thinking. Have allocated a few h later this week to play around with the above mentioned language modules and see how it works.

plach’s picture

Status: Postponed » Needs review
FileSize
489 bytes

I ain't sure #3 makes sense without an actual langcode column in the schema definition. The attached patch will enable translating file entities through Entity Translation and would be forward-compatible with a langcode column addition (provided that a 'language' => 'langcode' entity key in the entity info is defined).

plach’s picture

plach’s picture

Title: Add multilungual support for files » Add multilingual support for files

This and #1470018: Provide Entity Translation integration are the last blockers for the first Entity Translation beta. It would be great to have some feedback ASAP :)

bforchhammer’s picture

Status: Needs review » Reviewed & tested by the community

Pretty straightforward change which shouldn't break anything for people on old versions of Drupal or without language-related things enabled... so RTBC, I think.

For reference, entity_language was introduced in D7.15.

ParisLiakos’s picture

Status: Reviewed & tested by the community » Fixed

thanks, pretty straightforward, commited

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

sarci’s picture

Issue summary: View changes
FileSize
624 bytes

Rerolled patch.

sylus’s picture

Should this issue be reopened because this code is no longer in dev. Patch works.