Skip to content

i18n extract from .twig-files #91

Description

@fabian-mcfly

I'm not quiet sure if this belongs here or if it should be part of the cakephp repo.

Currently cakephp's i18n extract-command only looks for and reads files with the php-extension (https://github.com/cakephp/cakephp/blob/8b5d4b65ca63478bb525042eb95071d6749b5c30/src/Command/I18nExtractCommand.php#L839)

This leads to missing translatable strings from .twig-files when using this twig-view-package.

Simply adding the twig-extension in the lookup is not sufficient because the _extractTokens()-method of that command uses php's token_get_all()-function (see https://github.com/cakephp/cakephp/blob/8b5d4b65ca63478bb525042eb95071d6749b5c30/src/Command/I18nExtractCommand.php#L431)

The two main questions I have:

  1. How to parse the twig templates files and look for calls to the i18n functions?
  2. How to add that functionality to the command line?
    Should this package provie a standalone extract command? Would it be possible to extend cakephp's I18nExtractCommand?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions