001/*
002 *  Copyright 2018 Anyware Services
003 *
004 *  Licensed under the Apache License, Version 2.0 (the "License");
005 *  you may not use this file except in compliance with the License.
006 *  You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 *  Unless required by applicable law or agreed to in writing, software
011 *  distributed under the License is distributed on an "AS IS" BASIS,
012 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *  See the License for the specific language governing permissions and
014 *  limitations under the License.
015 */
016package org.ametys.plugins.contenttypeseditor.edition;
017
018import java.util.Map;
019
020/**
021 * Object representation of a message with all traduction in differents
022 * languages , and its key
023 */
024public class TranslatedValue
025{
026    private String _key;
027
028    private Map<String, String> _translations;
029
030    /**
031     * Construct a TranslatedValue
032     * 
033     * @param key The message key
034     * @param translations Translations of massage
035     */
036    public TranslatedValue(String key, Map<String, String> translations)
037    {
038        this._key = key;
039        this._translations = translations;
040    }
041
042    /**
043     * Get the key of a message
044     * 
045     * @return The key of a message
046     */
047    public String getKey()
048    {
049        return _key;
050    }
051
052    /**
053     * Get translations of message according to the language
054     * 
055     * @return Get translations of message
056     */
057    public Map<String, String> getTranslations()
058    {
059        return _translations;
060    }
061
062    /**
063     * Add translation
064     * 
065     * @param language The language a message
066     * @param value The message
067     */
068    public void addTranlation(String language, String value)
069    {
070        this._translations.put(language, value);
071    }
072
073}