It would be very nice to have a possibility to set the custom button label on the pop-up window asking whether the user would like to continue his/her session.
By default it's Yes/No, and it is becoming an issue when localizing.

right now i didn't find any better way that just hard code the new values.

Comments

turtletrail’s picture

likewise the pop-up title name

joekers’s picture

It would be nice to have this functionality, but for now you can use hook_js_alter to implement your own code without touching the module code.

johnennew’s picture

Status: Active » Closed (duplicate)

Message and title are already translatable arn't they (?)

$msg = t('@msg', array('@msg' => variable_get('autologout_message', 'Your session is about to expire. Do you want to reset it?')));
    $settings = array(
     'timeout' => $refresh_only ? ($timeout * 500) : ($timeout * 1000),
     'timeout_padding' => $timeout_padding * 1000,
     'message' => t('@msg', array('@msg' => $msg)),
     'redirect_url' => url($redirct_url, array('query' => $redirect_query)),
     'title' => t('@name Alert', array('@name' => variable_get('site_name', 'Drupal'))),
     'refresh_only' => $refresh_only,
);

Translations for the Yes and No buttons were added to 7.x-4.x on: http://drupal.org/node/1979550

Marking as a duplicate and closing - reopen if you think it needs to be.

Teastwood’s picture

Issue summary: View changes
Status: Closed (duplicate) » Active

Hello,

It seems that "title" is ok, but "message" is not translatable this way.
When calling

t('@msg', array('@msg' => 'my message in English');

@msg is replaced by "my message in English", but without being translated, whatever the current language is.

But on the documentation page for function t(), they say "You should never use t() to translate variables, such as calling
t($text);".

So I guess the right way would be to declare the "message" variable in hook_variable_info() (module: Variable) :

/**
 * Implements hook_variable_info().
 */
function autologout_variable_info($options) {
  $variable['autologout_message'] = array(
    'type' => 'string',
    'title' => t('Autologout timeout message', array(), $options),
    'description' => t('Plain text message to display in the logout dialog when timeout is reached.')),
    'default' => 'Your session is about to expire. Do you want to reset it?',
  );
}

and to replace the previous

$msg = t('@msg', array('@msg' => variable_get('autologout_message', 'Your session is about to expire. Do you want to reset it?')));

by

$msg = variable_get('autologout_message', 'Your session is about to expire. Do you want to reset it?');

which will automatically return the translated value for the variable, if i18n_variable (module: Variable translation from the Internationalization package) is enabled and if "autologout_message" is set to be translatable in i18n_variable configuration.

Does this seem ok?

johnennew’s picture

Hi @Leela,

Thanks for your comment. I had a look at the docs you linked to and I think you are right. I thought I might have to add a dependency on variable module but looks like its optional so this is great.

johnennew’s picture

Dev branch is doing this right now which also solves the problem, though not necessarily the right way to do it ...

https://www.drupal.org/node/2088169

Not sure we should change it now.

DeaOm’s picture

Status: Active » Closed (outdated)