Problem/Motivation
The i18n_strings provided by the Mailchimp signup module are added on runtime through i18n_string. This is a problem for sites deployed through continuous integration, since the translation files are only imported for strings that are implemented through hook_i18n_object_info()
.
Proposed resolution
Leverage the Entity API's EntityDefaultI18nStringController to do the minimum amount of work necessary. Since the mergefields are supplied by the Mailchimp API, these fields have to be added through a custom i18n_string_object_wrapper.
Remaining tasks
- Write a patch
- Review
- Commit
User interface changes
There is a new tab 'Translate' available on the Mailchimp sign edit form that provides a translation form for the Mailchimp signup form settings.
API changes
None.
Data model changes
The hook_i18n_object_info()
implementation means the Mailchimp Signup module gets its own textgroup 'mailchimp_signup'. This means the i18n string translations will have to be updated by the site admin. For this reason I would like to suggest this change is only available in the 7.x-4.x branch.
Comments
Comment #2
idebr CreditAttribution: idebr at One Shoe commentedAttached patch implements hook_i18n_object_info() by using the Entity API's EntityDefaultI18nStringController.
Comment #3
ruscoe CreditAttribution: ruscoe at ThinkShout commented@idebr I think you may have forgotten to attach your patch :)
Comment #4
idebr CreditAttribution: idebr at One Shoe commentedAh yes, forgot the attachment. Sorry about that.
Comment #5
idebr CreditAttribution: idebr at One Shoe commentedComment #6
idebr CreditAttribution: idebr at One Shoe commentedThis updated patch fixes a typo in the
mailchimp_i18n_mailchimp_signup_update()
hookComment #7
eelkeblokThe patch no longer applies to the latest versions, here is a reroll. It's a simple reroll, the patch included a fix for another issue that has been included in version 4.4 and a block of code that the patch removes was changed slightly, thereby causing a conflict. The patch has been running in production for some time now and looks fine, codewise, so I'll set it to RTBC.
Comment #8
eelkeblokComment #9
ruscoe CreditAttribution: ruscoe at ThinkShout commentedThanks for updating this patch. It applies cleanly, but I'm not seeing the "Translate" tab mentioned in the ticket.
Comment #10
ruscoe CreditAttribution: ruscoe at ThinkShout commentedComment #11
idebr CreditAttribution: idebr at One Shoe commented@ruscoe Thanks for having a look! There are a few requirements before the 'Translate' tab is available. Can you check if these are met:
- Enabled modules: locale, i18n_string, mailchimp_i18n
- Enabled languages: At least two languages must be enabled
- Your user has the permission 'Translate strings'
When these requirements are met, the 'Edit signup form' should look like this:
Comment #12
ruscoe CreditAttribution: ruscoe at ThinkShout commentedComment #14
ruscoe CreditAttribution: ruscoe at ThinkShout commentedThanks, @idebr! The patch works great and has been merged in.
Thanks for the help with translations; not something I've had much experience with.
Comment #15
idebr CreditAttribution: idebr at One Shoe commentedCheers! I´ll have a look at some recent issues in the issue queue tomorrow to see if this patch covers the translation issues.