How does this work with modules not on Drupal.org and not custom

Created on 19 April 2023, over 1 year ago

Problem/Motivation

@eiriksm asked:

How would it work if you have agency specific modules. Say you have private packagist for some in-house work you always enable on all projects. Can you place them alongside contrib and custom translations somehow?

We had the following discussion as a result:

alexpott Good question re the agency specific modules. There’s nothing for that - yet! But it does sound sensible. How would you want to ship those agency module translations?


eiriksm well, we do that with https://www.drupal.org/project/custom_translation_deployments now by having a pattern for exporting them directly into one file
eiriksm so basically we use potx to export them into a file (on this project i have open now it's called nymedia-nymedia.nb.po) which then will get picked up by locale-update because of, well because of that module :stuck_out_tongue:
eiriksm so on this project I have one custom-nymedia.nb.poand one nymedia-nymedia.nb.pofile
eiriksm and one of these agency modules have defined both those patterns for custom_translation_deployments

alexpott This is a really good topic… I’ll think about how the two modules might work together. Given locale_deploy does use locale_update under the hood it might “just work”:tm: :smile:

eiriksm I would think so too :slightly_smiling_face:
eiriksm Well I can say what I would like to have available if using locale_deploy.
The locale-deploy:custom-translations command scans the modules/custom folder to extract any translations there.
I would love to have a hook or event to be able to influence which folders are scanned. That would probably solve everything automatically?
eiriksm so by default there is an array ['modules/custom'] that I would like to alter?

alexpott Ah I see - your agency modules are going into custom?

eiriksm no, they are not, which is the point :stuck_out_tongue:
eiriksm they are all in modules/nymedia

alexpott But your agency module translations are not done per project so where do the .po files come from?

eiriksm Several places actually. Most of them have one included in the module repo. But these are imported on install, so we need to be able to ship translation updates as well
eiriksm Changes, as well as additions

alexpott In my mind, locale should be aware that a module provides translations and when you run locale-update it should get the translations for the module from it’s translations for folder and move it into the local translations folder. Yes you’ll have duplicate files but you’ll know what is included in your project.

eiriksm That also works, but it generates additional infrastructure and workflow so to speak. custom_translation_deployments gives us that convenient shortcut
eiriksm with that I am saying, you are of course right, but doing it right is sometimes harder and more time consuming :stuck_out_tongue:

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Active

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom alexpott 🇪🇺🌍

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024