Ejemplo n.º 1
0
        public static void Import(this ModTranslation modTranslation, BaseEntry entry, CultureInfo culture)
        {
            if (entry != null)
            {
                if (entry.Origin != modTranslation.GetDefault() &&
                    modTranslation.GetDefault() != modTranslation.Key &&
                    !string.IsNullOrWhiteSpace(modTranslation.GetDefault()) &&
                    !string.IsNullOrWhiteSpace(entry.Origin))
                {
                    Utils.LogWarn(
                        $"Mismatch origin text when importing \"{modTranslation.Key}\", Origin in mod: {modTranslation.GetDefault()}, Origin in package: {entry.Origin}");
                }

                if (modTranslation.GetDefault() != null && entry.Translation != null &&
                    entry.Translation != modTranslation.Key)
                {
                    modTranslation.AddTranslation(Localizer.CultureInfoToGameCulture(culture), entry.Translation);
                }
            }
        }
Ejemplo n.º 2
0
        public static string GetTranslation(this ModTranslation modTranslation, CultureInfo culture)
        {
            var translation = modTranslation.GetTranslation(Localizer.CultureInfoToGameCulture(culture));

            return(string.IsNullOrWhiteSpace(translation) ? "" : translation);
        }