In Magento1 we can get translated string by
_getTranslatedString() from app/code/core/Mage/Core/Model/Translate.php
but in Magento2 there is not such methods. Is there any alternative method available for this?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityI am not more knowledge about Magento 1
and _getTranslatedString()
function but as per your query this might be help to you.
Magento 2 already has a command that can collect all the texts from a certain folder that are translatable.
Since one module can mean 1 folder, let's say your module name is app/code/Vendor/Module
you can collect all translatable texts like this:
bin/magento i18n:collect-phrases app/code/Vendor/Module/ -o app/code/Vendor/Module/i18n/en_US_raw.csv
Just make sure the folder i18n exists inside your module.
For more details Check this
string
inphtml
for different language?_getTranslatedString()
method so I am looking same method in Magento 2