Page 1 of 1

Using translation center : hardcoded htmlentities

Posted: Wed May 12, 2010 3:02 pm
by redwarp
Well, this topic belongs here and in the translation section I guess.
Recently, an add-on I'm working on got added to the translation center, and it's awesome.
But I noticed that the lang files generated through the translation center go through the htmlentities function before being saved.

It's actually causing problem with some popup, when your langage uses accented chars (For exemple : french.). For instance, the popup that shows up when you uninstall a module :
English text was

Code: Select all

Authorized IP list will be destroyed. Are you sure you wan\'t to uninstall IPLock ?
I translated it in french through the translation center, and it became

Code: Select all

La liste des IP autorisée sera détruite. Êtes-vous sur de vouloir désinstaller IPLock ?
But, in the generated file, it became

Code: Select all

La liste des IP autorisée sera détruite. Êtes-vous sur de vouloir désinstaller IPLock ?
Okay.
That htmlentities, or looks like it.

In the module.php file, i wrote :

Code: Select all

	function UninstallPreMessage() {
		return $this->Lang ( 'preuninstall' );
	}
(Where preuninstall links to the text I wrote before)

When I uninstall the module, instead of reading
La liste des IP autorisée sera détruite. Êtes-vous sur de vouloir désinstaller IPLock ?
,
I read
La liste des IP autorisée sera détruite. Êtes-vous sur de vouloir désinstaller IPLock ?
Huuugh. Looks like javascript popup don't do well with htmlentities. Crap.
The solution I found, that isn't entirely satisfactory, is to write in the module.php file :

Code: Select all

	function UninstallPreMessage() {
		return html_entity_decode($this->Lang ( 'preuninstall' ),ENT_NOQUOTES, 'UTF-8');
	}
Well, if anyone as a better solution, let me know ! If not, well... I thought it be worth sharing.
--
Redwarp

Re: Using translation center : hardcoded htmlentities

Posted: Wed May 12, 2010 4:14 pm
by calguy1000
what javascript popup? where?

Re: Using translation center : hardcoded htmlentities

Posted: Wed May 12, 2010 4:18 pm
by redwarp
Maybe pop-up is not the right word. The alert box you get when you hit the 'uninstall' link, on the module panel.
Or any alert box, by the way.

Re: Using translation center : hardcoded htmlentities

Posted: Sun May 16, 2010 9:51 pm
by redwarp
Actually, any alert box. And the help page in the module manager, when you hit "help" before installing the module.