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.
Comment | File | Size | Author |
---|---|---|---|
#5 | drupal-2866066-5-Project-contained-translations-not-robust.patch | 2.08 KB | geek-merlin |
Comments
Comment #2
geek-merlinStraightforward patch flying in that adds a %path placeholder and updates documentation.
Not tested yet.
Comment #4
geek-merlinComment #5
geek-merlinPatch flying in for 8.4.x.
Comment #7
geek-merlinFails:
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.
Comment #8
geek-merlinComment #10
Sutharsan CreditAttribution: Sutharsan at LimoenGroen commentedThe
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 theinterface 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.
Comment #19
LendudeBased on #10 this is by design and there are options to implement flexibility, so adding this sounds like a feature.