Jump to content

Translation problem in Blocks Modules


z4m0lx3

Recommended Posts

Hello,

I have installed prestashop and a template from TM with no problem.

The language pack is Romanian, but that doesn't matter. It worked perfectly until I've changed something in Admin>Translations.

Now the blocks Cart, Categories, Specials and User Info show english language. Before it was OK, it was showing romanian.

I don't know how to restore it, or where the problem might be. The modules language .php and Admin>Translations are OK.

The link is www[dot]girl-fashion[dot]ro

Thank you.

Link to comment
Share on other sites

Hi,

Where did you find you translation pack ?
Do you still have a copy of this pack before you've done modification in the transaltion ?

In that case, can you paost here, the ru.php file you can find in on of these modules ?
(or send me in PM)

Link to comment
Share on other sites

Yeah sure..I got it from here.

Thing is, when I change

{l s='Featured products' mod='homefeatured'}

for example in

{l s='Translated Line' mod='homefeatured'}

the module shows the translated line. Just that it seems it doesn't get the translation from the file or something.

The ro.php shows OK. Here is an example:


<?php

global $_MODULE;
$_MODULE = array();
$_MODULE['<{homefeatured}prestashop>homefeatured_cd2c2dc24eaf11ba856da4a2e2a248be'] = 'Produse promitionale in pagina acasa';
$_MODULE['<{homefeatured}prestashop>homefeatured_b494beb5de5dd7b4fad67262e0de6321'] = 'Arata produse promotionale in mijlocul paginii acasa';
$_MODULE['<{homefeatured}prestashop>homefeatured_c888438d14855d7d96a2724ee9c306bd'] = 'Setările au fost salvate';
$_MODULE['<{homefeatured}prestashop>homefeatured_f4f70727dc34561dfde1a3c529b6205c'] = 'Setări';
$_MODULE['<{homefeatured}prestashop>homefeatured_6df1f9b5662398a551a2c9185b26638a'] = 'Pentru a putea adauga produse in pagina acasa, adauga produsele in categoria acasa.';
$_MODULE['<{homefeatured}prestashop>homefeatured_20c47700083df21a87e47d9299ef4dc4'] = 'Numarul produselor afisate';
$_MODULE['<{homefeatured}prestashop>homefeatured_ada7594fb1614c6b6d271699c8511d5e'] = 'Numarul produselor afisate in pagina acasa (implcit: 10)';
$_MODULE['<{homefeatured}prestashop>homefeatured_c9cc8cce247e49bae79f15173ce97354'] = 'Salvează';
$_MODULE['<{homefeatured}prestashop>homefeatured_ca7d973c26c57b69e0857e7a0332d545'] = 'Produse promotionale';
$_MODULE['<{homefeatured}prestashop>homefeatured_d3da97e2d9aee5c8fbe03156ad051c99'] = 'Mai mult';
$_MODULE['<{homefeatured}prestashop>homefeatured_4351cfebe4b61d8aa5efa1d020710005'] = 'Vezi';
$_MODULE['<{homefeatured}prestashop>homefeatured_2d0f6b8300be19cf35e89e66f0677f95'] = 'Adaugă în coş';
$_MODULE['<{homefeatured}prestashop>homefeatured_e0e572ae0d8489f8bf969e93d469e89c'] = 'Nici un produs.';


I've only done modifications in the Admin>Translations (not in the ro.php file)
Link to comment
Share on other sites

i've also tried reinstalling the module..
i've created an en.php in the modules folder and copied the .ro php content

it doesn't work

i think something happened when i changed something in Tools>Translations>Module Translations

Link to comment
Share on other sites

I remember I was usually modifying the language directly in the modules ro.php

But I needed to change something in a user module and I used the Translations interface.

When I saved the translations...puff* I got this problem

Link to comment
Share on other sites

i didn't want to do this..but here it is

I copied the modules from the template into the modules/ folder of prestashop and changed the name of themes/girl-fashion/modules so it won't have access to that.

Now it gets the modules directly from the prestashop modules/ folder and the language as well...

I really can't see the problem, but this is a temporary solution..

If anyone has another idea?

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

I'm having the very same problem! I installed a Off Line Credit Card module . When I made some Portuguese translating for this module, my Cart and Featured Block lost their Spanish and Portuguese and only works in English! I tried to uninstall the Credit Card module but wont help. I'm using Prestashop 1.3.2.1.

Any suggestions?

Link to comment
Share on other sites

I also had the same problem (version 1.4.0.17). When you use the translator to edit a language translation, the system replaces the language files in every module and if the language files doesn't exist it will create it.

That means that the system also creates an empty language file in every module under themes folder. Then when you reload your store the translations of the modules that exist in the modules folder under themes folder don't work.

I found out that when I delete the language files of every module under theme folder the translations work ok again. But I must do this every time I use the translator. I can not imagine why that happens but doing this the translation problem is solved.

Link to comment
Share on other sites

  • 7 months later...

I also had the same problem (version 1.4.0.17). When you use the translator to edit a language translation, the system replaces the language files in every module and if the language files doesn't exist it will create it.

That means that the system also creates an empty language file in every module under themes folder. Then when you reload your store the translations of the modules that exist in the modules folder under themes folder don't work.

I found out that when I delete the language files of every module under theme folder the translations work ok again. But I must do this every time I use the translator. I can not imagine why that happens but doing this the translation problem is solved.

 

correct, this issue still exists in ps 1.4.4.1. did anybody submit that to bug tracker?

Link to comment
Share on other sites

  • 1 month later...

Similar problem here.

 

When I update modules translations, it erases more than half of the translations...

 

Curiousily, the modules that lose that translation are within F and Z in the alphabetic order. :S

 

For example, nothing happens to "bankwire" module translation, while "homefeatured" lose its translations.

 

v1.3.2

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...

i didn't want to do this..but here it is

 

I copied the modules from the template into the modules/ folder of prestashop and changed the name of themes/girl-fashion/modules so it won't have access to that.

 

Now it gets the modules directly from the prestashop modules/ folder and the language as well...

 

I really can't see the problem, but this is a temporary solution..

 

If anyone has another idea?

 

Just tried that, it works. Will have to do it like this until fixed. Thanks :)

Link to comment
Share on other sites

  • 4 weeks later...

Just tried that, it works. Will have to do it like this until fixed. Thanks :)

 

I had the very same problem and I solved with the above way, although it is not a profeciaonaly solution.

Thw dissapointing thik is that I see that this problem exists on over a year on several editions and noone did something to fix it in a proper way...

Link to comment
Share on other sites

  • 2 months later...

Hey guys,

 

I also had this problem (with version 1.4.7.3) and decided to look into the code to fix it :)

 

The problem is that the function to write the files, first checks if a file exists, if not, it will make it. Then it checks if the content is empty or not, if it is empty it ignores it and otherwise it writes it. So I changed that a bit.

 

I made it so it will not make an empty file if the content is empty.

 

What I did:

 

First delete all the empty language files from themes/yourtheme/modules/*/

 

Then open /admin/tabs/AdminTranslations.php, search for the function findAndWriteTranslationsIntoFile

 

Change:

   	 // Set file_name in static var, this allow to open and wright the file just one time
	if (!isset($_cache_file[($is_default ? self::DEFAULT_THEME_NAME : $theme_name).'-'.$file_name]) )
	{
		$str_write = '';
		$_cache_file[($is_default ? self::DEFAULT_THEME_NAME : $theme_name).'-'.$file_name] = true;
		if (!file_exists($file_name))
			file_put_contents($file_name, '');
		if (!is_writable($file_name))
			die ($this->l('Cannot write the theme\'s language file ').'('.$file_name.')'.$this->l('. Please check write permissions.'));

		// this string is initialized one time for a file
		$str_write .= "<?php\n\nglobal \$_MODULE;\n\$_MODULE = array();\n";
		$array_check_duplicate = array();
	}

to:

	// FIX BY NOZONDA - NICO
	// Fix: first get all the content, then check if it's not empty, and if not > make file.

	// Set file_name in static var, this allow to open and wright the file just one time
	if (!isset($_cache_file[($is_default ? self::DEFAULT_THEME_NAME : $theme_name).'-'.$file_name]) )
	{
		// this string is initialized one time for a file
		$str_write = "<?php\n\nglobal \$_MODULE;\n\$_MODULE = array();\n";
		$array_check_duplicate = array();
	}
	// END OF FIX BY NOZONDA - NICO

And after the foreach() loop add:

   	 // FIX BY NOZONDA - NICO
	if (!isset($_cache_file[($is_default ? self::DEFAULT_THEME_NAME : $theme_name).'-'.$file_name]) && $str_write != "<?php\n\nglobal \$_MODULE;\n\$_MODULE = array();\n")
	{
		$_cache_file[($is_default ? self::DEFAULT_THEME_NAME : $theme_name).'-'.$file_name] = true;
		if (!file_exists($file_name))
			file_put_contents($file_name, '');
		if (!is_writable($file_name))
			die ($this->l('Cannot write the theme\'s language file ').'('.$file_name.')'.$this->l('. Please check write permissions.'));
	}
	// END OF FIX BY NOZONDA - NICO

 

I think making changes in the core is very bad, but in this case it seems necessary. That is why I added my own name and company name as comment. I recommend you all to do the same with all core changes. This way you can easily find all core changes when you update Prestashop.

 

Good luck.

Edited by Nozonda (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 6 months later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...