ZF-2291: Trim whitespace in CSV files

Issue Type: Improvement Created: 2007-12-11T07:50:22.000+0000 Last Updated: 2008-03-21T16:25:44.000+0000 Status: Resolved Fix version(s): - 1.5.0 (17/Mar/08)

Reporter: Robert Castley (rcastley) Assignee: Thomas Weidner (thomas) Tags: - Zend_Translate

Related issues: Attachments:


Currently language files built using CSV have a typical syntax such as:

<pre class="highlight">


In order to make the CSV more human readable (but at the same time kinda breaking the CSV principles) I would like to have the option to layout the CSV like so:

<pre class="highlight">
#param      value
hello:      Bonjour
car:        Voiture
green:      Vert

In Zend_Translate_Adapter (ZF 1.0.3) line 354 I can mimic this functionality by changing:

<pre class="highlight">
return $this->_translate[$locale][$messageId];


<pre class="highlight">
return trim($this->_translate[$locale][$messageId]);

I think what would be better is to allow this to be provided in the $option array.


Posted by Thomas Weidner (thomas) on 2007-12-11T08:25:36.000+0000

2 things to beware of:

First: CSV files are not intended to be "human readable" in a stylish way. When whitespaces appear then they will also be included in any CSV import. This would f.e. break excel, word and any other software you or your customer are using for editing this, except a plain text editor.

Second: Translation means that the text is returned as it is. There must be no formatting, striooing and so on. Sometimes whitespaces are necessary and should be returned.

The aproved way for this is to write a small helper which does this for you within the view. Zend_Translate will not truncate or change any output it reads. This is part of the view.

Therefor this improvement will not be integrated.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.