Closed (fixed)
Project:
Field Collection Table
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
7 Jul 2011 at 11:16 UTC
Updated:
12 May 2015 at 16:36 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
tim.plunkettI'm not 100% sure on how translations work, but it's wrapped in
t()exactly the same as Field Collection.Perhaps it is related to http://localize.drupal.org/translate/projects/field_collection_table returning a 404?
I'm not sure what to do about this.
Comment #2
calculus commentedThe problem is the translated labels (aka html table headers in table format). Labels are translated by string_i18n module.
"View field-collection items" format, renders table headers correctly (per language), but one table per row-set. "Table field-collection items" renders a unique table with all rows, but the table headers aren't translated.
I'm sorry i cannot understand the whole code, but the problem is only at the headers of "Table field-collection items" format.
Comment #3
tim.plunkettOh, I completely misunderstood. I will try to work on this tomorrow.
Comment #4
tim.plunkettTry this, I think I got all of the instances.
Comment #5
tim.plunkettCorresponding issue in field_collection: #1246778: Make Add/Edit/Delete links translatable
Comment #6
skottler commentedThe patch above has cleanly applied for me and works well.
I'm wondering how we can more completely document the input vs. output of tables that need to be translated throughout the Drupal project.
Comment #7
tim.plunkettIt turns out this is completely wrong, and only works because those strings happen to be translated already by core. :(
See #1246778-9: Make Add/Edit/Delete links translatable, I'm going to wait for a fix there.
Comment #8
rv0 commentedI don't get what the problem is
Why can't a t() be added around the field label in field_collection_table_field_formatter_view()?
like this:
Works fine for me...
Comment #9
tim.plunkettFrom the documentation for t(): http://api.drupal.org/api/drupal/includes--bootstrap.inc/function/t/7
It should always be the exact string that needs to be translated.
Comment #10
cinnamon commentedThis works, I'm sure it can be done better but as it turns out $content[$field_name]['#title'] has the translated user string as is. So no incorrect usage of t() is needed.
Comment #11
dqdFollowing the rules of issue priorities of drupal.org I would recommend to use "normal" here since untranslated labels doesn't break anything.
Comment #12
mathieuhelie commentedPatch in #10 was giving undefined index errors in PHP 5.3, fix with:
$header[$weight]['data'] = isset($content[$field_name]['#title']) ? $content[$field_name]['#title'] : "" ;Comment #13
adiatisPatch 10 & 12 don't work.
I know that #8 is not the right way but the only solution at the moment?
Comment #14
nebel54@adiatis: fyi patches 10 & 12 did work for me
@mathieuhelie - I rewrote your fix a bit, because your patch overwrites the original caption when no translation is defined.
Comment #15
Anonymous (not verified) commentedpatch in #14 works for me
Comment #16
czigor commented#14 works for me too.
Comment #17
HakS commentedThis patch works when you hide empty columns, but when you show them, empty column headers won't get translated.
I wrote a workarround for this (works after applying patch):
However, I think it wouldn't be right to create a patch for this, because this code is using i18n_string api to get string translation of field label, but this module shouldn't depend on any i18n modules, nor even any translation module. Regardless of this, I put this code so anyone can use this code as a workarround, and some developer can find a better way to fix this issue properly.
Comment #18
ParisLiakos commented#14 worked for me too
contains extra space
i think #17 means this needs works..i use hide empty as well
Comment #19
ParisLiakos commentedComment #20
HakS commentedIn addition, this patch does not translate any header (even with my code in #17 :( ) when columns are all empty.
Comment #21
Liviu commentedHi all,
I found this bug also in my projects and I want to commit my patch.
I'm using Internationalization 7.x-1.10, Field Collection 7.x-1.0-beta5+8-dev and Field Collection Table 7.x-1.0-beta1+2-dev.
My project has the following setup:
I have 2 languages enabled. 1 Content Type named "Article". In "Article" fields I have 1 field collection field named "my_field". "my_field" has 1 autocomplete field named "my_field2" that is translated in both language using Internationalization field translation module. The issue appears when I'm selecting table as widget type for "my_field" and is represented by the fact that "my_field2" isn't translated on node add and node edit.
My patch resolves this and because it's my first patch please bear with me and tell me if it works for you also.
Thanks.
Comment #22
Liviu commentedComment #23
kristiaanvandeneynde#14 worked for me as well
Comment #24
kristiaanvandeneynde#21 is correct, the field labels on the widget are still not translated.
His patch would only work on a reference field, however.
For a regular textfield, you'd have to target:
So this is not a good fix (yet).
Comment #25
kristiaanvandeneyndeComment #26
Georgique commentedThere is i18n module for translating fields - i18n_field. So we should use it in our case.
I attach the patch in PhpStorm format, can somebody adapt it?
Comment #27
Georgique commentedComment #28
Georgique commentedHere is the patch in proper format.
Comment #29
peacog commentedThanks for the patch. It works for me (after clearing the cache).
Comment #30
peacog commentedI've re-rolled the patch against the latest dev. It would be nice to get this committed. Could we get a few more reviews? Thanks.
Comment #32
kevineinarsson commented#30 commited in the latest dev version.
Comment #34
knalstaaf commentedShouldn't this be committed to the recommended version too? After all it makes the module complete. 95% of the websites we make are in more languages, so does almost every large project.