Translate field names

This commit is contained in:
Nathan Gray 2011-01-12 17:17:37 +00:00
parent 6511f42e43
commit 582a06caf2
2 changed files with 13 additions and 1 deletions

View File

@ -129,6 +129,15 @@ class importexport_export_csv implements importexport_iface_export_record
// begin with fieldnames ?
if ($this->num_of_records == 0 && $this->csv_options['begin_with_fieldnames'] ) {
if($this->csv_options['begin_with_fieldnames'] == 'label') {
// Load translations for app
list($appname, $part2) = explode('_', get_class($_record));
if(!$GLOBALS['egw_info']['apps'][$appname]) $appname .= $part2; // Handle apps with _ in the name
translation::add_app($appname);
foreach($this->mapping as $field => &$label) {
$label = lang($label);
}
}
$mapping = ! empty( $this->mapping ) ? $this->mapping : array_keys ( $this->record );
$mapping = $this->translation->convert( $mapping, $this->translation->charset(), $this->csv_charset );
fputcsv( $this->handle ,$mapping ,$this->csv_options['delimiter'], $this->csv_options['enclosure'] );

View File

@ -59,6 +59,9 @@ class importexport_wizard_basic_export_csv
'wizard_step30' => lang('Choose fields to export'),
'wizard_step40' => lang('Choose seperator and charset'),
);
list($appname, $part2) = explode('_', get_class($this));
if(!$GLOBALS['egw_info']['apps'][$appname]) $appname .= $part2; // Handle apps with _ in the name
translation::add_app($appname);
}
/**
@ -99,7 +102,7 @@ class importexport_wizard_basic_export_csv
foreach($this->export_fields as $field => $name) {
$content['fields'][] = array(
'field' => $field,
'name' => $name,
'name' => lang($name),
);
if($content['mapping'][$field]) {
$content['fields']['export'][$row] = $field;