001/*
002 * ============================================================================
003 * Copyright © 2002-2021 by Thomas Thrien.
004 * All Rights Reserved.
005 * ============================================================================
006 * Licensed to the public under the agreements of the GNU Lesser General Public
007 * License, version 3.0 (the "License"). You may obtain a copy of the License at
008 *
009 *      http://www.gnu.org/licenses/lgpl.html
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
013 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
014 * License for the specific language governing permissions and limitations
015 * under the License.
016 */
017
018package org.tquadrat.foundation.i18n.ap;
019
020import static org.apiguardian.api.API.Status.INTERNAL;
021
022import java.util.Locale;
023
024import org.apiguardian.api.API;
025import org.tquadrat.foundation.annotation.ClassVersion;
026
027/**
028 *  Entries for resource bundle properties files.
029 *
030 *  @extauthor Thomas Thrien - thomas.thrien@tquadrat.org
031 *  @version $Id: TextEntry.java 1130 2024-05-05 16:16:09Z tquadrat $
032 *  @since 0.1.0
033 *
034 *  @param  key The resource bundle key for the text or message.
035 *  @param  isMessage   {@code true} if the entry is for a message,
036 *      {@code false} if not.
037 *  @param  locale  The locale for this translation of a text or a message.
038 *  @param  description The description for the text or message.
039 *  @param  text    The text or message itself for the given locale;
040 *      newlines will be replaced by the respective escape sequence
041 *      ("{@code \n}").
042 *  @param  className   The fully qualified name of the class that defines
043 *      the text or message.
044 *
045 *  @UMLGraph.link
046 */
047@ClassVersion( sourceVersion = "$Id: TextEntry.java 1130 2024-05-05 16:16:09Z tquadrat $" )
048@API( status = INTERNAL, since = "0.1.0" )
049public record TextEntry( String key, boolean isMessage, Locale locale, String description, String text, String className )
050{
051    /**
052     *  Creates a new instance of {@code TexEntry}.
053     *
054     *  @param  key The resource bundle key for the text or message.
055     *  @param  isMessage   {@code true} if the entry is for a message,
056     *      {@code false} if not.
057     *  @param  locale  The locale for this translation of a text or a message.
058     *  @param  description The description for the text or message.
059     *  @param  text    The text or message itself for the given locale;
060     *      newlines will be replaced by the respective escape sequence
061     *      ("{@code \n}").
062     *  @param  className   The fully qualified name of the class that defines
063     *      the text or message.
064     */
065    @SuppressWarnings( "ConstructorWithTooManyParameters" )
066    public TextEntry
067    {
068        text = text.replace( "\n", "\\n" );
069    }   //  TextEntry
070}
071//  record TextEntry
072
073/*
074 *  End of File
075 */