001/*
002 * Copyright 2017-2022 Product Mog LLC, 2022-2026 Revetware LLC.
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 */
016
017package com.lokalized;
018
019/**
020 * Reasons a localized string lookup can fail.
021 *
022 * @author <a href="https://revetkn.com">Mark Allen</a>
023 * @since 3.0.0
024 */
025public enum TranslationFailureReason {
026        /**
027         * No attempted candidate locale contained the requested key.
028         */
029        MISSING_TRANSLATION,
030        /**
031         * An attempted candidate locale contained the requested key, but no whole-message alternative matched and no default
032         * translation was provided.
033         * <p>
034         * A {@link LocalizedString.ExpressionTranslation} generated fragment cannot produce this reason: it always has a
035         * required default translation when none of its ordered alternatives matches.
036         */
037        NO_MATCHING_ALTERNATIVE,
038        /**
039         * A candidate translation existed, but placeholder, expression, interpolation, or language-form resolution failed.
040         * <p>
041         * This includes a failure while evaluating a reachable
042         * {@link LocalizedString.ExpressionAlternative expression-fragment predicate} or interpolating its selected/default
043         * fragment. A selected fragment's failure does not fall through to a later predicate or its default.
044         */
045        RESOLUTION_FAILURE
046}