How can I translate the Profile 2 field labels?
EDIT: the following description describes the steps for Drupal 8, but they are similar for Drupal 7:



You need the potx module to extract a translation template which you can translate. Unfortunately there isn't an official Drupal 8 release available, but you can use this github fork, which works fine for my needs.

Here is a short procedure to handle translations of my modules:

1. extent your module with the Interface Translation Properties (only Drupal 8)

Example my_module.info.yml:

name: My Module
description: ''
type: module
core: 8.x

'interface translation project': my_module
'interface translation server pattern': modules/my_module/translations/%language.po


Now your module is available for the locale module and translation can be handled with drush locale-check resp. drush locale-update.

2. create a subfolder for your translations

In the subfolder ./modules/my_module/translations I put the generated template and the *.po files. Fore more information have a look at the documentation on drupal.org.

3. create your template

I'm using drush to create the template. The best way for me is the creation with

drush potx single --folder=modules/my_module/ --api=8


It generates a general.pot file at the root directory of your Drupal installation. I move it into the translation folder but it's not necessary.

4. create your translation

To create a translation I'm using Poedit as editor. You can create different language files from the general.pot template. The free version of Poedit is quiet useful for editing *.po files. Save your language files in the translation folder.

5. import the translations

Run the following commands to import the translations:

drush locale-check &amp;&amp; drush locale-update


And clear the cache:

drush cr


That's it ;)