Enclosed patch reduces the number of strings that need to be translated in panels_simple_cache_settings_form() from 21 to 8.

Comments

pancho’s picture

Bumping this. Please review.

sdboyer’s picture

Status: Needs review » Closed (won't fix)

I feel like I'm being thick, but - how does this reduce t() overhead? Even if it does, though, I think I'd rather keep it the way it is purely from a code readability perspective.

pancho’s picture

Status: Closed (won't fix) » Needs review

Oh certainly it does reduce the overhead! As stated in my original post, translators this way need to translate only 8 strings instead of 21.
Also we're close to the string freeze, and it's not nice to leave translators alone with such repetitive work. I'd therefore simply consider it good codestyle. And code readability doesn't really suffer IMHO, does it? I mean this code is probably the simplest of our whole project...

I changed status, so you can reconsider, but if you still don't agree, I certainly won't insist on getting this committed.

kkaefer’s picture

This use of t() is wrong. Please use format_plural for formatting these strings. Your solution does not account for languages with more complex plural formulas, such as Polish.

pancho’s picture

Status: Needs review » Needs work

Oh, kkaefer pointed me on IRC to a much, much better solution... I'll rework this and post a new patch!

pancho’s picture

Status: Needs work » Needs review
StatusFileSize
new1.48 KB

This is what kkaefer pointed me to, and it is what core uses in http://api.drupal.org/api/function/system_performance_settings.
Small code, great flexibility for languages with 5, 6 or whatever different plural forms. And the best is: translation comes for free with the core translation!

Tested works. Please promote if you feel comfortable with it.

merlinofchaos’s picture

Status: Needs review » Reviewed & tested by the community
pancho’s picture

Priority: Normal » Minor
Status: Reviewed & tested by the community » Fixed

Committed a slightly corrected version of this: http://drupal.org/cvs?commit=119500.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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