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?
Comment | File | Size | Author |
---|---|---|---|
#13 | file_entity-language-1418644-13.patch | 624 bytes | sarci |
#7 | file_entity-language-1418644-7.patch | 489 bytes | plach |
#3 | 1418644-file-langcode-support.patch | 1.12 KB | Dave Reid |
Comments
Comment #1
Dave ReidI'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.
Comment #2
tsvenson CreditAttribution: tsvenson commentedWill 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.
Comment #3
Dave ReidLikely we'll need something like this to support multilingual files in file_entity. Still warrants discussion.
Comment #4
tsvenson CreditAttribution: tsvenson commentedNot sure, but if I understood Gabor correct, langcode is Drupal 8 stuff. Or is it available in D7 as well?
Comment #5
Dave ReidYou can name a language field whatever you want. Naming it langcode would save us an update step in D8.
Comment #6
tsvenson CreditAttribution: tsvenson commentedSmart thinking. Have allocated a few h later this week to play around with the above mentioned language modules and see how it works.
Comment #7
plachI 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 alangcode
column addition (provided that a'language' => 'langcode'
entity key in the entity info is defined).Comment #8
plachRelated issues: #1470018-8: Provide Entity Translation integration and #1418076: Allow for multiple base paths.
Comment #9
plachThis 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 :)
Comment #10
bforchhammer CreditAttribution: bforchhammer commentedPretty 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.
Comment #11
ParisLiakos CreditAttribution: ParisLiakos commentedthanks, pretty straightforward, commited
Comment #13
sarci CreditAttribution: sarci commentedRerolled patch.
Comment #14
sylus CreditAttribution: sylus commentedShould this issue be reopened because this code is no longer in dev. Patch works.