相关疑难解决方法(0)

strings.xml中的参数是否可能?

在我的Android应用程序中,我将使用国际化来实现我的字符串.我的语法和句子用不同语言构建的方式有问题.

例如:

"5分钟前" - 英文

"vor 5 Minuten" - 德语

我可以在strings.xml中执行以下操作吗?

<string name="timeFormat">{0} minutes ago</string>
Run Code Online (Sandbox Code Playgroud)

然后有些神奇的

getString(R.id.timeFormat, dynamicTimeValue)
Run Code Online (Sandbox Code Playgroud)

此行为也将解决不同单词顺序的其他问题.

string parameters android dynamic optional

268
推荐指数
5
解决办法
14万
查看次数

如何翻译字符串数组中的项目?

我有一些字符串数组和很多字符串项,我无法使用翻译编辑器进行翻译.

<string-array name="miocene_infos_list">
    <item>The Miocene era was mostly characterized by arrival of a bizarre array of mammalian megafauna. Astrapotherium was a
        hooved ungulate that looked like a cross between an elephant, a tapir and a rhinoceros. It was a distance relative
        of horse. It had short, prehensile trunk and powerful tusks. It\'s hind limbs were significantly weaker than the fore limbs.
        The nostrils of Astrapotherium were also set unusually high which shows that this prehistoric herbivore may have adapted
        partly …
Run Code Online (Sandbox Code Playgroud)

xml arrays android translation

1
推荐指数
2
解决办法
8107
查看次数

标签 统计

android ×2

arrays ×1

dynamic ×1

optional ×1

parameters ×1

string ×1

translation ×1

xml ×1