Problem/Motivation
When i create install profile for multilanguge site i need to provide default translated strings for different settings. In my case it is custom setting for custom search form block provided in custom module.
i put yml of the block into profile/config/install
my settingsis:
...
settings:
id: mymodule_search_block
label: 'My module search block'
provider: mymodule
label_display: '0'
form_type: global
text: ''
placeholder: 'Enter your search'
i also place translated string into profile/config/install/language/fr/ folder
settings:
label: 'My module search block'
placeholder: 'Saisir votre recherche'
also discribed schema yml file placed in mymodule/config/schema/ folder
block.settings.myblock:
type: block_settings
label: 'Search form block'
mapping:
placeholder:
type: label
label: 'Placeholder'
shema was checked with config_inspector module.
so placeholder is translatable setting of block config
but after install profile translated doesn't come into locale_target and then language config override disappear
after invoking http://cgit.drupalcode.org/drupal/tree/core/modules/locale/src/LocaleCon...
on the last install stage because it is translatable setting and because it is not present in locale.
So it looks like bug that it doesn't come to locale during installation.
Comments
Comment #2
denis_kv CreditAttribution: denis_kv at Skilld commentedComment #3
denis_kv CreditAttribution: denis_kv at Skilld commentedComment #4
andypostComment #5
andypostConfirm that core does not automatically import overrides
the fix is http://cgit.drupalcode.org/multilingual_demo/tree/multilingual_demo.prof...
Comment #6
andypostSteps to reproduce
1) create install profile with some additional language (ru)
2) add
language/ru
dir with some translated config3) use drush to install site (default en locale used)
4) config overrides from
language/ru
are not importedThis because $override is not new in http://cgit.drupalcode.org/drupal/tree/core/modules/locale/src/LocaleCon... so it deleted
Comment #7
Gábor HojtsyIMHO #2845437: Process translation config files for custom modules is a duplicate of this one, we need to decide which one to close.
Comment #8
Gábor HojtsyClosing this one since the other one has more info on steps to reproduce, but will bring over #6 there.
Comment #9
Gábor HojtsyComment #10
andypostComment #11
wesleydv CreditAttribution: wesleydv at District09 commentedWe encountered this issue when developing a multilingual distribution.
We copied to code from .profile file in https://www.drupal.org/project/multilingual_demo to overcome it.
We also applied this patch https://www.drupal.org/files/issues/translate_entity_processor_field_agg... from this issue https://www.drupal.org/node/2650434
However we’ve noticed that field label translations kept loosing their translation after we did a locale-update
The only solution we could find is to also add the strings in a .po file that is imported.
I’m not sure if it is related to this issue, if not we can still create a separate issue.
But my colleagues and I spend way too much time on this, to not document it here ;-).
We plan to opensource this distribution, so I will add a new comment as soon as that is done (normally next week) so everybody can see exactly what we did.