简体   繁体   中英

Localizing non-breaking space in Windows 8

I'm trying to localize a Windows 8 Metro style app as described in a guide on MSDN . This worked very well so far, but now I'm trying to localize a string containing a non-breaking space which appears in a XAML file (originally as hexadecimal xml-escaped string: &#x00a0). Just putting the above string into the Resources.resw file does not work, it appears just as &#x00a0. What do I have to do to get a non-breaking space in my localizations?

&#00a0 is a XML character literal, which means that <foo>&#00a0</foo> has the inner-text equal to the string "\\x00a0".

Probably the best thing for you to do is to dynamically reference the string, and perform a replace:

var loader = new Windows.ApplicationModel.Resources.ResourceLoader();
var str = loader.GetString('Farewell');
var modstring = str.Replace("&#00a0", "\x00a0");
myControl.Text = modstring;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM