core icon indicating copy to clipboard operation
core copied to clipboard

[Translations] translation configuration not working like expected

Open rallek opened this issue 5 years ago • 1 comments

Q A
Zikula Version 3.0.0
PHP Version 7.4.5

Expected Behavior

I should be able to change some settings in a yaml file to be able to generate my translation in po format

Current Behavior

I tried several changes inside config dir with no success. at the end I got an error

Possible Solution

no idea

Steps to Reproduce

I will try to explain my try out with the example zikulapagesmodule I always generate my translation via this console comand: php -dmemory_limit=2G bin/console translation:extract --bundle ZikulaPagesModule extension de

zikula/config/dynamic/generated.yaml

        zikulapagesmodule:
            excluded_names: ['*TestCase.php', '*Test.php']
            excluded_dirs: [vendor]
            output_format: **po**
            local_file_storage_options: { default_output_format: **po** }
            output_dir: /www/htdocs/w005fe6d/3.k62.org/zikula/src/extensions/Zikula/PagesModule/Resources/translations
            external_translations_dir: /www/htdocs/w005fe6d/3.k62.org/zikula/src/extensions/Zikula/PagesModule/Resources/translations

Generated translation files are still yaml format.

I think, this file should not be touched, because it is generated. After adding another module it will be renewed and all changes are gone.

Next try: zikula/config/dynamic/default.yaml

translation:
    configs:
        zikula:
            dirs: [] # will be set dynamically
            output_dir: '%kernel.project_dir%/translations'
            excluded_names: ['*TestCase.php', '*Test.php']
            excluded_dirs: [vendor, cache, data, log]
            output_format: yaml
            local_file_storage_options:
                default_output_format: yaml
        extension:
            excluded_names: ['*TestCase.php', '*Test.php']
            excluded_dirs: [vendor]
            output_format: **po**
            local_file_storage_options:
                default_output_format: **po**

Same result, still generating yaml files

one more change in zikula/config/dynamic/generated.yaml

translation:
    configs:
        zikula:
            dirs: []
            output_dir: '%kernel.project_dir%/translations'
            excluded_names: ['*TestCase.php', '*Test.php']
            excluded_dirs: [vendor, cache, data, log]
            output_format: yaml
            local_file_storage_options: { default_output_format: yaml }
        extension:
            excluded_names: ['*TestCase.php', '*Test.php']
            excluded_dirs: [vendor]
            output_format: **po**
            local_file_storage_options: { default_output_format: **po** }
        munewsmodule:
            excluded_names: ['*TestCase.php', '*Test.php']
            excluded_dirs: [vendor]
            output_format: yaml
            local_file_storage_options: { default_output_format: yaml }
            output_dir: /www/htdocs/w005fe6d/3.k62.org/zikula/src/extensions/MU/NewsModule/Resources/translations
            external_translations_dir: /www/htdocs/w005fe6d/3.k62.org/zikula/src/extensions/MU/NewsModule/Resources/translations
        zikulapagesmodule:
            excluded_names: ['*TestCase.php', '*Test.php']
            excluded_dirs: [vendor]
            output_format: po
            local_file_storage_options: { default_output_format: po }
            output_dir: /www/htdocs/w005fe6d/3.k62.org/zikula/src/extensions/Zikula/PagesModule/Resources/translations
            external_translations_dir: /www/htdocs/w005fe6d/3.k62.org/zikula/src/extensions/Zikula/PagesModule/Resources/translations

I changed now the extensions setting because I think it will be generated that way after changing the default.yaml. Now I do get an error message while extracting my translations:

php -dmemory_limit=2G bin/console translation:extract --bundle ZikulaPagesModule extension de

In PoFileDumper.php line 71:

  Argument 1 passed to Symfony\Component\Translation\Dumper\PoFileDumper::getStandardRules() must
   be of the type string, null given, called in /www/htdocs/w005fe6d/3.k62.org/zikula/vendor/symf
  ony/symfony/src/Symfony/Component/Translation/Dumper/PoFileDumper.php on line 55


translation:extract [--hide-errors] [-b|--bundle BUNDLE] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> [<configuration> [<locale>]]

I think I now touched the right place but there is a bug.

rallek avatar Jul 14 '20 07:07 rallek

how this works has changed dramatically in 3.1.0 (at this time unreleased). @Guite it may be worth your time to see if the problem is resolved in 3.1.0.

craigh avatar Aug 28 '20 14:08 craigh

Closing as translation management has changed in 4.0

Guite avatar Apr 02 '23 10:04 Guite