4

I cannot make the module translation strings to be considered, unistalling and installing the module again.

Is the indicated .po relative path correct?

in my module blockForm function i have :

  $form['retrieval_method'] = array(
    '#type' => 'fieldset',
    '#title' => $this->t('Retrieval Method'),
  );

my .info.yml

name: 'amu hal'
type: module
description: display publications from HAL
core: 8.x
version: 8.x-3.0
package: AMU
project: 'amu_hal'
interface translation project: amu_hal
interface translation server pattern: modules/amu_hal/translations/%language.po

and in

/sites/mysite/modules/amu_hal/translations/fr.po :

msgid "Retrieval Method"

msgstr "Méthode d'extraction"

i have activated the core interface traduction module and the

/fr/admin/reports/translations

tells me Missing translations for 11 projects:

amu hal (8.x-3.0). File not found at modules/amu_hal/translations/fr.po
5
  • 1
    wrap the keys in single quotes
    – user21641
    Sep 5, 2018 at 12:56
  • which keys ? this: interface translation project: 'amu_hal'. Does not change
    – Matoeil
    Sep 5, 2018 at 13:07
  • 1
    The keys are on the left, so 'interface translation project': amu_hal, for example
    – Clive
    Sep 5, 2018 at 13:29
  • which ones then ? because if i wrap them all, the module is not listed in the extend interface
    – Matoeil
    Sep 5, 2018 at 13:53
  • 1
    Does it help to read the documentation - api.drupal.org/api/drupal/…
    – hansfn
    Sep 5, 2018 at 14:23

1 Answer 1

7

Thanks to comments and doc , i have moved the whole module in modules/custom/ and for info file:

name: 'amu hal'
type: module
description: display publications from HAL
core: 8.x
version: 8.x-3.0
package: AMU
project: amu_hal
'interface translation project': amu_hal
'interface translation server pattern': modules/custom/amu_hal/translations/amu_hal-%language.po

Placing the po file at

modules/custom/mymodule/translations/mymodule-fr.po

now i could update the translation at

/fr/admin/reports/translations

and make string translations

Note that the same po file is not found if the module is placed in sites/mysite/module

3
  • 1
    public:// means file upload directory, usually .../sites/default/files/..., I've successfully used a relative path from web root in my own module: modules/custom/MY_MODULE/translations/MY_MODULE-%version-%language.po
    – Hudri
    Sep 5, 2018 at 15:50
  • The ' seems to be very important for the key on the right side: 'interface translation server pattern': (correct) vs interface translation server pattern: (not correct)
    – Andreas
    Mar 31, 2020 at 19:55
  • Following works: interface translation server pattern: modules/custom/module/translations/module.%language.po, just remember to clear cache after changing info file
    – NicklasF
    Nov 12, 2020 at 13:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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