Things you learn about localization in XPages – french script tags

In the current project I am working on we are using localization to allow translation into other languages. For more on localization check out this wiki entry

Much to my horror I found out yesterday that <script> tags are translated – as if it was just text on the screen.

	alert('hi Marky')

when localization is turned on for French looks like this

	[fr| alert('hi Marky')]

and funnily enough that causes problems in your code.

The reason it does this is because by default localization translates any text on the page and creates the appropriate properties file tage for it in the database – this is very cool when you want it to be, and apparently very annoying when you don’t. Localization clearly does not see any difference between <script> and <div> on the page for this purpose.

To correct this issue. you need use the computed output script instead.

	<xp:scriptBlock id="scriptBlock1">
			alert('hi Marky')

2 thoughts on “Things you learn about localization in XPages – french script tags

  1. It actually makes sense — localization sets up a placeholder even for static text on the page (although it does it ordinally and is a significant risk that will cause problems if you add/remove static text on the page before it). Definitely not something you’d expect to happen, though! Good thing there’s an easy workaround.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s