[wp-polyglots] HTML entities in translated strings

Peter Westwood peter.westwood at ftwr.co.uk
Wed Mar 12 12:55:46 GMT 2008


On Wed, March 12, 2008 10:19 am, Thomas Henlich wrote:
> Hi everyone,
>
> in order to accomodate for different character encodings in WP, I am
> always using HTML entities in translations (e.g. ä instead of ä).
>
> However, I came across some cases where this does not work.
>
> For example, in wp-includes/script-loader.php:143
>
> $this->localize( 'post', 'postL10n', array(
> 	'tagsUsed' =>  __('Tags used on this post:'),
> 	'add' => attribute_escape(__('Add')),
> 	'addTag' => attribute_escape(__('Add new tag')),
> 	'separate' => __('Separate tags with commas'),
> 	) );
>
> the attribute_escape(__('Add')) would become
> attribute_escape('Hinzufügen') which would become
> 'Hinzufügen'
> which is not at all what I intended.
>
> What should I do? Is this a bug in WP, i.e. should the attribute_escape
> be removed? Or is HTML simply forbidden in this context?
>

attribute_escape is used within WordPress where ever anything is going to
go into an html attribute to ensure that we produce valid, safe html

It may be that attribute_escape should be able to cope with not double
escaping strings so what you are trying to do would work.

westi
-- 
Peter Westwood
http://blog.ftwr.co.uk | http://westi.wordpress.com
 C53C F8FC 8796 8508 88D6 C950 54F4 5DCD A834 01C5


More information about the wp-polyglots mailing list