I'm actually translating farmOS platform to french. I've met some problems.
Firstly I generated a potx file from farmOS modules.
Then I translated. I found all my translations were not translated, even if the translation could be find in the administration translation part with the good translation.
I looked at the farmOS code and I found this :
// Translatables
// Included for use with string extractors like potx.
t('Assign this planting to a season. You can manage these options in the ' . l('Seasons', 'admin/structure/taxonomy/farm_season') . ' vocabulary.');
t('Companions');
t('Crop family');
Thus includes strings into translation files, but it do not pass translation on the site.
To deal with this problem I changed the translation reference, not at the end of files, but at the string initialization.
E.g.
$field_instances['farm_asset-planting-field_farm_crop'] = array(
'bundle' => 'planting',
'default_value' => NULL,
'deleted' => 0,
'description' => t('Enter the crop/variety that this is a planting of. As you type, you will have the option of selecting from crops/varieties that you\'ve entered in the past.'),
'display' => array(
'default' => array(
'label' => 'inline',
'module' => 'taxonomy',
'settings' => array(),
'type' => 'taxonomy_term_reference_link',
'weight' => 0,
),
),
'entity_type' => 'farm_asset',
'field_name' => 'field_farm_crop',
'label' => t('Crop/Variety'),
Do you think I can find an other solution ?
If that solution suits, is that possible to make a pull request ? Or to implement this in the next version ?
(I'm working with Yoann Lesouef from Leanid team.)
Thanks.
Comments
Comment #2
zoePha CreditAttribution: zoePha commentedComment #3
rodrigoaguileraAre you using i18n_field?
https://www.drupal.org/project/i18n
I don't think is possible to translate field labels and field descriptions without that module on D7.
I think the second approach works because it creates the description and label directly in French, is not a translation of the English origin. Do you get this idea?
Comment #4
m.stentaHi @zoePha! Thanks for helping with the French farmOS translations!
And thanks @rodrigoaguilera for the suggestion!
I don't have experience working with translations in Drupal, myself, so I would defer to those who know better.
One thing I do know: all of the fields that are provided in farmOS modules are exported via the Features module - and that is what generates all the code for them - including the translatable strings at the bottom of the file. So my assumption is that they are there for a reason - although I'm not familiar enough with the underlying mechanics to know if that's true.
On a related note, we do have a feature request for translations already: #2690051: farmOS Localization - That issue specifically will probably be moved to the Drupal 8 branch, however, because D8 provides a much more integrated system for managing translations than Drupal 7 does (which requires a bunch of extra modules). There may be some string changes between the 7.x-1.x and 8.x-2.x branches, so it may require re-translating some things - but I would like to make it a priority to keep strings relatively consistent moving forward, to avoid those kinds of changes.
Comment #5
zoePha CreditAttribution: zoePha commentedThanks for your answers @m.stenta and @rodrigoaguilera.
I'll look deeper to find a good way to get all translations.
Comment #6
m.stentaRelated discussion on Github:
https://github.com/farmOS/farmOS.org/issues/18
Comment #7
m.stentaClosing this as a duplicate of #2690051: farmOS Localization, but I also copied @rodrigoaguilera's comment into that issue so we don't forget it...