| 1 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 2 | // Copyright (c) 2018 Saxonica Limited. |
| 3 | // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. |
| 4 | // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 5 | // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0. |
| 6 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 7 | |
| 8 | package net.sf.saxon.lib; |
| 9 | |
| 10 | import java.util.Properties; |
| 11 | |
| 12 | /** |
| 13 | * Interface allowing localization modules for different languages to be dynamically loaded |
| 14 | */ |
| 15 | public abstract class LocalizerFactory { |
| 16 | |
| 17 | |
| 18 | /** |
| 19 | * Set properties for a particular language. The properties available are specific to the |
| 20 | * LocalizerFactory in use. Default implementation does nothing. |
| 21 | * |
| 22 | * @param lang the language |
| 23 | * @param properties properties of this language |
| 24 | * @since 9.2 |
| 25 | */ |
| 26 | |
| 27 | public void setLanguageProperties(String lang, Properties properties) { |
| 28 | // no action |
| 29 | } |
| 30 | |
| 31 | |
| 32 | /** |
| 33 | * Get the numberer for a given language |
| 34 | * |
| 35 | * @param language the language code (for example "de" or "en-GB"). The value may be null, |
| 36 | * in which case a default language should be assumed. |
| 37 | * @param country the country, as used in format-date(). This is not the country associated |
| 38 | * with the language, but the one associated with the date to be formatted. It is primarily |
| 39 | * used to determine a civil time zone name. The value may be null, in which case a default |
| 40 | * country should be assumed. |
| 41 | * @return the appropriate numberer, or null if none is available (in which case the English |
| 42 | * numberer will be used) |
| 43 | */ |
| 44 | |
| 45 | public abstract Numberer getNumberer(String language, String country); |
| 46 | |
| 47 | /** |
| 48 | * Copy the state of this factory to create a new LocalizerFactory. The default implementation |
| 49 | * returns this LocalizerFactory unchanged (which should only be done if it is immutable). |
| 50 | * |
| 51 | * @return a copy of this LocalizerFactory |
| 52 | */ |
| 53 | |
| 54 | public LocalizerFactory copy() { |
| 55 | return this; |
| 56 | } |
| 57 | } |
| 58 |