There are several scripts that use this code: variable_get('anonymous', 'Anonymous') (note it doesn't use function t()). Good! The value for this variable can be changed via admin/settings. Is it approach correct?

I believe it isn't. With sites where more than one language is enabled, there's no way to translate it. Shouldn't it be more correct to remove this variable from the database and simply use t('Anonymous') ?

PS: I can't believe it wasn't reported before. I tried to search, with no success. Please, correct me if I'm wrong.

Comments

chx’s picture

Status: Active » Closed (duplicate)

http://drupal.org/node/5570 this is an issue being debated only for two years now...

markus_petrux’s picture

Status: Closed (duplicate) » Active

Yeah, but that issue talks about user roles, which seem to be untraslatable.

This issue is about the name of user 0, which could be easily make translatable, if it was not set as a system variable, just using function t().

markus_petrux’s picture

Both issues would render differents patches. But, feel free to revert to dup this one, if that makes things easier to track.

chx’s picture

Status: Active » Closed (duplicate)

I merge the two issues.

markus_petrux’s picture

Category: bug » feature
Status: Closed (duplicate) » Active

killes said: "The anon user name is different as there is a variable to change it." here:
http://drupal.org/node/5570

As it seems it is goind to be addressed in that issue, let me re-open this one.

I think the Anonymous user name implemented as a system variable cannot be translated. This is a problem for sites that have more than one language available.

I believe it could be removed as a system variable and implemented using t('Anonymous') so it could be translated.

markus_petrux’s picture

Title: Anonymous user name is hardcoded. » Anonymous user name cannot be translated.
Crell’s picture

Version: x.y.z » 6.x-dev

Was this fixed in the D6 cycle somewhere? I vaguely recall it but I'm not sure. If so, someone please close it. :-)

aufumy’s picture

Status: Active » Fixed

Did a grep in drupal6, it appears to have been fixed.

includes/theme.inc:1635: $output = check_plain(variable_get('anonymous', t('Anonymous')));

modules/comment/comment.module:1354: $form['name'] = array('#type' => 'textfield', '#title' => t('Your name'), '#maxlength' => 60, '#size' => 30, '#default_value' => $edit['name'] ? $edit['name'] :  variable_get('anonymous', t('Anonymous')), '#required' => TRUE);

modules/comment/comment.module:1456: $comment->name = variable_get('anonymous', t('Anonymous'));

modules/node/node.pages.inc:186: '#description' => t('Leave blank for %anonymous.', array('%anonymous' => variable_get('anonymous', t('Anonymous')))),

modules/oldnode/node.pages.inc:183: '#description' => t('Leave blank for %anonymous.', array('%anonymous' => variable_get('anonymous', t('Anonymous')))),

modules/system/system.admin.inc:1169: '#default_value' => variable_get('anonymous', t('Anonymous')),

modules/system/system.module:1817: '%username' => $user->name ? $user->name : variable_get('anonymous', t('Anonymous')),

modules/user/user.module:818:      $alt = t("@user's picture", array('@user' => $account->name ? $account->name : variable_get('anonymous', t('Anonymous'))));

sites/all/modules/activity/activity.module:800: $output = check_plain(variable_get('anonymous', t('Anonymous')));

sites/all/modules/apachesolr/apachesolr_search.module:1200: return variable_get('anonymous', t('Anonymous'));

sites/all/modules/date/date_tools/date_tools.module:857: '%anonymous' => variable_get('anonymous', t('Anonymous')))));

sites/all/modules/domain/domain_conf/domain_conf.admin.inc:205: $form['main']['anonymous']['#default_value'] = isset($settings['anonymous']) ? $settings['anonymous'] : variable_get('anonymous', t('Guest'));

sites/all/modules/domain/domain_conf/domain_conf.module:250: '#system_default' => variable_get('anonymous', 'Anonymous'),

sites/all/modules/form_builder/modules/node.inc:669: '#description' => t('Leave blank for %anonymous.', array('%anonymous' => variable_get('anonymous', t('Anonymous')))),

sites/all/modules/token/token.module:79: $values['user-name'] = $user->uid ? $user->name : variable_get('anonymous', t('Anonymous'));

sites/all/modules/token/token_user.inc:32: $values['user'] = $account->uid ? check_plain($account->name) : variable_get('anonymous', 'Anonymous');

sites/all/modules/token/token_user.inc:33: $values['user-raw'] = $account->uid ? $account->name : variable_get('anonymous', 'Anonymous');

sites/all/modules/views/modules/comment/views_handler_argument_comment_user_uid.inc:11: $title = variable_get('anonymous', t('Anonymous'));

sites/all/modules/views/modules/user/views_handler_argument_user_uid.inc:17: return array(variable_get('anonymous', t('Anonymous')));
gpk’s picture

Status: Fixed » Closed (duplicate)