Support from Acquia helps fund testing for Drupal Acquia logo

Comments

adinac created an issue. See original summary.

adinac’s picture

I 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.

Sam152’s picture

Status: Active » Needs review

I thought type: label in the schema definition was enough. Is there a good example out there of another module implementing this strategy?

adinac’s picture

Yes, 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...

frjo’s picture

Can 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.

idebr’s picture

Title: Configuration translation » Enable the Configuration translation UI for colorbox.settings
Status: Needs review » Reviewed & tested by the community

Technically 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

markdc’s picture

Status: Reviewed & tested by the community » Needs work

Thank 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:

exclude settings that don't need translation (like "Max width")

Neslee Canil Pinto’s picture

Issue tags: +Needs reroll
kaustubhb’s picture

Updated the patch with missing schema.

kaustubhb’s picture

Fixed the phpunit issues with config.

kaustubhb’s picture

Status: Needs work » Needs review
kaustubhb’s picture

Assigned: kaustubhb » Unassigned
kaustubhb’s picture

I checked that configuration translation mentioned in comment "#2"

exclude settings that don't need translation (like "Max width")

.
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?

Coops_’s picture

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.

KapilV’s picture

Issue tags: -Needs reroll