0

I have looked on Stack overflow for an answer but can't seem to find one relating to c# wpf they all seem to be web and html solutions.

I have the following line of code

      contactName = string.Format("{0} ({1})", person.Name, person.Age);

This puts the persons name and then in brackets their age. We have localized our application to be in arabic so we can test that the right to left text formatting will work however whenever this string appears on screen it is always displayed as (Bob (35

I have read that this is a problem with the bidirectional algorithm but have no idea how to fix it.

If I add something so the bracket is not at the end then it works.

      contactName = string.Format("{0} ({1}).", person.Name, person.Age);

But we don't want to have to put a full stop at the end of every piece of text with a bracket at the end.

If anyone could help it would be really useful. Ideally we would be looking for a solution which we can do application wide rather than having to find every instance where there is going to be a bracket at the end of the text and implement the fix.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Keithin8a
  • 961
  • 7
  • 32
  • I'm sorry but a search on google for "c# bracket right to left" show that your question seems to be a duplicate of this one : http://stackoverflow.com/questions/15471500/right-to-left-bracket-display-wrong or this one http://stackoverflow.com/questions/14503691/right-to-left-language-bracket-reversed Basically you should look at the RTL/LTR mark position in the final string (as it is probably present in the 'name' field, it will be added in the middle of the final string). I hope this help. – Orace Feb 23 '15 at 10:48
  • That first link didn't help at all really apart from providing me with the Unicode string. When I looked at that before, for some reason it completely slipped my mind that you have to use the \ to get it to recognise it. Is there no way to format this for the entire application though? They user has the ability to change the language in the application so and that handles everything fine so I find it strange that there isn't a global settings for this. – Keithin8a Feb 23 '15 at 11:10

0 Answers0