开发者

How does Android handle multiple substitution in translation text?

开发者 https://www.devze.com 2023-03-29 19:47 出处:网络
I need to enter text like开发者_开发知识库 the following So far {0, integer} items added out of {1, integer} items.

I need to enter text like开发者_开发知识库 the following

So far {0, integer} items added out of {1, integer} items.

It does not do the substitution. Here is my code which should do the substitution.

MyActivity.this.getString(R.string.msgSoFarOutOf, new Object[]{Integer.valueOf(itemsAdded), Integer.valueOf(itemssTotal)})


You need to use %d, %s, etc., same as for String.format(). BTW, getString() is a varargs method, so you don't need an array.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号