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.
Hi,
I'm translating a site but I haven't been able to translate the headers from the matrix fields I'm using, any piece of advice?
Thanks!
Comment | File | Size | Author |
---|---|---|---|
#12 | header_translation-604280-12.patch | 481 bytes | intrafusion |
Comments
Comment #1
torsti CreditAttribution: torsti commentedI need this info also! I tried this:
but it didn't work.
Comment #2
maijs CreditAttribution: maijs commentedAny solution to this problem? Can column and row labels be translated?
Comment #3
levacjeep CreditAttribution: levacjeep commentedOn line 398 of matrix.module
Change to:
Comment #4
mdubnz CreditAttribution: mdubnz commentedI'm in need of a solution that works for version 1.4
It appears you solution is for a later version levacjeep
Any help appreciated..
Cheers
Comment #5
perceptum CreditAttribution: perceptum commentedHere is the git diff for our solution to this problem
git diff matrix.module
diff --git a/sites/all/modules/matrix/matrix.module b/sites/all/modules/matrix/matrix.module
index 951cca4..4d9bea4 100644
--- a/sites/all/modules/matrix/matrix.module
+++ b/sites/all/modules/matrix/matrix.module
@@ -286,6 +286,11 @@ function theme_matrix_formatter_default($element) {
$header = $field_info['cols_header'];
array_unshift($header, '');
+ // Translatable headers - PERCEPTUM
+ foreach($header as $i => $h) {
+ $header[$i] = t($h);
+ }
+
static $rendered; //since we are rendering the whole thing in one go, we don't want to rerender for each fow
if ($rendered[$element['#field_name']] != TRUE) {
Comment #6
aaron1234nz CreditAttribution: aaron1234nz commentedIssue fixed. The solution was similar to that in comment #5, however it I put it inside the matrix_process function instead.
Comment #9
chinita7 CreditAttribution: chinita7 commentedThanks to #3, I did it as below for 6.2 version and it works.
Comment #10
tanmoy1981 CreditAttribution: tanmoy1981 as a volunteer commentedThis patch will work for D7, module version is 7.x-2.3.
Comment #11
tanmoy1981 CreditAttribution: tanmoy1981 as a volunteer commentedThe last patch file was not correct, use this one instead. Its for D7, version 7.x-2.3.
Comment #12
intrafusionRe-upload patch from #11 to trigger test-bot
Comment #13
intrafusionPatch OK, added to repo