yasir517 Posted November 19, 2021 Share Posted November 19, 2021 Hello everyone. Anyone knows how to do custom text translation within Prestashop theme in 1.7.7.1 version. I want to add some additional and want to translate it into multiple languages. Urgent help needed. Link to comment Share on other sites More sharing options...
JBW Posted November 19, 2021 Share Posted November 19, 2021 Where and how do you place the text? If it's in a description field it shoud have all language options by default. If you put it in a template file you can use {l} function., Link to comment Share on other sites More sharing options...
yasir517 Posted November 19, 2021 Author Share Posted November 19, 2021 (edited) I want to use it in the template theme tpl file.I am using classic theme.I am writing { s=‘test… but it is not appearing in the back admin translations. Edited November 19, 2021 by yasir517 (see edit history) Link to comment Share on other sites More sharing options...
Mr Rick Posted November 24, 2021 Share Posted November 24, 2021 Did you try passing the d like {l s='Description' d='Shop.Theme.Catalog'} Link to comment Share on other sites More sharing options...
yasir517 Posted November 26, 2021 Author Share Posted November 26, 2021 Yes I did but it is not working. Link to comment Share on other sites More sharing options...
yasir517 Posted November 27, 2021 Author Share Posted November 27, 2021 Any help will be highly appreciated. I got stuck and that's the last thing I have to do for wrapping up the project. Link to comment Share on other sites More sharing options...
yasir517 Posted November 28, 2021 Author Share Posted November 28, 2021 I found the solution. Here is what it is. These methods only work if you are working on a theme with a name that is not “classic”. If you’re tweaking the Classic theme and you’ve kept the “/classic” folder, your new strings won’t be detected. PrestaShop is only looking for new strings in theme folders other than “/classic”. Link to comment Share on other sites More sharing options...
JBW Posted November 30, 2021 Share Posted November 30, 2021 On 11/29/2021 at 12:26 AM, yasir517 said: If you’re tweaking the Classic theme and you’ve kept the “/classic” folder, Don't do this! Any later Prestashop upgrade will mess it up. Please check out the child-theme feature and do any theme adjustments there. Link to comment Share on other sites More sharing options...
MURAT ONUR YUKSEL Posted May 21, 2023 Share Posted May 21, 2023 To simplify the custom features value availability in different languages , you can change the below script inside Classes/Product.php Once you add new customized features in main language, those inputs will be available in other languages too. You will not have to copy paste everytime. Find ------------- public function addFeaturesCustomToDB($id_value, $lang, $cust) { $row = ['id_feature_value' => (int) $id_value, 'id_lang' => (int) $lang, 'value' => pSQL($cust)]; return Db::getInstance()->insert('feature_value_lang', $row); } ---------------- and Change to public function addFeaturesCustomToDB($id_value, $lang, $cust) { if (trim($cust)=='') { $sql = 'SELECT f.`value`' .' FROM `'. _DB_PREFIX_.'feature_value_lang` f ' .' WHERE f.id_feature_value = '.$id_value.' and id_lang<>'.$lang; $cust= Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql); } $row = array('id_feature_value' => (int) $id_value, 'id_lang' => (int) $lang, 'value' => pSQL($cust)); return Db::getInstance()->insert('feature_value_lang', $row); } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now