1

I'm having a hard time figuring out how to display a simple box containing some info about the author of a node. I have tried drupal's built-in user profile manager and profile2 module but none of these work on multilingual sites as they should...

Profile2 come with a "Profile2 translation" but it seems that it can be used only for fields labels and not for fields content.

Anyone knows a workaround on how to do it?

P.S.: I use the i18n module.

Thank you!

  • Drupal cannot translate itself your content. It translates only the interface. You should make your box translatable and do it yourself. – Djouuuuh Oct 15 '14 at 9:27
  • Yes I know drupal cannot translate by itself that's why I use the Internationalization module (i18n). The problem is that I can't see a way to translate user's profile fields. Basically what I need is a box like this one, interactiveblend.com/blog/wp-content/uploads/2009/08/… but for a multilingual site. – gge Oct 15 '14 at 10:24
  • Actually I don't care if that small box represents fields from the user profile. All I want to attach a piece of content to every article written by the same author and if the node is displayed in english, the content of that small box should be in english and if the node is in german the text should be in german. – gge Oct 15 '14 at 11:06
1

As profile2 doesn't seems to work well with i18n, what i would do is to :

  • create a node type "Author" with some field translatable - the name and picture doesn't need to be translated for example
  • create a field "Node reference" linking to the Author node using entityreference module
  • optionally, you could create a field to link the Author node to a Drupal User if you need for example to add a contact form or to display the "About the author" in the user page.

To display the block "About the author" in article pages, there is at least 2 solutions :

  1. In your content type "Article", manage display tab, choose "Rendered entity" for the field Author (easier and better performance but less flexible)
  2. Create a view with a block display containing a contextual filters on the entity reference with a validation on node type = 'Article'. This block could be displayed only on page "node/*" to avoid too much unnecessary views call.
| improve this answer | |
  • This is what I needed! Thank you for that! I would like to add that Translated Entity Reference is also needed in order to get the right translation for the referred node. – gge Oct 21 '14 at 10:57
  • Never used this module but it will probably only work if you use node translation "Enabled, with translation" and not "Enabled, with field translation". Anyway, you can try. – samuelsov Oct 21 '14 at 12:53
1

Profile2 is based on Entity and you have 2 ways of translating entities in Drupal.

  1. by creating an instance of the entity for each language : see https://www.drupal.org/node/1280934
  2. by defining some fields that are translatable : see https://www.drupal.org/node/1280632
| improve this answer | |
  • The problem is that under "Translatable entity types" there are only options for Comment, Node, Taxonomy term and User. There's nothing about Profile2. However I see an option (Users may translate all occurrences of this field:) when creating a new field, checked that and now when trying to translate a profile I see "No translatable fields"... – gge Oct 16 '14 at 9:35
  • Concerning the first problem you describe where Entity2 doesn't appear in "Translatable entity types", you are right - there is bug here - drupal.org/node/1966640. It should be quite easy to provide a patch thought... – samuelsov Oct 17 '14 at 21:16
  • For i18n_fields, the mechanics seems to work (we can convert a field to be translatable) but there seems to be no way to actually translate the field, so i guess you can't do it with Profile2 – samuelsov Oct 17 '14 at 21:49
  • Any other workaround? Something like having a block attached to all articles written by the same author? How can I do that? Thanks! – gge Oct 18 '14 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.