Description
Follow up of #8508 (comment)
Background
Magento automatically picks up strings which should be supplied for the frontend translation via component via js-translation.json. This misses some strings, leaving hard-to-debug problems with translations to other languages.
Summary (*)
The process of fetching strings for js-translation.json has problems in 2.3.5 - and I am pretty sure it's still a problem in the dev master.
We struggled to translate the string "items" for the knockout component "minicart".
Steps to reproduce (*)
- Create a new custom module.
- Set Locale language to French (France) in Admin configurations Stores->Configurations->General->Locale Options.
- Add French translation for ‘foo bar 123’ in Admin Panel to “barre de foo 123”
- Keep string in newly created module phtml file to check if string is getting translated.
- Flush cache and check module on frontend.
Result: String is not getting translated with knockout js tag. It is displayed as ‘foo bar 123’ only.
Examples (*)
The extraction of the files happens here:
magento2/app/code/Magento/Translation/Model/Js/DataProvider.php
Lines 97 to 102 in 32fda1c
The translatable string "items" is introduced here:
But the above extraction method does not count *.phtml files in - so translations like this are lost. (it eventually might still end up in the js-translation.json if the same string is used somewhere else in the theme, so such would cover up this bug)
Proposed solution
Include \Magento\Framework\App\Utility\Files::getPhtmlFiles or something similar in the list of files - but this might have a performance impact.
Or remove the whole automatic string extraction and add a manual list of strings which should be included in js-translation.json - this would make the whole process much simpler and less magic.
--
Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.
- Severity: S0 - Affects critical data or functionality and leaves users with no workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.