Comments

Gertjan.k created an issue. See original summary.

jeroen.b’s picture

Status: Active » Needs work

Thanks for the patch! Could you add a translation context so it's easier to translate specific terms?
(I had issues with the word "Case" in multiple projects, they always resulted in "Hoofdlettergebruik" ;) )

vollepeer’s picture

I updated the patch to work with 7.x-1.0-rc4

vollepeer’s picture

StatusFileSize
new1.31 KB

Whoops, filename contained a space...

vollepeer’s picture

I added a translation context as requested in comment #2.

vollepeer’s picture

StatusFileSize
new1.91 KB
Johnny vd Laar’s picture

StatusFileSize
new2.6 KB

Attached is a patch that adds another translation when you are editing a node with paragraphs.

dgtlmoon’s picture

Status: Needs work » Needs review

This patch is being used successfully here but other people might want to review it also

eelkeblok’s picture

Status: Needs review » Needs work

Sorry to be a party pooper, but putting user-defined strings (i.e. bundle names) into t() is generally not the accepted way to do this sort of thing. This would look to be a job for the i18n module.

rudi teschner’s picture

I agree, worst case this could result in a recursion situation.

It would be cleaner to make the paragrah names itself translatable. Just like i18n_node provided options to translate content type names.

geek-merlin’s picture

So this needs a different approach like outlined here:

i18n module integration | Drupal.org

idebr’s picture

Title: It's not possible to fully translate the add paragraph button/select » Make paragraph bundles translatable with i18n_string
Version: 7.x-1.0-rc3 » 7.x-1.x-dev
Status: Needs work » Needs review
StatusFileSize
new36.3 KB

Since Paragraphs already depends on Entity API, we can leverage the EntityDefaultUIController and EntityDefaultI18nStringController to make Paragraphs bundles translatable. As a bonus, Paragraph bundles are now entities so the CRUD operations and Features exports are now available for 'free' by the Entity API.

Attached patch converts Paragraphs bundles to entities and applies i18n_string translations through the EntityDefaultI18nStringController in the paragraphs_i18n submodule.

Status: Needs review » Needs work

The last submitted patch, 12: paragraphs_make-bundles-translatable-2580427-12.patch, failed testing.

idebr’s picture

Status: Needs work » Needs review
StatusFileSize
new44.83 KB

I have regenerated the Features module that is used to test the Paragraphs module to reflect the changes in the export hooks. This should also fix the failing test.

Status: Needs review » Needs work

The last submitted patch, 14: paragraphs_make-bundles-translatable-2580427-14.patch, failed testing.

geek-merlin’s picture

Entity api, wooooot! Great work.

rudiedirkx’s picture

Using Entity API to export config creates monstrosities like this:

  $items['image'] = entity_import('paragraphs_bundle', '{ "bundle" : "image", "name" : "Image", "locked" : "0" }');

Entities in D7 are definitely not for exporting config. Feature exports should be hardcoded, sorted, predictable. It takes 3 features hooks to do it correctly. I doubt all this is necessary to translate a few labels.

geek-merlin’s picture

#17: i don't see the monstrosity in this. quite some module use this approach, first of all rules. and we get some other benefits of it. +1 for entity api.

eelkeblok’s picture

I think using Entity API is not unreasonable. If you take offence with the format it produces for exportables, that's probably something to be taken up with Entity API. If others agree, all modules that use entity API might benefit. FWIW, I think this format might be less conflict-prone than the usual lines and lines of nearly identical array structures Features tends to produce.

tvoesenek’s picture

Patch works for me, i've created an rc4 only patch from the patch in #14

idebr’s picture

Status: Needs work » Needs review
StatusFileSize
new45.02 KB

Reroll against -dev

idebr’s picture

eelkeblok’s picture

Another reroll against latest dev.

eelkeblok’s picture

ericdsd’s picture

+1 for entity api

This issue seems to be abandoned for a while, but it would clearly be an useful feature.

joshahubbers’s picture

Patch for the rc5 version.

joshahubbers’s picture

Previous patch did not include the ParagraphsBundleEntity.inc file. This patch is complete.

paulvandenburg’s picture

Status: Needs review » Reviewed & tested by the community

#27 confirmed working.

jstoller’s picture

Status: Reviewed & tested by the community » Needs work

The patch no longer applies to dev and may require functional changes due to more recent commits. Please re-roll and retest.

bluegeek9’s picture

Status: Needs work » Closed (outdated)
//www.flaticon.com/free-icons/thank-you Thank you for your contribution!

Unfortunately, Drupal 7 is End of Life and no longer supported. We strongly encourage you to upgrade to a supported version of Drupal.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.