Needs work
Project:
Translation Template Extractor (potx)
Version:
2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
28 Dec 2015 at 10:33 UTC
Updated:
27 Jul 2026 at 16:21 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
swaps commentedComment #3
swaps commentedPatch for the feature request.
Drush command :
drush potx multiple --themes=example
Cheers,
SwapS
Comment #4
swaps commentedComment #5
swaps commentedComment #6
swaps commentedChanging the status as couldn't see any update from long.
Thanks,
SwapS
Comment #7
swaps commentedCan someone please pick this up ?
It's been in the same state for very long now.
Cheers,
SwapS
Comment #8
interx commentedThe patch still applies on "kgaut/potx": "dev-8.x-1.x".
I tested the patch and it works for me.
drush potx single --themes=my_theme --api=8
Maybe a separate test for the themes options should be added.
Comment #9
ericbellot commentedPatch to add Drush Support for extracting strings in the theme files to potx-8.x-dev (commit efe650235717ce2307a5583277f09cacc3642977: 16/02/2018)
Comment #11
bramdriesenShould be targeted at the D8 version if I'm not mistaken.
Comment #12
marjina-constantin commentedFirst patch does not have drush 9 support, second one is not applying, so I adjusted the code and wrote the third one :)
Comment #13
marjina-constantin commentedComment #14
floydm commentedPatch #12 works great for me, thank you.
My only issue is that it conflicted with another patch I needed on issue #3075494. I combined the two and created a new patch:
https://www.drupal.org/files/issues/2019-09-09/potx-drush_language-30754...
It'd be great to see one or both of these fixes rolled into the dev branch.
Comment #15
gábor hojtsyAre the changes Drupal 9 compatible? The 8.x-1.x branch is now Drupal 9 compatible so changes are also supposed to be so. Sending a retest for that.
Comment #16
marjina-constantin commentedReroll of the patch. Changes are Drupal 9 compatible.
Comment #17
duaelfrI've been using this patch for a few months without problems on a D9 project.
The code looks good.
Thanks!
Comment #19
watergate commentedI've updated the patch of #16 to be compatible with Drupal 10 (and the latest version of Drupal 9).
The change involves the deprecation of
drupal_get_path()in Drupal 9, see https://www.drupal.org/node/2940438. In case older versions of Drupal should still be supported, instead of$path = \Drupal::service('extension.list.theme')->getPath($theme);, something like$path = function_exists('drupal_get_path') ? drupal_get_path('theme', $theme) : \Drupal::service('extension.list.theme')->getPath($theme);(but in that case this change/fix should also be applied on the code handling extracting string translations from modules).Comment #20
eric_a commentedTo facilitate reviewing I created an interdiff between #16 and #19 with git. While #19 applies on HEAD (1.0.0), for #16 I had to go back to 2 commits to Drupal 9 code. The interdiff contained a lot of files (from the D9-D10 update). I then removed all the files except the two that are changed by both patches.
So here's something of an interdiff. I'll try to review later on.
Comment #21
eric_a commentedRight. The two relevant files contained irrelevant hunks from the D9-D10 commits. Removed those manually as well.
Comment #22
eric_a commentedAccording to the info file, potx is runnable on ^8 || ^9 ||^10. If that were true, then #19 would not be correct is as. However, looking at the code from the D10 compatibility issue it is clear that the new services are already in use since 1.0.0. That code will only run on higher versions of Drupal. According to the referenced change record that would be ^9.3.
So I guess the ideal way forward is to first tackle the version compatibility issue in a separate issue where the code will either be made more compatible or the info file would be fixed to declare a more restrictive version constraint.
I'll see if I can create that issue today.
Comment #23
eric_a commentedMore or less postponed on #3354887: The potx info file incorrectly claims ^8 || ^9 || 10 core compatibility?
Comment #24
eric_a commentedHold on... Aren't *.drush.inc commandfiles only loaded by Drush 8 and earlier? Drush 8 is not compatible with Drupal 10 and Drupal 9. (It's Drupal 8 compatible but not recommended.)
So it seems then that for Drupal 10 compatibility only deprecated code in the new Command class should be touched and the potx.drush.inc should be left alone for those on old Drush and old Drupal.
https://weitzman.github.io/blog/port-to-drush9
https://www.drush.org/latest/install/#drupal-compatibility
Comment #25
watergate commentedGood point; I think you are right, @Eric_A. However, similar changes were already made in #3285613: Drupal 10 compatibility fixes for potx (i.e., rewriting the deprecated code in the potx.drush.inc file, but for extracting strings from module files).
Let's use #3354887: The potx info file incorrectly claims ^8 || ^9 || 10 core compatibility to discuss which core and Drush (combinations) are supported and the most suitable strategy.
Comment #26
watergate commentedI updated the patch to be compatible with the latest version of this module (when using Drupal 10 or 11).
I noticed that #3464392: Create a new 2.0.0 version of POTX has been created mainly to remove support for old/obsolete code. This issue will also become easier when a 2.0.0 version is released.
Comment #28
watergate commentedI've created a merge request based on the 2.x branch of this module.
Comment #29
watergate commented