Ejemplo n.º 1
0
            public MiscTranslation(ModTranslation translation)
            {
                Translation = LanguageManager.Instance.ActiveCulture == GameCulture.English ? ""
                                                                                        : Language.GetTextValue(translation.Key);

                Default = translation.GetDefault();
            }
Ejemplo n.º 2
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.º 3
0
 public static void SwapTranslation(this ModTranslation target, ModTranslation source)
 {
     //Currently the Steam API supports 29 languages
     for (int i = 1; i <= 29; i++)
     {
         string translation = source.GetTranslation(i);
         if (i == 1 || translation != source.GetDefault())
         {
             target.AddTranslation(i, translation);
         }
     }
 }
Ejemplo n.º 4
0
        public static void AddLine(this ModTranslation self, string text, int culture = 0)
        {
            string currentText;

            if (culture == 0)
            {
                currentText  = self.GetDefault();
                currentText += text + "\n";
                self.SetDefault(currentText);
            }
            else
            {
                currentText  = self.GetTranslation(culture);
                currentText += text + "\n";
                self.AddTranslation(culture, currentText);
            }
        }
Ejemplo n.º 5
0
        public static string DefaultOrEmpty(this ModTranslation modTranslation)
        {
            var d = modTranslation.GetDefault();

            return(string.IsNullOrWhiteSpace(d) || d == modTranslation.Key ? "" : d);
        }
Ejemplo n.º 6
0
 public static void AddLine(this ModTranslation modTranslation, string line)
 {
     modTranslation.SetDefault(modTranslation.GetDefault() + "\n" + line);
 }
Ejemplo n.º 7
0
 public static void AddLine(this ModTranslation self, string line)
 {
     self.SetDefault(self.GetDefault() + "\n" + line);
 }
Ejemplo n.º 8
0
 public String GetDefault()
 {
     return(translation.GetDefault());
 }