Skip to content

[Translation] Add generic extraction marker function #35418

@ro0NL

Description

@ro0NL

Extracting translation keys from source is nice, and saves us a few steps and makes thing less error prone in general.

Currently, in PHP, only TranslatorInterface::trans() in controllers calls are extracted as such. However, often we have just a translatable string, which is passed to the translator later on. E.g. with knp menus:

$menu->addChild('translation.key', ['extras' => ['translation_domain' => 'nav']]);

To extract translation.key i propose to add $string = Translatable::_('translation.key'). Which is an identity function defined in contracts. It enables extractors to act upon. More short, maybe t('string') even ...

Next, we should scrape entire src IMHO, or any source file from the DI container.

Related, can we consider https://github.com/php-translation/extractor for core? Or why is there something competing doing a better job?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy