Ticket #229 (closed enhancement: fixed)

Opened 3 years ago

Last modified 2 years ago

[PATCH]_('translated') inside an array declaration breaks the array

Reported by: merindol Assigned to:
Priority: trivial Milestone: 1.0.1
Component: Sintags Keywords:
Cc: bermi

Description

Hi.

Is this normal that :

<%= something :vals => { 'chunk', 'of', _('translated'), 'text' } %>

Produces :

<?php echo $some_helper->something( array('vals' => array('chunk', 'of', $text_helper->translate('translated')), 'text')); ?>

It closes the :vals array too early, before the 'text' element : Notice the parenthesis just after translate('translated') that should be after 'text'. In my opinion at least.

Well, there are others syntaxes to achieve the same thing, but I just mention a potential bug. Maybe I'm wrong about the use of the _() syntax.

Regards.

Attachments

sintags.patch (2.5 kB) - added by haakon on 08/18/09 08:39:54.
Patch for sintags, which makes translation possible inside Sintags Helper tags. <% %>
sintags_r1382.patch (3.0 kB) - added by haakon on 08/18/09 15:22:54.
Patch for newest revision [1382], updated special pattern.

Change History

08/18/09 08:39:54 changed by haakon

  • attachment sintags.patch added.

Patch for sintags, which makes translation possible inside Sintags Helper tags. <% %>

08/18/09 08:44:51 changed by haakon

  • cc set to bermi.
  • type changed from defect to enhancement.
  • summary changed from _('translated') inside an array declaration breaks the array to [PATCH]_('translated') inside an array declaration breaks the array.

Added a patch to this ticket that makes it possible to use translation inside Helper Sintags.

Example:

  <%= link_to _'translated text', :action => 'index' %>
    or
  <%= something 'name', :vals => { 'plain text', _'translated text', _'translated text with %variable' } %>

08/18/09 15:22:54 changed by haakon

  • attachment sintags_r1382.patch added.

Patch for newest revision [1382], updated special pattern.

10/21/09 13:22:14 changed by bermi

  • status changed from new to closed.
  • resolution set to fixed.

Implemented in [1428]. Thanks haakon