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/*
20 * THE FILE HAS BEEN AUTOGENERATED BY MSGTOOL TOOL.
21 * All changes made to this file manually will be overwritten
22 * if this tool runs again. Better make changes in the template file.
23 */
24
25package org.apache.harmony.misc.internal.nls;
26
27
28import java.security.AccessController;
29import java.security.PrivilegedAction;
30import java.util.Locale;
31import java.util.MissingResourceException;
32import java.util.ResourceBundle;
33
34// BEGIN android-changed
35import org.apache.harmony.luni.util.MsgHelp;
36// END android-changed
37
38/**
39 * This class retrieves strings from a resource bundle and returns them,
40 * formatting them with MessageFormat when required.
41 * <p>
42 * It is used by the system classes to provide national language support, by
43 * looking up messages in the <code>
44 *    org.apache.harmony.misc.internal.nls.messages
45 * </code>
46 * resource bundle. Note that if this file is not available, or an invalid key
47 * is looked up, or resource bundle support is not available, the key itself
48 * will be returned as the associated message. This means that the <em>KEY</em>
49 * should a reasonable human-readable (English) string.
50 *
51 */
52public class Messages {
53
54    // BEGIN android-changed
55    private static final String sResource =
56        "org.apache.harmony.misc.internal.nls.messages"; //$NON-NLS-1$
57    // END android-changed
58    /**
59     * Retrieves a message which has no arguments.
60     *
61     * @param msg
62     *            String the key to look up.
63     * @return String the message for that key in the system message bundle.
64     */
65    static public String getString(String msg) {
66        // BEGIN android-changed
67        return MsgHelp.getString(sResource, msg);
68        // END android-changed
69    }
70
71    /**
72     * Retrieves a message which takes 1 argument.
73     *
74     * @param msg
75     *            String the key to look up.
76     * @param arg
77     *            Object the object to insert in the formatted output.
78     * @return String the message for that key in the system message bundle.
79     */
80    static public String getString(String msg, Object arg) {
81        return getString(msg, new Object[] { arg });
82    }
83
84    /**
85     * Retrieves a message which takes 1 integer argument.
86     *
87     * @param msg
88     *            String the key to look up.
89     * @param arg
90     *            int the integer to insert in the formatted output.
91     * @return String the message for that key in the system message bundle.
92     */
93    static public String getString(String msg, int arg) {
94        return getString(msg, new Object[] { Integer.toString(arg) });
95    }
96
97    /**
98     * Retrieves a message which takes 1 character argument.
99     *
100     * @param msg
101     *            String the key to look up.
102     * @param arg
103     *            char the character to insert in the formatted output.
104     * @return String the message for that key in the system message bundle.
105     */
106    static public String getString(String msg, char arg) {
107        return getString(msg, new Object[] { String.valueOf(arg) });
108    }
109
110    /**
111     * Retrieves a message which takes 2 arguments.
112     *
113     * @param msg
114     *            String the key to look up.
115     * @param arg1
116     *            Object an object to insert in the formatted output.
117     * @param arg2
118     *            Object another object to insert in the formatted output.
119     * @return String the message for that key in the system message bundle.
120     */
121    static public String getString(String msg, Object arg1, Object arg2) {
122        return getString(msg, new Object[] { arg1, arg2 });
123    }
124
125    /**
126     * Retrieves a message which takes several arguments.
127     *
128     * @param msg
129     *            String the key to look up.
130     * @param args
131     *            Object[] the objects to insert in the formatted output.
132     * @return String the message for that key in the system message bundle.
133     */
134    static public String getString(String msg, Object[] args) {
135        // BEGIN android-changed
136        return MsgHelp.getString(sResource, msg, args);
137        // END android-changed
138    }
139
140    // BEGIN android-note
141    // Duplicate code was dropped in favor of using MsgHelp.
142    // END android-note
143}
144