Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Coming from #2295469: Add support for static permission definitions with *.permissions.yml
Proposed resolution
Remaining tasks
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#16 | 2311935-potx-16.patch | 2.77 KB | herom |
#16 | interdiff-2311935-15-16.txt | 1.4 KB | herom |
#14 | interdiff.txt | 499 bytes | Gábor Hojtsy |
#14 | 2311935-potx-14.patch | 2.61 KB | Gábor Hojtsy |
#12 | 2311935-potx-12.patch | 2.61 KB | Gábor Hojtsy |
Comments
Comment #1
dawehnerI haven't run the test, but yeah this should be a good start.
Comment #2
dawehnerThe testbot seems to be enable on this project, so let's see.
Comment #3
xjmComment #5
Gábor HojtsyThis became WAY easier thanks to #2322839: Unify YAML translation extraction, and allow extension by contrib.. We can postpone this on #2295469: Add support for static permission definitions with *.permissions.yml.
Comment #6
Gábor HojtsyComment #7
Gábor HojtsyAll right, #2295469: Add support for static permission definitions with *.permissions.yml just landed.
Comment #9
Gábor Hojtsy#2322839: Unify YAML translation extraction, and allow extension by contrib. makes this theoretically easier to do but then it does not support a direct value extraction from an arbitrary key if its not an array. So this will still fail. We either need to make up some sensible syntax for the 'not an array, take the key' variant or just go back to the manual parsing solution for this file. Will summon @herom for this question :)
Sorry no interdiff, but I used the test yaml file and the test PHP code verbatim from @dawehner.
Comment #12
Gábor HojtsyRolled a variant of @dawehner's patch instead.
Comment #14
Gábor HojtsyHelps to check the file name with the good variable.
Comment #15
herom CreditAttribution: herom commentedI think this might pop up in other places. So, let's try handling this the NEW way.
I have used the empty string ('') as special key, to mark all top-level keys as translatable. This won't be recursive, and will leave array values alone.
Edit:
It will look like this
Comment #16
herom CreditAttribution: herom commentedUpdated to use '%top-level-key', after discussing with @Gabor.
Comment #18
Gábor HojtsyMade some minor whitespace fixes and committed. Thanks a lot!
BTW I've been pondering a bit around %top-level-key vs. %top-level-value, because you actually make the value translatable, but in all other cases, you put in the key name, so referring to the key here makes sense for consistency. Also for those not aware this was suggested for 'consistency' with %key, %value, %parent, etc. in config schema.
Comment #19
herom CreditAttribution: herom commentedThe porting will be done in #2322839: Unify YAML translation extraction, and allow extension by contrib..
Comment #20
Gábor Hojtsy