本地化包含名称列表的字符串 [英] Localizing a string containing list of names

查看:69
本文介绍了本地化包含名称列表的字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含名称列表的字符串,如下所示: 约翰向金,凯利,李和鲍勃询问了新年计划".列表中的名称数量可以非常多. 如何在Java中将其本地化? 我在考虑ResourceBundle和MessageFormat.我该如何在MessageFormat中编写模式? 有没有更好的方法?

I have string containing a list of name like below: "John asked Kim, Kelly, Lee and Bob about the new year plans". The number of names in the list can very. How can I localize this in Java? I am thinking about ResourceBundle and MessageFormat. How will I write the pattern for this in MessageFormat? Is there any better approach?

推荐答案

您可以执行以下操作:

"{0} asked {1} about the new year plans"

其中0是名字,而1是其他名字的逗号分隔列表.

where 0 is the first name and 1 is a comma-separated list of the other names.

希望这会有所帮助.

这篇关于本地化包含名称列表的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆