1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *     http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/*
19 * THE FILE HAS BEEN AUTOGENERATED BY MSGTOOL TOOL.
20 * All changes made to this file manually will be overwritten
21 * if this tool runs again. Better make changes in the template file.
22 */
23
24package org.apache.harmony.instrument.internal.nls;
25
26// BEGIN android-added
27import org.apache.harmony.luni.util.MsgHelp;
28// END android-added
29
30/**
31 * This class retrieves strings from a resource bundle and returns them,
32 * formatting them with MessageFormat when required.
33 * <p>
34 * It is used by the system classes to provide national language support, by
35 * looking up messages in the <code>
36 *    org.apache.harmony.instrument.internal.nls.messages
37 * </code>
38 * resource bundle. Note that if this file is not available, or an invalid key
39 * is looked up, or resource bundle support is not available, the key itself
40 * will be returned as the associated message. This means that the <em>KEY</em>
41 * should a reasonable human-readable (english) string.
42 *
43 */
44public class Messages {
45
46    // BEGIN android-changed
47    private static final String sResource =
48        "org.apache.harmony.instrument.internal.nls.messages";
49    // END android-changed
50
51    /**
52     * Retrieves a message which has no arguments.
53     *
54     * @param msg
55     *            String the key to look up.
56     * @return String the message for that key in the system message bundle.
57     */
58    static public String getString(String msg) {
59        // BEGIN android-changed
60        return MsgHelp.getString(sResource, msg);
61        // END android-changed
62    }
63
64    /**
65     * Retrieves a message which takes 1 argument.
66     *
67     * @param msg
68     *            String the key to look up.
69     * @param arg
70     *            Object the object to insert in the formatted output.
71     * @return String the message for that key in the system message bundle.
72     */
73    static public String getString(String msg, Object arg) {
74        return getString(msg, new Object[] { arg });
75    }
76
77    /**
78     * Retrieves a message which takes 1 integer argument.
79     *
80     * @param msg
81     *            String the key to look up.
82     * @param arg
83     *            int the integer to insert in the formatted output.
84     * @return String the message for that key in the system message bundle.
85     */
86    static public String getString(String msg, int arg) {
87        return getString(msg, new Object[] { Integer.toString(arg) });
88    }
89
90    /**
91     * Retrieves a message which takes 1 character argument.
92     *
93     * @param msg
94     *            String the key to look up.
95     * @param arg
96     *            char the character to insert in the formatted output.
97     * @return String the message for that key in the system message bundle.
98     */
99    static public String getString(String msg, char arg) {
100        return getString(msg, new Object[] { String.valueOf(arg) });
101    }
102
103    /**
104     * Retrieves a message which takes 2 arguments.
105     *
106     * @param msg
107     *            String the key to look up.
108     * @param arg1
109     *            Object an object to insert in the formatted output.
110     * @param arg2
111     *            Object another object to insert in the formatted output.
112     * @return String the message for that key in the system message bundle.
113     */
114    static public String getString(String msg, Object arg1, Object arg2) {
115        return getString(msg, new Object[] { arg1, arg2 });
116    }
117
118    /**
119     * Retrieves a message which takes several arguments.
120     *
121     * @param msg
122     *            String the key to look up.
123     * @param args
124     *            Object[] the objects to insert in the formatted output.
125     * @return String the message for that key in the system message bundle.
126     */
127    static public String getString(String msg, Object[] args) {
128        // BEGIN android-changed
129        return MsgHelp.getString(sResource, msg, args);
130        // END android-changed
131    }
132}
133