Add some feature for function setColumnTranslation()


(cn_Dark) #1

Hello,

public function setColumnTranslation( $columnName, $columnTranslation )
    {
        $this->columnsTranslations[$columnName] = $columnTranslation;
    }

Is it possible to add one parameter “$translate” for this function.
function setColumnTranslation( $columnName, $columnTranslation,$translate=false )
With this parameter, I can use it like this

$view = Piwik_ViewDataTable('table');
....
...
$view->setColumnTranslation('label','myTranslate_date',true);
....

Of course, the same for the functions such as setColumnsTranslations.

Because I create many dataTable with addRowsFromArrayWithIndexLabel().
And ‘label’ have different means, ‘date’,‘name’,etc.
So, if I want to let my plugin to support multi-language, I need to modify many codes in API.php. style_emoticons/<#EMO_DIR#>/sad.gif
I hope piwik can add this feature.style_emoticons/<#EMO_DIR#>/smile.gif


(vipsoft) #2

This is not an echo but I am repeating myself… there’s a ticket for this.


(cn_Dark) #3

Thanks.
I didn’t find this tiket, hard ro search… style_emoticons/<#EMO_DIR#>/sad.gif
But I have find a solution for this problem. In fact, piwik can already solve this problem. style_emoticons/<#EMO_DIR#>/smile.gif

We can write like this:
$view->setColumnTranslation(‘columenName’,Piwik_Translate(‘translate_string’));

I hope piwik can have a more detailed documentation. style_emoticons/<#EMO_DIR#>/wink.gif