Variables terms_of_use_fieldset_name and terms_of_use_checkbox_label should be declared in order to be used by the Variable project (see http://www.drupal.org/project/variable). Attached is a file that can be added to the module in order to declare those variables (to be renamed to terms_of_use.variable.inc)

The main advantage of declaring these variables is the possibility to translate the texts "Terms of Use" and "I agree with these terms"

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dddave’s picture

sub

tahiticlic’s picture

Thanks for the patch, works great.

peteruithoven’s picture

Works, but I was also missing the node title option. Since this delivers the content, this should be multilingual too.

$variable['terms_of_use_node_title'] = array(
    'title' => t('Terms of Use node title'),
    'description' => t('The title of the node that the Terms of Use module uses'),
    'type' => 'string'
  );
jocken’s picture

I just discovered why this wasn't working. Until a patch is ready (I don't know how to do that), this is the solution:

file: terms_of_use.module
around row 58

$form['terms_of_use'] = array(
    '#type' => 'fieldset',
    '#title' => $fieldset_name,
    '#weight' => 10,
  );

Should be

$form['terms_of_use'] = array(
    '#type' => 'fieldset',
    '#title' => t($fieldset_name),
    '#weight' => 10,
  );

around row 112

$form['terms_of_use']['terms_of_use'] = array(
    '#type' => 'checkbox',
    '#title' => $checkbox_label,
    '#required' => TRUE,
  );

Should be:

$form['terms_of_use']['terms_of_use'] = array(
    '#type' => 'checkbox',
    '#title' => t($checkbox_label),
    '#required' => TRUE,
  );

Hope someone with a little more knowledge could make this to a patch:)

Haza’s picture

I made a patch from above.

(patch need to be applied using "git am < file.patch")

guillaumev’s picture

Status: Needs review » Reviewed & tested by the community

I just tested the patch and it works just fine... Ready To Be Committed ?

Schnitzel’s picture

+1 works for me

jramby’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
1.27 KB

Hi, thanks for the patch.

I tested it and I tried to translate my text with "@link" in the "label for the checkbox". It shows the HTML link in interface translation page. So I've done this patch to make translation available just for the text with "@link" and not with link that is already handled by the module itself.

Tests are welcome!

Thanks.

jramby’s picture

Ooops!... this #8 comment patch comes with the first patch

Kars-T’s picture

Status: Needs review » Needs work

Hi

working with the variables module would be nice but I refuse a patch that can put strings in other languages than english into t() like the one in #5 is doing. Please reroll the patch with an update to the latest variables module so the strings can be translated.

guillaumev’s picture

Status: Needs work » Needs review
FileSize
1.09 KB

There might be something that I'm missing here but for me, it works just by declaring the variables: you then just have to have the variable module enabled and you can then translate easily the checkbox and fieldset labels... I'm therefore proposing this patch which just declares the variables...

poiu’s picture

Status: Needs review » Reviewed & tested by the community

#11 looks good and works for me.

Rustan’s picture

Version: 7.x-1.1 » 7.x-1.2

#5 works for me, but not #11. Using 1.2.

bryanmanalo’s picture

Issue summary: View changes

According to this blog post, #5 should not be used.

I used #11 and it works. Just make sure:
1. Variable translation module must be enabled.
2. In admin/config/regional/i18n/variable , under "Other" subtab, mark the variable as translatable.
3. In /admin/config/system/variable/module, under Terms of use subtab, this is where you actually translate the variable.

Hope this helps

Triumphent’s picture

Like @bryanmanalo said (#14,) if you follow his short guide, you won't fail!

KevinVb’s picture

Hi,
I started with the patch of #11
But it doesn't cover the whole functionality. I extended it so the node id and title are also available as translated variables.

Because the administration was using AJAX to change the form elements and it was saving variables during form_validate the node_id translation wouldn't work.
I changed the flow of the form so the node id is a hidden value and it is only possible to apply the node with the node title.
During validate we then change the value of the node id.
So form submit can handle the multilingual variable.

This way it is possible to show a different node for each language.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 16: terms_of_use-variables-1181458-16.patch, failed testing.

akalam’s picture

Status: Needs work » Needs review
FileSize
5.46 KB

Last patch does not apply against last dev

AlfTheCat’s picture

Tried patch #18 and now re-saved the module settings. Ran cron, flushed caches.
I get a new string for the admin description of the Label for the checkbox field. But the field itself is not translatable.

I thought it worked before, maybe i18n has gone through a change.... But I can no longer translate strings for this module, except for the one admin description this patch exposes.

Am curious as to what has happened...

AlfTheCat’s picture

Status: Needs review » Needs work

Updating status

AlfTheCat’s picture

had another go at this and turned out i needed to enable the variable admin module to be able to translate the variable as per #15.

AlfTheCat’s picture

Status: Needs work » Needs review

updating status

The last submitted patch, 8: 1181458-do-not-translate-link.patch, failed testing. View results

ivnish’s picture

Status: Needs review » Needs work

Needs to reroll the patch against the latest dev

ivnish’s picture

Status: Needs work » Closed (outdated)

Closed due to inactivity. If it is relevant, we will open it again