Thực hành

Muốn giỏi một ngôn ngữ lập trình nào đó thì phải viết được các chương trình bằng ngôn ngữ đó (paraphrase lời của cha đẻ ngôn ngữ lập trình C)

Dynamic arguments binding with OpenSocial message bundle

1. Problem

- Working with OpenSocial message bundle for localization, sometimes it's necessary to bind dynamic arguments to the message. For example, we have greeting message like this: Hello {user} in which user will be replaced by user's name. But currently with OpenSocial api, we can't. We just can get message bundle by the key without passing any arguments for substitution.

- So this is my approach: using eXo.social.Locale.getMsg(key) the same as prefs.getMsg(key) and eXo.social.Locale.getMsg(key, [val1, val2,...]); for dynamic arguments binding with message bundle.

Syndicate content