|
Re: Externalization of check messages [message #526452 is a reply to message #526433] |
Sun, 11 April 2010 09:46 |
|
hello mahmoud,
i don't know a direct way to do this but you can easy achive something similar by moving the message producing part of the check to a separate extension file.
metamodel/checks.chk
extension metamodel::messages;
context metamodel::Model ERROR msgABC() :
false;
metamodel/messages.ext
String msgABC() : "There is an error";
or with some extra stuff you could even use java resource bundles
package metamodel;
import java.text.MessageFormat;
import java.util.List;
import java.util.ResourceBundle;
public class I18NHelper {
public static String msg(String key, List<Object> args) {
return MessageFormat.format(ResourceBundle.getBundle("messages").getString(key), args.toArray());
}
}
messages.properties
String msg(String key, List args) :
JAVA metamodel.I18NHelper.msg(java.lang.String, java.util.List);
context metamodel::Model ERROR msg("ABC",{}) :
false;
may not be perfect but working
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03612 seconds