0

Does anyone know how to go about localizing dynamic variables in code using xamarin.ios? I have this done for static variables. The example below explains more:

//this work
var test = NSBundle.MainBundle.LocalizedString(“Qty 1234”,”test text”);

//what i need is to figure out how to localize the below
var test = "Qty" + aValue; //where aValue is dynamically generated number ex:1,2,3,4,5

Moreover, how would i go about adjusting the monotouch.dialog element to now display right-to-left i.e caption on the left and value on the right (for arabic text)? Thanks in advance.

4

1 回答 1

0

使用 String.Format 而不是串联:

var test = String.Format(NSBundle.MainBundle.LocalizedString(“Qty {0}”,”test text”), aValue);

这应该在您的 中查找消息“Qty {0}”,Localized.strings为其返回翻译后的格式,然后{0}将替换为aValue

Monotouch.Dialog 是建立在 UITableView 之上的,所以这个问题的答案(UITableView support for right to left languages)应该适用:你必须自己写UITableViewCell

于 2013-07-22T08:32:35.037 回答