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.security.internal.nls;
25
26
27import java.security.AccessController;
28import java.security.PrivilegedAction;
29import java.util.Locale;
30import java.util.MissingResourceException;
31import java.util.ResourceBundle;
32
33// BEGIN android-changed
34import org.apache.harmony.luni.util.MsgHelp;
35// BEGIN android-changed
36
37/**
38 * This class retrieves strings from a resource bundle and returns them,
39 * formatting them with MessageFormat when required.
40 * <p>
41 * It is used by the system classes to provide national language support, by
42 * looking up messages in the <code>
43 *    org.apache.harmony.security.internal.nls.messages
44 * </code>
45 * resource bundle. Note that if this file is not available, or an invalid key
46 * is looked up, or resource bundle support is not available, the key itself
47 * will be returned as the associated message. This means that the <em>KEY</em>
48 * should a reasonable human-readable (english) string.
49 *
50 */
51public class Messages {
52
53    // BEGIN android-changed
54    private static final String sResource =
55        "org.apache.harmony.security.internal.nls.messages"; //$NON-NLS-1$
56    // END android-changed
57
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