private static bool TryGetFormatErrors(
            string key,
            ResourceManagerExt.CulturesAndKeys culturesAndKeys,
            IEnumerable <CultureInfo> cultures,
            out FormatError formatErrors)
        {
            int?count        = null;
            var translations = culturesAndKeys.GetTranslationsFor(key, cultures);

            foreach (var translation in translations)
            {
                if (!FormatString.IsValidFormat(translation.Value, out var indexCount, out _))
                {
                    formatErrors = new FormatError(key, translations);
                    return(true);
                }

                if (count == null)
                {
                    count = indexCount;
                    continue;
                }

                if (count != indexCount)
                {
                    formatErrors = new FormatError(key, translations);
                    return(true);
                }
            }

            formatErrors = null;
            return(false);
        }
        private static bool TryGetMissingTranslations(
            string key,
            ResourceManagerExt.CulturesAndKeys culturesAndKeys,
            IEnumerable <CultureInfo> cultures,
            out MissingTranslation missingTranslations)
        {
            List <CultureInfo> missing = null;

            foreach (var culture in cultures)
            {
                if (!culturesAndKeys.HasKey(culture, key))
                {
                    if (missing == null)
                    {
                        missing = new List <CultureInfo>();
                    }

                    missing.Add(culture);
                }
            }

            if (missing == null)
            {
                missingTranslations = null;
                return(false);
            }

            missingTranslations = new MissingTranslation(key, missing);
            return(true);
        }
        private static bool TryGetTranslationErrors(ResourceManagerExt.CulturesAndKeys culturesAndKeys, IEnumerable <CultureInfo> cultures, string key, out IReadOnlyList <TranslationError> errors)
        {
            List <TranslationError> foundErrors = null;

            if (TryGetFormatErrors(key, culturesAndKeys, cultures, out var formatErrors))
            {
                foundErrors = new List <TranslationError>(1)
                {
                    formatErrors
                };
            }

            if (TryGetMissingTranslations(key, culturesAndKeys, cultures, out var missingTranslation))
            {
                if (foundErrors == null)
                {
                    foundErrors = new List <TranslationError>(1)
                    {
                        missingTranslation
                    };
                }
                else
                {
                    foundErrors.Add(missingTranslation);
                }
            }

            errors = foundErrors;
            return(errors != null);
        }