/// <summary> /// Load tokens for specified section. /// </summary> /// <param name="section">Section ID.</param> /// <param name="showWarning">If set to <c>true</c> show warning about already loaded section.</param> public static void LoadSection(R.sections.SectionID section, bool showWarning) { if (tokens[(int)section + 1] == null) { tokens[(int)section + 1] = new SectionTokens(); string xmlFile = R.sections.xmlFiles[(int)section]; Dictionary <string, int>[] tokenIds = R.tokenIds[(int)section + 1]; int stringCount = tokenIds[0].Count; int stringArrayCount = tokenIds[1].Count; int pluralsCount = tokenIds[2].Count; tokens[(int)section + 1].defaultLanguage = ParseXmlTokens(xmlFile, "", tokenIds, stringCount, stringArrayCount, pluralsCount); if (sLanguage != Language.Default) { string locale = AvailableLanguages.list[sLanguage]; tokens[(int)section + 1].selectedLanguage = ParseXmlTokens(xmlFile, locale, tokenIds, stringCount, stringArrayCount, pluralsCount); tokens[(int)section + 1].Optimize(); } sLoadedSections[section] = tokens[(int)section + 1]; } else { if (showWarning) { Debug.LogWarning("Section \"" + section + "\" already loaded"); } } }
/// <summary> /// Unload tokens for specified section. /// </summary> /// <param name="section">Section ID.</param> public static void UnloadSection(R.sections.SectionID section) { if (tokens[(int)section + 1] != null) { tokens[(int)section + 1] = null; if (!sLoadedSections.Remove(section)) { Debug.LogError("Failed to remove section \"" + section.ToString() + "\""); } } else { Debug.LogWarning("Section \"" + section + "\" already unloaded"); } }
/// <summary> /// Determines if specified section is loaded. /// </summary> /// <returns><c>true</c> if section is loaded; otherwise, <c>false</c>.</returns> /// <param name="section">Section ID.</param> public static bool IsSectionLoaded(R.sections.SectionID section) { return(UnityTranslationInternal.Translator.IsSectionLoaded(section)); }
/// <summary> /// Unload tokens for specified section. /// </summary> /// <param name="section">Section ID.</param> public static void UnloadSection(R.sections.SectionID section) { UnityTranslationInternal.Translator.UnloadSection(section); }
/// <summary> /// Load tokens for specified section. /// </summary> /// <param name="section">Section ID.</param> public static void LoadSection(R.sections.SectionID section) { UnityTranslationInternal.Translator.LoadSection(section, true); }
/// <summary> /// Determines if specified section is loaded. /// </summary> /// <returns><c>true</c> if section is loaded; otherwise, <c>false</c>.</returns> /// <param name="section">Section ID.</param> public static bool IsSectionLoaded(R.sections.SectionID section) { return(tokens[(int)section + 1] != null); }