View Javadoc
1   /*
2    * Licensed to The Apereo Foundation under one or more contributor license
3    * agreements. See the NOTICE file distributed with this work for additional
4    * information regarding copyright ownership.
5    *
6    *
7    * The Apereo Foundation licenses this file to you under the Educational
8    * Community License, Version 2.0 (the "License"); you may not use this file
9    * except in compliance with the License. You may obtain a copy of the License
10   * at:
11   *
12   *   http://opensource.org/licenses/ecl2.txt
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
17   * License for the specific language governing permissions and limitations under
18   * the License.
19   *
20   */
21  
22  
23  package org.opencastproject.elasticsearch.api;
24  
25  import java.io.Serializable;
26  import java.util.Locale;
27  
28  /**
29   * A <code>Language</code> consists of a language identifier, e.g. <code>de</code> to identify the German language, and
30   * of the language description in the various supported languages. There is also a connection to the associate
31   * <code>Locale</code>.
32   * 
33   * @see Locale
34   */
35  public interface Language extends Serializable, Comparable<Language> {
36  
37    /**
38     * Returns the locale that is associated with the language.
39     * 
40     * @return the locale
41     */
42    Locale getLocale();
43  
44    /**
45     * Returns the name of this language in its own language, e.g
46     * <ul>
47     * <li><code>English</code> for English</li>
48     * <li><code>Deutsch</code> for German</li>
49     * <li><code>Français</code> for French</li>
50     * </ul>
51     * 
52     * @return the language name in its own language
53     */
54    String getDescription();
55  
56    /**
57     * Returns the name of this language in the specified language, e.g given that <code>language</code> was
58     * <code>German</code>, this method would return:
59     * <ul>
60     * <li><code>Englisch</code> for English</li>
61     * <li><code>Deutsch</code> for German</li>
62     * <li><code>Französisch</code> for French</li>
63     * </ul>
64     * 
65     * @param language
66     *          the language version of this language
67     * @return the language name in the specified language
68     */
69    String getDescription(Language language);
70  
71    /**
72     * Returns the language's identifier, which corresponds to the locales name for this language.
73     * 
74     * @return the language identifier
75     */
76    String getIdentifier();
77  
78  }