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.
Hello there,
When you add a page break in the webform if you entered you're own custom label for (Prev page button label) or for (Prev page button label) the value that you entered will not be translatable! i tried to put a t()
in the hook_form_alter()
but it didn't work out, after looking into it i noticed that there is no t()
in the webform.module file for this custom label:-
please check webform_client_form
function in the webform.module file, line 1937
if ($component['type'] == 'pagebreak') {
$next_page_labels[$component['page_num'] - 1] = !empty($component['extra']['next_page_label']) ? $component['extra']['next_page_label'] : t('Next Page >');
$prev_page_labels[$component['page_num']] = !empty($component['extra']['prev_page_label']) ? $component['extra']['prev_page_label'] : t('< Previous Page');
}
Comment | File | Size | Author |
---|---|---|---|
#2 | webform-next-prev-translate-2068305.patch | 1.33 KB | issa.haddadin |
#1 | webform-next-prev-translate-2068305.patch | 34.58 KB | issa.haddadin |
Comments
Comment #1
issa.haddadin CreditAttribution: issa.haddadin commentedHere is a patch, i just added a
t()
Comment #2
issa.haddadin CreditAttribution: issa.haddadin commentedPlease forget the previous patch! a small problem with branches, here the right one
Thanks.
Comment #3
torotil CreditAttribution: torotil commentedLooks good to me.
Comment #4
quicksketchI think you're probably right here. We try to avoid too much translation through the t() function (it's a widely discouraged practice to run variables through t()), but we do the same thing for the submit button label, which can't be translated any other way. I'll try to put this in next time I'm reviewing and committing patches. This probably needs to go into all branches.
Comment #5
quicksketchCommitted and pushed to all branches. Thanks @issa.haddadin and @torotil!
Comment #7
fenstratNeeds porting to 8.x-4.x.
Comment #8
fenstratCommitted and pushed 3e14853 to 8.x-4.x. Thanks!