When exporting the translations from a drupal site with the Calendar module installed, the .po-file contains conflicts due to bad translations.

In includes/calendar_plugin_styles.inc the form element "max_items" contain regular translations for counted items. At the moment the options look like this:

'#options' => array(0 => t('Unlimited'), 1 => t('1 item'), 3 => t('3 items'), 5 => t('5 items'), 10 => t('10 items'))

The problem is that other modules use format_plural to translate this. This makes very good sence. If the options are changed - lets say max is 20 instead of 10 - a new translation has to be made, making the translation less than flexible.

I suggest changing the options to the following:

'#options' => array(0 => t('Unlimited'), 1 => format_plural(1, '1 item', '@count items'), 3 => format_plural(3, '1 item', '@count items'), 5 => format_plural(5, '1 item', '@count items'), 10 => format_plural(10, '1 item', '@count items'))

I know it's a bit longer, and not as pretty, but the code is a lot more correct. It only requires one translation no matter how the options will change in the future. And it assures that translations do not collide.

(I'll try to attach a patch in a comment...)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lund.mikkel’s picture

hass’s picture

Status: Needs review » Needs work

Please add some line breaks. One option per line. This is not easy to read.

lund.mikkel’s picture

Everything for you my dear sir...

hass’s picture

Status: Needs work » Reviewed & tested by the community

Looks good and reuses a core format_plural string.

fizk’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

Committed, thanks!

  • Commit 23730b9 on 7.x-3.x authored by lund.mikkel, committed by fizk:
    #1729884: Translations of max items collide with other translations.
    

Status: Fixed » Closed (fixed)

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