It is possible in de edit field settings on profile2 to identify that this field is translatable by the user.
However on the edit profile screen no language tabs appear to translate this field in other languages.
Also on the entity translation screen, the profile2 type is not mentioned

Anybody got an idea how to setup this up?

Comments

sutharsan’s picture

bump, any one a solution for this?

plach’s picture

Marked #2092785: Add Entity Translation integration as a duplicate of this one.

tusik’s picture

Are the devs planning on supporting the translation of the profile2 fields, beyond just the label? Has anyone dealing with this issue find a workaround?
It would be extremely useful for multilingual sites, especially when they involve languages that use different alphabets, like cyrillic, for example.

sadmetall’s picture

is there any update about this issue?!

szeder’s picture

Category: Feature request » Support request
Issue summary: View changes

Same question here. Are the profile fields translatable?

spleshka’s picture

You can use i18n_field module to translate your fields. Or what functionality do you need?

szeder’s picture

This issue concerns translating the content of a profile field. The i18n_field module allows for translation of text associated with a field's settings.

spleshka’s picture

Ah, do you mean that we need to add language to a profiles, like in nodes?

szeder’s picture

I don't know exactly what is needed. Switching between translations of the same field content would have sense but this is probably an Entity Translation module issue.

chaugi’s picture

@Spleshka
As described in entity_translation.api.php we need hook_entity_info to declare something like following:

$info['profile2'] = array(
    'translation' => array(
      'entity_translation' => array(
        'base path' => 'user/%user/edit/%profile2', // I am not sure here
      ),
    ),
  );

I am still trying to get it working right. After adding this information I see extra checkbox "Profile" at admin/config/regional/entity_translation in "Translatable entity types". Enabling it we should be able to see translation tabs available here user/1/edit/myprofile2, but currently I get error on this form save:

Invalid base path defined for entities of type Profile: matching menu item not found for user/%user/edit/%profile2
Invalid view path defined for entities of type Profile: matching menu item not found for user/%user/edit/%profile2
Invalid edit path defined for entities of type Profile: matching menu item not found for user/%user/edit/%profile2/edit
Invalid translate path defined for entities of type Profile: parent menu item not found for user/%user/edit/%profile2
The entities of type Profile do not define a valid path scheme: it will not be possible to translate them.
spleshka’s picture

Thanks for your hint, @chaugi. Now it is a bit clearer for me.

matt.rad’s picture

Bump.

spleshka’s picture

Guys, sorry, currently have no time for this issue. If anyone will provide a patch - I will love to commit it!

rockie667’s picture

If I understand this issue correct, then in fact profile2 textfields are not translatable by the owner of the profile - correct?

Ok, then profile2 is obviously not usable for multilingual sites! :(

Thanks anyway for making clear that it is not an issue of wrong configuration or so!

sakiland’s picture

Yes, that's right @rockie667. Profile2 doesn't have support for entity translation. I've made same patch that add this functionality. I'll post it in few days. It's not ideal, not flexible, but it does the work. I think it's a good start point for this issue.

rockie667’s picture

@sakiland: thank you so much for your efforts - but unfortunately for me it will come too late! For me the only chance was to create node based profiles.

Just for any future projects I maybe will work on: What is the current state of your patch?

jlongbottom’s picture

Any progress on the patch for this?

Sakhmed’s picture

I am surprised that there is no multilingual support for this module!
Subscribed!

attisan’s picture

@sakiland - mind sharing your patches?

mvlabat’s picture

Assigned: Unassigned » mvlabat
Status: Active » Needs review
StatusFileSize
new3.42 KB

These were hard several days for me learning entity, entity_translation API and writing this patch... But it is ready, finally :)
So test and review, you're welcome)

P.S. I've patched profile2_page module, so for entity translation support you have to enable profile2_page submodule and configure appropriate profile types.

mvlabat’s picture

StatusFileSize
new4.16 KB

Here I made some fixed for the cases if there is no profile types created or we can't create any valid schema.

A note for users and testers:
You can get entity translation working only if you set a profile type to be displayed on a separate page.
The path to view (edit and translate) the entity is /profile-%profile_machine_name/%uid

vlad.dancer’s picture

@mvlabat, could you please write a step-by-step guide how to test this manualy in UI.

mvlabat’s picture

@vlad.dancer,
Firstly, you have to enable profile2_page module.
Then, for the profile type, which you want to test, go to its configuration on /admin/structure/profiles/manage/
and check "Provide a separate page for editing profiles." option.
Enable profile2 as a translatable entity type on /admin/config/regional/entity_translation.
Then go to /profile-
/ and here you can test it.
If "Translation" tab doesn't appear, firstly save some data to your profile to create an entity.

Richard15’s picture

StatusFileSize
new17.01 KB

HI, I followed your guide but still I can't see any "profile2" checkbox under Translatable Entity Types...

msteurs’s picture

StatusFileSize
new3.76 KB

Thanks @mvlabat for the patch. I had to create a new one against the latest revision of dev branch. I add it here, hope it may serve anyone.

mattheweigand’s picture

When I use this patch along with profile2 registration path I get this error several times during user registration.

Notice: Undefined property: stdClass::$uid in EntityTranslationProfile2PageHandler->getPathInstance() (line 22 of <site>/sites/all/modules/profile2/contrib/includes/translation.handler.profile2_page.inc).

The user is not registered and doesn't get an email.

praveen_91’s picture

I have applied this patch and it's working yet
thanks

tostinni’s picture

StatusFileSize
new4.16 KB

#25 is working for me too, however here is an updated patch with a better permission management for translations.

Right now the patch #25 display the translate tab if a profile is created return (bool) $args[0]->pid; which let anonymous users see it ;).

miguelbraga’s picture

For some reason I can't patch this (using osx), can you guys help me out? I really need translation for profile2 profiles...

rickj’s picture

StatusFileSize
new4.14 KB

I've just checked this, and it looks like a slightly spurious line in patch file #28. Here's a corrected version.

Status: Needs review » Needs work
drupalpal’s picture

Dears,

Can someone upload the module with the patch included? I don't seem to be able to get it work. Automatic patch did not work and Manual patching does not yield the required results.

Thanks.

rickj’s picture

@drupalpal

I'm not able to test this myself as I'm not using translation, but I've tried applying patch #30 to 7.x-1.5, and latest dev, and it applies OK. A few complaints about shifted line numbers, but the resulting code appears clean.

What problems are you having with the patch, and what's your exact meaning of "automatic" and "manual"?

maryedith’s picture

I am trying to apply this patch to profile2_7.x-1.5.
I have created a /patches directory under modules/all/contrib/profile2 for the patch.
Running $git apply patches/patch_name.patch does nothing.
It appears to add a file into config/includes dir . There is no contrib/includes dir; nothing is added
It also appears to edit contrib/profile2_page.inc. It does nothing.

Please explain. We need to translate profile 2 fields. Thanks!

NEver mind. I used

$patch -p1 < patches/profile2_7.x-1.5-1966640-30.patch