mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-25 16:19:00 +01:00
Use wizard to try to translate headers. It should give better results, especially with compounds like 'Street (Business)', where translation has no such phrase
This commit is contained in:
parent
d0f9f93d4a
commit
d033d3b651
@ -479,6 +479,9 @@ class importexport_definitions_ui
|
|||||||
{
|
{
|
||||||
$wizard_plugin = $content['plugin'];
|
$wizard_plugin = $content['plugin'];
|
||||||
}
|
}
|
||||||
|
// App translations
|
||||||
|
if($content['application']) translation::add_app($content['application']);
|
||||||
|
|
||||||
$this->plugin = is_object($GLOBALS['egw']->$wizard_plugin) ? $GLOBALS['egw']->$wizard_plugin : new $wizard_plugin;
|
$this->plugin = is_object($GLOBALS['egw']->$wizard_plugin) ? $GLOBALS['egw']->$wizard_plugin : new $wizard_plugin;
|
||||||
|
|
||||||
// Global object needs to be the same, or references to plugin don't work
|
// Global object needs to be the same, or references to plugin don't work
|
||||||
|
@ -153,9 +153,23 @@ class importexport_export_csv implements importexport_iface_export_record
|
|||||||
// Load translations for app
|
// Load translations for app
|
||||||
list($appname, $part2) = explode('_', get_class($_record));
|
list($appname, $part2) = explode('_', get_class($_record));
|
||||||
if(!$GLOBALS['egw_info']['apps'][$appname]) $appname .= $part2; // Handle apps with _ in the name
|
if(!$GLOBALS['egw_info']['apps'][$appname]) $appname .= $part2; // Handle apps with _ in the name
|
||||||
translation::add_app($appname);
|
|
||||||
foreach($this->mapping as $field => &$label) {
|
// Get translations from wizard, if possible
|
||||||
$label = lang($label);
|
$backtrace = debug_backtrace();
|
||||||
|
$plugin = $backtrace[1]['class'];
|
||||||
|
$wizard_name = $appname . '_wizard_' . str_replace($appname . '_', '', $plugin);
|
||||||
|
try {
|
||||||
|
$wizard = new $wizard_name;
|
||||||
|
$fields = $wizard->get_export_fields();
|
||||||
|
foreach($this->mapping as $field => &$label)
|
||||||
|
{
|
||||||
|
$label = $fields[$field];
|
||||||
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
translation::add_app($appname);
|
||||||
|
foreach($this->mapping as $field => &$label) {
|
||||||
|
$label = lang($label);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$mapping = ! empty( $this->mapping ) ? $this->mapping : array_keys ( $this->record );
|
$mapping = ! empty( $this->mapping ) ? $this->mapping : array_keys ( $this->record );
|
||||||
|
@ -200,4 +200,12 @@ class importexport_wizard_basic_export_csv
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Expose export fields for use elsewhere
|
||||||
|
*/
|
||||||
|
public function get_export_fields()
|
||||||
|
{
|
||||||
|
return $this->export_fields;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user