Thoughts on adding in translation support to this module?
It could be as simple as adding in the following four lines (although possibly something even easier, although this is what I did since I need it today).

Starting on line 105 on jquery_expander.module

$settings['expandText'] = t($settings['expandText']);
$settings['expandPrefix'] = t($settings['expandPrefix']);
$settings['userCollapseText'] = t($settings['userCollapseText']);
$settings['userCollapsePrefix'] = t($settings['userCollapsePrefix']);

Comments

mh86’s picture

StatusFileSize
new2.08 KB

We cannot use the t() function for dynamic strings. Instead a proper i18n field integration is needed.

Attached patch registers the expand and collapse text for translation using the i18n system. The only problem is that I've currently only registered the string for the 'default' view mode. Unfortunately I don't have the current view mode in hook_field_formatter_view() available. Alternatively we could use hook_field_attach_view_alter() (as i18n_field does), and loop over all possible fields and check the formatter, but that seems to be a little performance overhead.

amitaibu’s picture

Status: Needs review » Fixed

Committed, thanks.

mh86’s picture

Status: Fixed » Needs review
StatusFileSize
new1023 bytes

Small follow-up, current code throws a notice when a new text field has been created.

amitaibu’s picture

Status: Needs review » Fixed

Committed, thanks.

Oh, and sorry to do it to you, but you now have commit access to the project ;)

iamcarrico’s picture

Gosh---- that is mean of you Amitaibu! :-P

mh86’s picture

yeah, commit access ;-)

Status: Fixed » Closed (fixed)

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