Closed Wolvverine closed 2 years ago
Please to release for both GLPI 10.x.x and for 9.5.x
@stonebuzz Yes , but only fields for specific itemtype. Not for common fields defined in GENERICOBJECT_FIELDS_PATH/field.constant.php
@stonebuzz @cedric-anne
Do you need any more data?
On another note, there is no option for generic plugin to report errors, and there are quite a few in the plugin.
Hello @Wolvverine
Are you trying to load the locales for each field defined in field.constant.php
?
Best regards
You do not need to include these locales, they are provided as standard by GLPI.
This will not work https://github.com/pluginsGLPI/genericobject/blob/a5e5443f25c30ce631b58146969a66f71d2590b0/setup.php#L261-L289
Because for native fields defined in field.constant.php
, genericobject
use GLPI native locales ex: __("Name")
.
Also field.constant.php
do not have a locale files as field.en_GB.php
Do you want to include locale for any fields that you have added to this file ?
Best regards
Not fields defined in the plugin code, but new global fields created for all new assets. declared in : files/_plugins/genericobject/fields//field.constant.php
The plugin writers forgot about the possibility to include extracted translations for these global fields. They only added for fields defined per new asset.
Not fields defined in the plugin code, but new global fields created for all new assets. declared in : files/_plugins/genericobject/fields//field.constant.php
Ok, i see.
Let me check
@Wolvverine
I do not know well how to customize this plugin. Can you attach here custom files required to test this feature ?
Standard way for generic object, example:
files/_plugins/genericobject/fields//field.constant.php - file with common fields:
<?php
global $GO_FIELDS, $LANG;
$GO_FIELDS['plugin_genericobject_orgunits_id']['name'] = $LANG['genericobject']['commonfields'][1];
$GO_FIELDS['plugin_genericobject_orgunits_id']['field'] = 'Organizational Unit';
$GO_FIELDS['plugin_genericobject_orgunits_id']['input_type'] = 'dropdown';
$GO_FIELDS['idfield']['name'] = $LANG['genericobject']['commonfields'][2];
$GO_FIELDS['idfield']['input_type'] = 'text';
$GO_FIELDS['data_courier_issuance']['name'] = $LANG['genericobject']['commonfields'][3];
// 'Date issuance';
$GO_FIELDS['data_courier_issuance']['input_type'] = 'datetime';
$GO_FIELDS['data_courier_return']['name'] = $LANG['genericobject']['commonfields'][4];
// 'Date return';
$GO_FIELDS['data_courier_return']['input_type'] = 'datetime';
$GO_FIELDS['lease_start_date']['name'] = $LANG['genericobject']['commonfields'][5];
// 'Lease start date';
$GO_FIELDS['lease_start_date']['input_type'] = 'datetime';
$GO_FIELDS['lease_end_date']['name'] = $LANG['genericobject']['commonfields'][6];
// 'Lease end date';
$GO_FIELDS['lease_end_date']['input_type'] = 'datetime';
?>
in locales files: files/_plugins/genericobject/locales/field.en_GB.php files/_plugins/genericobject/locales/field.en_US.php files/_plugins/genericobject/locales/field.pl_PL.php files/_plugins/genericobject/locales/field.fr_FR.php etc.
<?php
// Fields
$LANG['genericobject']['commonfields'][1]="Organizational Unit";
$LANG['genericobject']['commonfields'][2]="ID";
$LANG['genericobject']['commonfields'][3]="Date issuance";
$LANG['genericobject']['commonfields'][4]="Date return";
$LANG['genericobject']['commonfields'][5]="Lease start date";
$LANG['genericobject']['commonfields'][6]="Lease end date";
Refactored and cherry-picked in 170a3e5725a4bfae8298720622bec39156ff376b.
I changed filename from field.$lang.php
to fields.$lang.php
.
Documentation update: https://github.com/pluginsGLPI/doc/pull/61
from GENERICOBJECT_LOCALES_PATH/field.[language].php