Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Interface strings included in colorbox settings can not be translated.
Comment | File | Size | Author |
---|---|---|---|
#14 | colorbox_config-translation-ui_2764703-14.patch | 3.27 KB | Coops_ |
| |||
#10 | colorbox-config-translation-2764703-10.patch | 1.41 KB | kaustubhb |
| |||
#9 | colorbox-config-translation-2764703-9.patch | 1.42 KB | kaustubhb |
| |||
#2 | colorbox-config-translation-2764703-1-D8.patch | 959 bytes | adinac |
Comments
Comment #2
adinac CreditAttribution: adinac as a volunteer commentedI added the possibility to translate colorbox settings. I tried to exclude settings that don't need translation (like "Max width") by adding "translatable: false" in their corresponding schema definition but it had no effect.
Comment #3
Sam152 CreditAttribution: Sam152 at PreviousNext commentedI thought type: label in the schema definition was enough. Is there a good example out there of another module implementing this strategy?
Comment #4
adinac CreditAttribution: adinac as a volunteer commentedYes, you can look in core in the user module. There is also information on configuration translation here http://hojtsy.hu/blog/2014-may-26/drupal-8-multilingual-tidbits-16-confi...
Comment #5
frjo CreditAttribution: frjo commentedCan you give some example strings that this patch make possible to translate?
I just tried and for me it was possible to translate the handful of strings I tested without any patch.
Comment #6
idebr CreditAttribution: idebr at iO commentedTechnically it is already possible to translate colorbox.settings for example by translating the configuration programmatically or manually adding yml files, so I updated the issue summary to more accurately reflect the proposed change.
More information on how configuration translation is implemented for modules is available on: Defining and using your own configuration in Drupal 8 in the Drupal handbook
Comment #7
markdcThank you for this. Much more convenient than editing .yml files.
The issue mentioned in #2 would need to be addressed before this could be considered finished:
Comment #8
Neslee Canil PintoComment #9
kaustubhb CreditAttribution: kaustubhb at Srijan | A Material+ Company commentedUpdated the patch with missing schema.
Comment #10
kaustubhb CreditAttribution: kaustubhb at Srijan | A Material+ Company for Drupal India Association commentedFixed the phpunit issues with config.
Comment #11
kaustubhb CreditAttribution: kaustubhb at Srijan | A Material+ Company commentedComment #12
kaustubhb CreditAttribution: kaustubhb at Srijan | A Material+ Company commentedComment #13
kaustubhb CreditAttribution: kaustubhb at Srijan | A Material+ Company commentedI checked that configuration translation mentioned in comment "#2"
.
The config type defined for width, height is text/string. So that is the reason it is being shown in translate field.
I tried excluding them from translation with
translatable:false
but it had no effect.
Solution:
So the other way to do it will be changing the type of those configs in schema from text to integer.
But doing so might impact current implementations in project(Not sure though).
Question
This also raises the question that were these fields intentionally kept as text?
Comment #14
Coops_I've added an update hook which will remove values which should not be translated, but are, that exist in active configuration. This ensure that any translated config which exists is in sync with the new schema changes.
I've set the schema to 'label' for everything which should be translated and 'string' for those which should not be translated.
Finally, I've added the correct yml files to allow a tab under the settings page for translations.
Comment #15
KapilV CreditAttribution: KapilV as a volunteer and at Innoraft for Drupal Association, Drupal Care commented