Closed (fixed)
Project:
File Entity (fieldable files)
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
25 Sep 2013 at 02:11 UTC
Updated:
29 Dec 2021 at 23:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dafederNot always sure where it's appropriate to add a t(), but here goes.
Comment #2
dave reidShouldn't the proper way to handling this is to allow the formatter configuration to be translatable?
Comment #3
leksat commentedI did some research. It's hard to use i18n_string here, because the string can come from a regular field formatter or from a panel pane. We need some relevant context to use i18n_string() and in case of panels it is not available.
The i18n_panels module tries to solve the similar issue. It provides "i18n_settings" option for content type plugins.
Both i18n_string and i18n_panels solutions would be hard to implement. I personally used #1 patch. It's not the proper way, but it works.
Comment #4
rodrigoaguileraYeah I think it makes sense to solve this issue with this patch for now. If the number of strings that can be configurable and translatable grows makes sense to make a new translation group with i18n_string.
For example the field_group module manages the labels with t().
Comment #5
stefan.r commentedUploading a reroll.
I doubt Dave Reid will commit this as such, so ideally someone addresses #2
Comment #6
dafederFWIW I agree #2 is the preferable approach
Comment #7
ludo.rReroll this patch against latest dev version.
Comment #8
nixou commentedI wrote a patch to have the download link text translatable through i18n_string (as it's a better approach since t() has not to be used on variables).
The approach is simple using a new group "File entity" and the hook_i18n_string_list().
Declared strings use the link text in the i18n_string key so it's possible to have different text per view mode for a same field in a same bundle.
I didn't use the view_mode directly in the key because this information is not available in hook_field_formatter_view() so I can't rebuild the key there.
To use this patch you need to have the i18n_string (submodule of i18n) enabled and go to admin/config/regional/translate/i18n_string to refresh "File entity" strings.
After that you will find strings into admin/config/regional/translate/translate filtering by "File Entity" group.
Comment #9
stijndmd commentedThis may not be very relevant any more, but the patch in #8 works a charm and looks a great solution.
Comment #10
joseph.olstadPing me in a few weeks if I haven't yet committed the patch, it looks great, thanks!
Comment #13
joseph.olstad