Problem/Motivation

When a project contains translations and this is done like described in the docs, and the project is relocated, the translation import will break.

From Interface translation properties:

Custom modules which contain new strings should provide po file(s) containing source strings and string translations in gettext format.

Example .info.yml file properties for a custom module with a po file located in the module's folder.

'interface translation project': example_module
'interface translation server pattern': modules/custom/example_module/%project-%version.%language.po

Note the hardcoded modules/custom here. This will break if the module is moved.

Proposed resolution

Add a placeholder that resolved to the project location.

Remaining tasks

Review, discuss, commit.

User interface changes

None.

API changes

We provide an additional placeholder for the mymodule.info.yaml 'interface translation server pattern'.

Data model changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

axel.rutz created an issue. See original summary.

geek-merlin’s picture

Straightforward patch flying in that adds a %path placeholder and updates documentation.
Not tested yet.

Status: Needs review » Needs work
geek-merlin’s picture

Version: 8.3.x-dev » 8.4.x-dev
Issue summary: View changes
geek-merlin’s picture

Patch flying in for 8.4.x.

Status: Needs review » Needs work
geek-merlin’s picture

Fails:

drupal_get_filename
exception: [User warning] Line 240 of core/includes/bootstrap.inc:
The following module is missing from the file system: drupal

I can only imagine this if we call drupal_get_path('module', 'drupal'), which would spot a bug somewhere else (probably in the test subsystem): drupal's project_type must be core.

geek-merlin’s picture

Title: Project contained translations are not robust » Project contained translations break when module is moved

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Sutharsan’s picture

The interface translation server pattern is meant to be used by single modules declaring their own path. When a custom module developer decides to move the module, it is his/her responsibility to change the interface translation server pattern value too.

If a module (like customtranslations) provides generic solutions for other modules' translation path, it can use hook_locale_translation_projects_alter() to modify the server pattern.

I have no objections agains the solution in the above patch, but there are other solution too.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Lendude’s picture

Category: Bug report » Feature request
Issue tags: +Bug Smash Initiative

Based on #10 this is by design and there are options to implement flexibility, so adding this sounds like a feature.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.