001// Licensed under the Apache License, Version 2.0 (the "License");
002// you may not use this file except in compliance with the License.
003// You may obtain a copy of the License at
004//
005// http://www.apache.org/licenses/LICENSE-2.0
006//
007// Unless required by applicable law or agreed to in writing, software
008// distributed under the License is distributed on an "AS IS" BASIS,
009// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
010// See the License for the specific language governing permissions and
011// limitations under the License.
012
013package org.apache.tapestry5.services;
014
015import org.apache.tapestry5.Translator;
016import org.apache.tapestry5.ioc.annotations.UsesMappedConfiguration;
017
018import java.util.Map;
019
020/**
021 * This service is used by {@link TranslatorSource} to specify {@link Translator} <em>alternates</em>: translators that
022 * are used when specified explicitly by name. These translators may overlap the standard translators
023 * by type (thus requiring a separate configuration).
024 *
025 * Translators contributed to this configuration must have names that do not overlap the standard translators. Further,
026 * the contribution key must match the {@linkplain Translator#getName() translator name}.
027 * 
028 * @since 5.2.0
029 */
030@UsesMappedConfiguration(Translator.class)
031public interface TranslatorAlternatesSource
032{
033    /**
034     * Get the mapping from name to Translator, based on the contributions to the service. It will be verified
035     * that the keys of the map corresponding to the names of the Translator values.
036     */
037    Map<String, Translator> getTranslatorAlternates();
038}