In the id="numberDisplay" the text doesn't get translated even though there is a translated string "Image !current of !total", but I can't tell where it belongs to. It is clearly not used when images are displayed in the overlay.

Members fund testing for the Drupal project. Drupal Association Learn more


andiart’s picture

I have a solution for that. The module doesn't work with hook_variable_info to expose its variables to the translation module. Therefor I wrote a hook into the module file:

function lightbox2_variable_info($options) {
  $variable['lightbox2_image_count_str'] = array(
    'title' => t('Image count text'),
    'default' => t('Image !current of !total'),
    'localize' => true,
  return $variable;

Important was to comment out some parts in lightbox2.install because deleting is handled automatically now:

function lightbox2_uninstall() {

And in

  // Add text box for image count for grouping.
/*  $form['lightbox2_text_settings']['lightbox2_image_count_str'] = array(
    '#type' => 'textfield',
    '#title' => t('Image count text'),
    '#description' => t('This text is used to display the image count underneath the image in the lightbox when image grouping is enabled.  Use !current as a placeholder for the number of the current image and !total for the total number of images in the group.  For example, "Image !current of !total".  Leave blank for text not to appear.'),
    '#default_value' => variable_get('lightbox2_image_count_str', 'Image !current of !total'),

* You can already find the variable under /de/admin/config/system/variable/module in a lightbox2 tab and alter it's value
* Secondly you have to declare the variable as multilingual, which is technically spoken adding it to the realm called " language" under: de/admin/config/regional/i18n/variable
* Then you can translate the variable in the variable realm called language under admin/config/system/variable/realm/language/edit

I will make a patch for the dev version soon.

andiart’s picture

Component: User interface » Code
Status: Active » Needs work
spade’s picture

Thanks, I appreciate it.

andiart’s picture

Here is the patch. It though does not remove the image_count variable from the lightbox2 settings form, because users without variables module should still be able to edit it. For translation you will need variable translation and the variable module enabled. Then follow the instructions from #1

andiart’s picture

Category: bug » feature