示例#1
0
 internal PrefabLocalization(StringTableManager.GungeonSupportedLanguages lang, StringTable table, FormatType format = FormatType.Gungeon)
 {
     TargetLanguageID  = GungeonLanguage.LanguageToID(lang);
     TargetStringTable = table;
     Path   = GetPrefabPath(lang, table);
     Format = format;
 }
示例#2
0
            /// <summary>
            /// Converts a <c>GungeonSupportedLanguages</c> value to a named ID.
            /// </summary>
            /// <returns>Global ID of this language.</returns>
            /// <param name="lang">Builtin enum value of this language.</param>
            public static ID LanguageToID(StringTableManager.GungeonSupportedLanguages lang)
            {
                switch (lang)
                {
                case StringTableManager.GungeonSupportedLanguages.ENGLISH: return((ID)"gungeon:english");

                case StringTableManager.GungeonSupportedLanguages.RUBEL_TEST: return((ID)"gungeon:rubel_test");

                case StringTableManager.GungeonSupportedLanguages.FRENCH: return((ID)"gungeon:french");

                case StringTableManager.GungeonSupportedLanguages.SPANISH: return((ID)"gungeon:spanish");

                case StringTableManager.GungeonSupportedLanguages.ITALIAN: return((ID)"gungeon:italian");

                case StringTableManager.GungeonSupportedLanguages.GERMAN: return((ID)"gungeon:german");

                case StringTableManager.GungeonSupportedLanguages.BRAZILIANPORTUGUESE: return((ID)"gungeon:portuguese");

                case StringTableManager.GungeonSupportedLanguages.JAPANESE: return((ID)"gungeon:japanese");

                case StringTableManager.GungeonSupportedLanguages.KOREAN: return((ID)"gungeon:korean");

                case StringTableManager.GungeonSupportedLanguages.RUSSIAN: return((ID)"gungeon:russian");

                case StringTableManager.GungeonSupportedLanguages.POLISH: return((ID)"gungeon:polish");

                case StringTableManager.GungeonSupportedLanguages.CHINESE: return((ID)"gungeon:chinese");

                default: throw new InvalidOperationException($"Cannot use GungeonLanguage on custom languages");
                }
            }
示例#3
0
            internal static string GetPrefabMainName(StringTableManager.GungeonSupportedLanguages lang)
            {
                string dir_lang = null;

                switch (lang)
                {
                case StringTableManager.GungeonSupportedLanguages.ENGLISH: dir_lang = "english"; break;

                case StringTableManager.GungeonSupportedLanguages.RUBEL_TEST: dir_lang = "english"; break;

                case StringTableManager.GungeonSupportedLanguages.FRENCH: dir_lang = "french"; break;

                case StringTableManager.GungeonSupportedLanguages.SPANISH: dir_lang = "spanish"; break;

                case StringTableManager.GungeonSupportedLanguages.ITALIAN: dir_lang = "italian"; break;

                case StringTableManager.GungeonSupportedLanguages.GERMAN: dir_lang = "german"; break;

                case StringTableManager.GungeonSupportedLanguages.BRAZILIANPORTUGUESE: dir_lang = "portuguese"; break;

                case StringTableManager.GungeonSupportedLanguages.JAPANESE: dir_lang = "japanese"; break;

                case StringTableManager.GungeonSupportedLanguages.KOREAN: dir_lang = "korean"; break;

                case StringTableManager.GungeonSupportedLanguages.RUSSIAN: dir_lang = "russian"; break;

                case StringTableManager.GungeonSupportedLanguages.POLISH: dir_lang = "polish"; break;

                case StringTableManager.GungeonSupportedLanguages.CHINESE: dir_lang = "chinese"; break;

                default: throw new InvalidOperationException($"Cannot use GungeonLanguage on custom languages");
                }

                return(dir_lang);
            }
示例#4
0
 private static void DoTranslation(StringTableManager.GungeonSupportedLanguages lang)
 {
     UIStrings.LanguageChanged();
     SynergyStrings.LanguageChanged();
     foreach (Translation translation in translations)
     {
         translation.UpdateLanguage(lang);
     }
 }
        // Token: 0x060000ED RID: 237 RVA: 0x00009830 File Offset: 0x00007A30
        public void LanguageChanged(StringTableManager.GungeonSupportedLanguages newLang)
        {
            this.Core.LanguageChanged();
            this.Items.LanguageChanged();
            this.Enemies.LanguageChanged();
            this.Intro.LanguageChanged();
            this.Synergies.LanguageChanged();
            Action <StringTableManager.GungeonSupportedLanguages> onLanguageChanged = this.OnLanguageChanged;
            bool flag = onLanguageChanged == null;

            if (!flag)
            {
                onLanguageChanged(newLang);
            }
        }
示例#6
0
        /// <summary>
        /// Adds a new translation for an individual string.
        /// </summary>
        /// <param name="language">The language to which the translation will be applied.</param>
        /// <param name="key">The string's key</param>
        /// <param name="value">The string</param>
        /// <param name="tableType">Type of the table in which <paramref name="value"/> is in.</param>
        public static void AddTranslation(StringTableManager.GungeonSupportedLanguages language, string key, string value, StringTableType tableType)
        {
            if (translations == null)
            {
                Init();
            }
            if (language == StringTableManager.GungeonSupportedLanguages.ENGLISH)
            {
                switch (tableType)
                {
                case StringTableType.Core:
                    ETGMod.Databases.Strings.Core.Set(key, value);
                    break;

                case StringTableType.Items:
                    ETGMod.Databases.Strings.Items.Set(key, value);
                    break;

                case StringTableType.Enemies:
                    ETGMod.Databases.Strings.Enemies.Set(key, value);
                    break;

                case StringTableType.UI:
                    UIStrings.Set(key, value);
                    break;

                case StringTableType.Intro:
                    ETGMod.Databases.Strings.Intro.Set(key, value);
                    break;

                case StringTableType.Synergy:
                    SynergyStrings.Set(key, value);
                    break;
                }
                return;
            }
            foreach (Translation translation in translations)
            {
                if (translation.language == language && translation.type == tableType)
                {
                    translation.AddStringTranslation(key, value);
                }
            }
        }
示例#7
0
            internal static string GetPrefabPath(StringTableManager.GungeonSupportedLanguages lang, StringTable table)
            {
                var main_name = GetPrefabMainName(lang);

                switch (table)
                {
                case StringTable.Core: return(main_name);

                case StringTable.Enemies: return($"{main_name}_items/enemies");

                case StringTable.Intro: return($"{main_name}_items/intro");

                case StringTable.Items: return($"{main_name}_items/items");

                case StringTable.Synergies: return($"{main_name}_items/synergies");

                case StringTable.UI: return($"{main_name}_items/ui");

                default: throw new InvalidOperationException($"Unknown string table");
                }
            }
        public static void orig_SetNewLanguage(StringTableManager.GungeonSupportedLanguages language, bool force = false)
        {
            if (!force && StringTableManager.CurrentLanguage == language)
            {
                return;
            }
            if (m_currentFile == null)
            {
                goto IL_176;
            }

            IL_176 :;
            switch (language)
            {
            case StringTableManager.GungeonSupportedLanguages.ENGLISH :
                m_currentFile         = "english";
                m_currentSubDirectory = "english_items";
                goto IL_179;

            case StringTableManager.GungeonSupportedLanguages.FRENCH:
                m_currentFile         = "french";
                m_currentSubDirectory = "french_items";
                goto IL_179;

            case StringTableManager.GungeonSupportedLanguages.SPANISH:
                m_currentFile         = "spanish";
                m_currentSubDirectory = "spanish_items";
                goto IL_179;

            case StringTableManager.GungeonSupportedLanguages.ITALIAN:
                m_currentFile         = "italian";
                m_currentSubDirectory = "italian_items";
                goto IL_179;

            case StringTableManager.GungeonSupportedLanguages.GERMAN:
                m_currentFile         = "german";
                m_currentSubDirectory = "german_items";
                goto IL_179;

            case StringTableManager.GungeonSupportedLanguages.BRAZILIANPORTUGUESE:
                m_currentFile         = "portuguese";
                m_currentSubDirectory = "portuguese_items";
                goto IL_179;

            case StringTableManager.GungeonSupportedLanguages.JAPANESE:
                m_currentFile         = "japanese";
                m_currentSubDirectory = "japanese_items";
                goto IL_179;

            case StringTableManager.GungeonSupportedLanguages.KOREAN:
                m_currentFile         = "korean";
                m_currentSubDirectory = "korean_items";
                goto IL_179;

            case StringTableManager.GungeonSupportedLanguages.RUSSIAN:
                m_currentFile         = "russian";
                m_currentSubDirectory = "russian_items";
                goto IL_179;

            case StringTableManager.GungeonSupportedLanguages.POLISH:
                m_currentFile         = "polish";
                m_currentSubDirectory = "polish_items";
                goto IL_179;

            case StringTableManager.GungeonSupportedLanguages.CHINESE:
                m_currentFile         = "chinese";
                m_currentSubDirectory = "chinese_items";
                goto IL_179;
            }
            m_currentFile         = "english";
            m_currentSubDirectory = "english_items";
IL_179:
            StringTableManager.ReloadAllTables();
            dfLanguageManager.ChangeGungeonLanguage();
            JournalEntry.ReloadDataSemaphore++;
        }
示例#9
0
        internal static void ChangeLanguage(StringTableManager.GungeonSupportedLanguages lang)
        {
            var id = Registry.Languages.ValidateExisting(GungeonLanguage.LanguageToID(lang));

            ChangeLanguage(id);
        }
 public static void SetNewLanguage(StringTableManager.GungeonSupportedLanguages language, bool force = false)
 {
     orig_SetNewLanguage(language, force);
     ETGMod.Databases.Strings.LanguageChanged();
 }
示例#11
0
 /// <summary>
 /// Adds a new translation for <paramref name="item"/>'s long description.
 /// </summary>
 /// <param name="item">The <see cref="PickupObject"/> to add the translation to.</param>
 /// <param name="language">The language to which the translation will be applied.</param>
 /// <param name="translation">The translated text.</param>
 public static void TranslateItemLongDescription(this PickupObject item, StringTableManager.GungeonSupportedLanguages language, string translation)
 {
     item.encounterTrackable?.TranslateLongDescription(language, translation);
 }
示例#12
0
 internal GungeonLanguage(StringTableManager.GungeonSupportedLanguages lang)
 {
     MappedLanguage = (Patches.GungeonSupportedLanguages)lang;
     ID             = LanguageToID(lang);
 }
示例#13
0
 /// <summary>
 /// Adds a new translation for <paramref name="enemy"/>'s long description.
 /// </summary>
 /// <param name="enemy">The <see cref="AIActor"/> to add the translation to.</param>
 /// <param name="language">The language to which the translation will be applied.</param>
 /// <param name="translation">The translated text.</param>
 public static void TranslateEnemyLongDescription(this AIActor enemy, StringTableManager.GungeonSupportedLanguages language, string translation)
 {
     enemy.encounterTrackable?.TranslateLongDescription(language, translation);
 }
示例#14
0
 /// <summary>
 /// Adds a new translation for <paramref name="track"/>'s name.
 /// </summary>
 /// <param name="track">The <see cref="EncounterTrackable"/> to add the translation to.</param>
 /// <param name="language">The language to which the translation will be applied.</param>
 /// <param name="translation">The translated text.</param>
 public static void TranslateName(this EncounterTrackable track, StringTableManager.GungeonSupportedLanguages language, string translation)
 {
     AddTranslation(language, track.journalData.PrimaryDisplayName, translation, StringTableType.Items);
 }
示例#15
0
 /// <summary>
 /// Adds a new translation for <paramref name="track"/>'s short description.
 /// </summary>
 /// <param name="track">The <see cref="EncounterTrackable"/> to add the translation to.</param>
 /// <param name="language">The language to which the translation will be applied.</param>
 /// <param name="translation">The translated text.</param>
 public static void TranslateShortDescription(this EncounterTrackable track, StringTableManager.GungeonSupportedLanguages language, string translation)
 {
     AddTranslation(language, track.journalData.NotificationPanelDescription, translation, StringTableType.Items);
 }
 public static extern void orig_SetNewLanguage(StringTableManager.GungeonSupportedLanguages language, bool force = false);
示例#17
0
 /// <summary>
 /// Adds a new translation for <paramref name="track"/>'s long description.
 /// </summary>
 /// <param name="track">The <see cref="EncounterTrackable"/> to add the translation to.</param>
 /// <param name="language">The language to which the translation will be applied.</param>
 /// <param name="translation">The translated text.</param>
 public static void TranslateLongDescription(this EncounterTrackable track, StringTableManager.GungeonSupportedLanguages language, string translation)
 {
     AddTranslation(language, track.journalData.AmmonomiconFullEntry, translation, StringTableType.Items);
 }