Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dafeder’s picture

Status: Active » Needs review
FileSize
475 bytes

Not always sure where it's appropriate to add a t(), but here goes.

Dave Reid’s picture

Issue summary: View changes

Shouldn't the proper way to handling this is to allow the formatter configuration to be translatable?

Leksat’s picture

I 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.

rodrigoaguilera’s picture

Version: 7.x-2.0-alpha2 » 7.x-2.x-dev
Status: Needs review » Reviewed & tested by the community

Yeah 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().

stefan.r’s picture

Uploading a reroll.

I doubt Dave Reid will commit this as such, so ideally someone addresses #2

dafeder’s picture

FWIW I agree #2 is the preferable approach

Ludo.R’s picture

Nixou’s picture

I 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.

stijndmd’s picture

This may not be very relevant any more, but the patch in #8 works a charm and looks a great solution.

joseph.olstad’s picture

Status: Needs review » Reviewed & tested by the community

Ping me in a few weeks if I haven't yet committed the patch, it looks great, thanks!

  • joseph.olstad committed be94c97 on 7.x-3.x authored by Nixou
    Issue #2097261 by dafeder, Ludo.R, stefan.r, Nixou, Dave Reid, Leksat,...

  • joseph.olstad committed 5ffcd1b on 7.x-2.x authored by Nixou
    Issue #2097261 by dafeder, Ludo.R, stefan.r, Nixou, Dave Reid, Leksat,...
joseph.olstad’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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