| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ILanguageManager |
|
| 1.0;1 |
| 1 | package org.jtheque.core.managers.language; | |
| 2 | ||
| 3 | import java.util.Collection; | |
| 4 | import java.util.Locale; | |
| 5 | ||
| 6 | /* | |
| 7 | * This file is part of JTheque. | |
| 8 | * | |
| 9 | * JTheque is free software: you can redistribute it and/or modify | |
| 10 | * it under the terms of the GNU General Public License as published by | |
| 11 | * the Free Software Foundation, either version 3 of the License. | |
| 12 | * | |
| 13 | * JTheque is distributed in the hope that it will be useful, | |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | * GNU General Public License for more details. | |
| 17 | * | |
| 18 | * You should have received a copy of the GNU General Public License | |
| 19 | * along with JTheque. If not, see <http://www.gnu.org/licenses/>. | |
| 20 | */ | |
| 21 | ||
| 22 | /** | |
| 23 | * @author Baptiste Wicht | |
| 24 | */ | |
| 25 | public interface ILanguageManager { | |
| 26 | /** | |
| 27 | * Add an internationalization base name. | |
| 28 | * | |
| 29 | * @param baseName The base name to add. | |
| 30 | */ | |
| 31 | void addBaseName(String baseName); | |
| 32 | ||
| 33 | /** | |
| 34 | * Remove a base name. | |
| 35 | * | |
| 36 | * @param baseName The base name to remove. | |
| 37 | */ | |
| 38 | void removeBaseName(String baseName); | |
| 39 | ||
| 40 | /** | |
| 41 | * Set the current language. | |
| 42 | * | |
| 43 | * @param language The language. | |
| 44 | */ | |
| 45 | void setCurrentLanguage(String language); | |
| 46 | ||
| 47 | /** | |
| 48 | * Return the current locale. | |
| 49 | * | |
| 50 | * @return The current locale. | |
| 51 | */ | |
| 52 | Locale getCurrentLocale(); | |
| 53 | ||
| 54 | /** | |
| 55 | * Return the current language. | |
| 56 | * | |
| 57 | * @return The current language. | |
| 58 | */ | |
| 59 | String getCurrentLanguage(); | |
| 60 | ||
| 61 | /** | |
| 62 | * Return the message of the key. If there is no message with this key, the method return the key and | |
| 63 | * log the message to the log system. | |
| 64 | * | |
| 65 | * @param key The message key. | |
| 66 | * @return The message of the key of the current locale, empty string if the key is <code>null</code> else | |
| 67 | * the key if there is no message for this key. | |
| 68 | */ | |
| 69 | String getMessage(String key); | |
| 70 | ||
| 71 | /** | |
| 72 | * Return the message of the key and effect the replaces. | |
| 73 | * | |
| 74 | * @param key The message key. | |
| 75 | * @param replaces The replacements. | |
| 76 | * @return The message of the current locale with the replacements. | |
| 77 | */ | |
| 78 | String getMessage(String key, Object... replaces); | |
| 79 | ||
| 80 | /** | |
| 81 | * Return all the lines of a message. The end line character used is \n. | |
| 82 | * | |
| 83 | * @param key The key of the message. | |
| 84 | * @return An array containing all the lines of the internationalized message. | |
| 85 | */ | |
| 86 | String[] getLinesMessage(String key); | |
| 87 | ||
| 88 | /** | |
| 89 | * Return all the supported languages. | |
| 90 | * | |
| 91 | * @return A List containing all the supported languages. | |
| 92 | */ | |
| 93 | Collection<String> getPossibleLanguages(); | |
| 94 | ||
| 95 | /** | |
| 96 | * Add an internationalizable element. | |
| 97 | * | |
| 98 | * @param internationalizable The internationalizable to add. | |
| 99 | */ | |
| 100 | void addInternationalizable(Internationalizable internationalizable); | |
| 101 | } |