Skip to content

[Translation] Add generic extraction marker function #35418

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ro0NL opened this issue Jan 21, 2020 · 1 comment
Closed

[Translation] Add generic extraction marker function #35418

ro0NL opened this issue Jan 21, 2020 · 1 comment

Comments

@ro0NL
Copy link
Contributor

ro0NL commented Jan 21, 2020

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?

@ro0NL
Copy link
Contributor Author

ro0NL commented Aug 14, 2020

fixed by #37670

@ro0NL ro0NL closed this as completed Aug 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants