01: // Copyright 2006, 2007 The Apache Software Foundation
02: //
03: // Licensed under the Apache License, Version 2.0 (the "License");
04: // you may not use this file except in compliance with the License.
05: // You may obtain a copy of the License at
06: //
07: // http://www.apache.org/licenses/LICENSE-2.0
08: //
09: // Unless required by applicable law or agreed to in writing, software
10: // distributed under the License is distributed on an "AS IS" BASIS,
11: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: // See the License for the specific language governing permissions and
13: // limitations under the License.
14:
15: package org.apache.tapestry.ioc;
16:
17: /**
18: * Provides access to a messages catalog, a set of properties files that provide localized messages
19: * for a particular locale. The message catalog consists of keys and values and follows the
20: * semantics of a Java {@link java.util.ResourceBundle} with some changes.
21: */
22: public interface Messages {
23: /** Returns true if the bundle contains the named key. */
24: boolean contains(String key);
25:
26: /**
27: * Returns the localized message for the given key. If catalog does not contain such a key, then
28: * a modified version of the key is returned (converted to upper case and enclosed in brackets).
29: *
30: * @param key
31: * @return localized message for key, or placeholder
32: */
33: String get(String key);
34:
35: /**
36: * Returns a formatter for the message, which can be used to substitute arguments (as per
37: * {@link java.util.Formatter}).
38: *
39: * @param key
40: * @return formattable object
41: */
42: MessageFormatter getFormatter(String key);
43:
44: /**
45: * Convienience for accessing a formatter and formatting a localized message with arguments.
46: */
47:
48: String format(String key, Object... args);
49: }
|