Review main Abandoned

75804[FEATURE] Allow Extension to prevent downloading of language packs

Daniel Siepmann CR 0 V 0 Normal +56 −0 updated 01/19/23, 23:54

Commit message

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 2

Review log 3133

Show 78 earlier messages
  1. Daniel Siepmann uploaded patch set 1 09/21/22, 12:27

  2. core-ci voted on patch set 1 V +1 09/21/22, 12:35 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31362

  3. Georg Ringer commented on patch set 1 V +1 CR +1 09/23/22, 10:22

    this feature must be backported to 11.5 as well!
  4. Chris Müller voted on patch set 1 V +1 CR +1 09/27/22, 12:32

  5. Christian Kuhn commented on patch set 1 09/29/22, 14:00

    i'm not a huge fan of adding this to composer.json of extensions. which alternatives exist?
  6. Chris Müller commented on patch set 1 09/29/22, 14:08

    I once thought about adding a PSR-14 event. That way, one can add all extensions with a defined prefix at once to prevent the download of language files in a site package (as project extensions start mostly with the same prefix).
  7. Chris Müller commented on patch set 1 09/30/22, 14:16

    I like the simplicity of this feature, no PHP code necessary. Just an entry in the composer.json and it's done. Why don't you like it, Christian?
  8. Kevin Appelt voted on patch set 1 V +1 CR +1 10/02/22, 18:06

  1. Georg Ringer uploaded patch set 2 10/02/22, 18:25

  2. Georg Ringer commented on patch set 2 V +1 CR +1 10/02/22, 18:25

    I am also for
  3. core-ci voted on patch set 2 V +1 10/02/22, 18:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31903

  4. Benni Mack voted on patch set 2 CR -1 10/02/22, 19:15

  5. Benni Mack commented on patch set 2 10/02/22, 19:15

    I think this needs more thought. we run projects in composer mode without em_conf.php
  6. Kevin Appelt commented on patch set 2 10/02/22, 21:46

    Reply Unresolved

    So whats your problem with this change? Actually the only reason we still use ext_emconf.php in our projects is to set excludeFromUpdates to avoid downloading language files. With this feature we can move this configuration to composer.json and finally remove ext_emconf.php for good. I would love to see this in 12.0 to be able to remove all those ext_emconf.php files.
  7. Benni Mack voted on patch set 2 CR +1 10/03/22, 09:59

  8. Christian Kuhn commented on patch set 2 CR -1 10/03/22, 10:06

    i still don't think composer.json is the right place for this. could we please wait until 12.0 is done and then think discuss and decide?
  9. Daniel Siepmann commented on patch set 2 10/04/22, 06:08

    I'm open to everything here. I just tried to keep the existing logic. The composer.json looks like the new ext_emconf.php to me. But we also can add a 2nd Event to the process. This change just looked like less code to me, that's the reason I chose that way. No need to hurry, it looks like a new feature to me anyway, so can be postponed until some 12.x release :)
  10. Daniel Haupt commented on patch set 2 10/06/22, 12:34

    Thinking about our projects, updating language packs could generally be disabled for all extensions from local path repositories. Then there would be actually no configuration necessary. Has this possibility been considered yet?
  11. Georg Ringer commented on patch set 2 10/06/22, 19:11

    Reply

    IMO this does not cover the following edge cases: - sometimes I got third party extensions in local path because they are not yet ready for current version and I need those and I don't want to publish those there - it is possible to have the same extension key for private extensions as public community extensions. If I got my private extensions on my own packagist, I still don't want to use public xlf files I don't like the idea of the event because for every custom extension I would either implement the event or in my site package extension and I don't like both.
  12. Chris Müller commented on patch set 2 10/10/22, 14:02

    Reply Unresolved

    Additionally, I want to have the possibility to disable language updates for a TER extension where no translations exist on the translation server. So the local packages path for custom extensions may not be an option. Also: You can set up a custom translation server for your local extensions. So magical disabling the updating of languages is also not an option. And how does TYPO3 knows what a local package extension is? I agree with Georg that an event is just duplicating the same code over the codebase just with another extension key/composer package name (or having in a site package). It is too much boilerplate just for disabling local packages from translation updates. Another idea: Can we place something into the "Configuration" folder? Like a placeholder file, for example "Configuration/DisableTranslationUpdates" or something? Then an is_file() call can be used to check if an extension language pack should be downloaded or not.
  13. Kevin Appelt commented on patch set 2 11/14/22, 20:45

    Lets put some attention to this feature again. 😊 What about using a new setting in the LocalConfiguration/settings.php? This allows each system to determine individually for each extensionKey whether the language packs should be downloaded or not. Theoretically, this is even possible on an environment basis (please do not download anything in DDEV, because I work offline anyway and this only leads to problems). And if an extension does not provide language packs it might add itself to the "exclude on language pack downloads" setting via ext_localconf.php. Any opinions about this approach?
  14. Josef Glatz commented on patch set 2 11/15/22, 15:00

    Reply

    I personally would see only benefits from configuring this inside each extension.
  15. Kevin Appelt commented on patch set 2 11/15/22, 18:21

    Reply

    This would be possible via ext_localconf.php as I said. But there are scenarios where you want to disable the download for third party extensions as well - e.g. because the extension author does not provide any translations but has not disabled the download itself. From what I've read here so far, there's no case we can't solve with this and we don't need lots of boilerplate code in every single extension.
  16. Chris Müller commented on patch set 2 11/15/22, 18:45

    Reply

    AFAIK ext_localconf.php will be phased out, part by part is moved to other places. Also, how do you want to achieve that? Call a static method which sets a flag somewhere? When looking into the code, there is an iteration over all packages. So there should be a flag somewhere (either in composer.json like suggested with this patch or a file in Configuration folder (just an is_file() call) like suggested above or something else ...) which can be checked quickly. I agree with lolli that composer.json may be the wrong place for this. If a 3rd party extension does not provide language files and has also no need for them but does not prevent the download of language files from the translation server then this a candidate for a PR to this extension to change that behaviour. So no need to do it separately for every project you have. So, IMHO inside an extension is fine.
  17. Stefan Bürk commented on patch set 2 11/15/22, 20:47

    Reply

    I thing, it's hard to find a feasonable way at the moment, due the state. We are kind of in-between phasing out ext_emconf.php but not having composer.json fully required for legacy mode extensions. Some global "flags" smells kind of a "we-did-not-knew-it-better". I would suggest to add a PSR-14 Event here. So we have not do decide it "yet" were to put it as a configuration flag. That event would not be needles, if we add some kind of configuration to the extension, because that way developers can still "override" the extension provided flag. So I would rather think about a reasonable event here in the first place. Granted, it's a feature than and not backportable. If someone need's it in v11 in composer mode can use composer patches than. (Or provide a xclasse or something like that).
  18. Stefan Bürk commented on patch set 2 11/15/22, 20:49

    Reply Unresolved

    And for v11, for own extension you can add a ext_emconf.php with the `excludeFromUpdates` flag .. should prevent the download. Does not help with 3rd party extensions.
  19. Christian Kuhn commented on patch set 2 11/17/22, 12:13

    Talked with Benni and Kevin about this: First, we added a couple of "why do we need this?" to the issue, to see the use-cases. After discussion multiple possible versions, it seems as if an event would be fine: It should return a list of extension keys the language packs should be fetched for. Such an event listener could be shipped within a 'site' extension. We may need to look at the install tool code on how to make it aware of the event in install tool context, though (probably by using a ServiceProvider.php and not a Services.yaml, due to the restricted install tool context?). What we need here is a patch to see if this works out. What do you think?
  20. Georg Ringer commented on patch set 2 11/17/22, 12:34

    Reply

    event is IMO ok, don't forget that fetching translations is also done via a command!
  21. Georg Ringer commented on patch set 2 11/18/22, 12:45

    Reply

    @chris: one could write a simple extension just using the event and checking a configuration in TYPO3_CONF_VARS. so everybody would be happy.
  22. Chris Müller commented on patch set 2 11/18/22, 15:12

    Reply

    I am fine with an event, I suggested it somewhere up. But personally I won't rely on a 3rd party extension for that topic in a project. The event has one big advantage: One can opt-out of translation just checking the prefix of the extension key (in project-specific extensions I saw the key mostly starts with something like "abc_"). So one event in a site package and that's it. You'll mostly never have to touch it again. There is the ModifyLanguagePackRemoteBaseUrlEvent already available, so there should be no big deal to get an additional event running in backend and CLI context. Good to see the topic moving forward.
  23. Christian Kuhn commented on patch set 2 11/19/22, 08:35

    Reply Unresolved

    Exactly. With a couple of lines of rather simple code, one can easily skip an agency prefix in extensions, using the package manager. Kevin will try to play around with this and if it's works out well (events in install tool are a bit tricky), we should document a basic implementation in the .rst file.
  24. Kevin Appelt commented on patch set 2 01/19/23, 14:12

    The "event-version" is ready for reviews https://review.typo3.org/c/Packages/TYPO3.CMS/+/77485
  25. Stefan Bürk abandoned the change 01/19/23, 23:54

    Abandon this change in favor of https://review.typo3.org/c/Packages/TYPO3.CMS/+/77485 solving the same issue number.