/// ------------------------------------------------------------------------------------ /// <summary> /// Now that L10NSharp creates all writable Xliff/Tmx files under LocalApplicationData /// instead of the common/shared AppData folder, applications can use this method to /// purge old Xliff/Tmx files.</summary> /// <param name="appId">ID of the application used for creating the Xliff/Tmx files /// (typically the same ID passed as the 2nd parameter to LocalizationManagerInternal.Create). /// </param> /// <param name="directoryOfWritableTranslationFiles">Folder from which to delete /// Xliff/Tmx files.</param> /// <param name="directoryOfInstalledTranslationFiles">Used to limit file deletion to only /// include copies of the installed Xliff/Tmx files (plus the generated default file). If /// this is <c>null</c>, then all Xliff/Tmx files for the given appID will be deleted from /// <paramref name="directoryOfWritableTranslationFiles"/></param> /// ------------------------------------------------------------------------------------ public static void DeleteOldTranslationFiles(string appId, string directoryOfWritableTranslationFiles, string directoryOfInstalledTranslationFiles) { switch (TranslationMemoryKind) { case TranslationMemory.XLiff: XLiffLocalizationManager.DeleteOldXliffFiles(appId, directoryOfWritableTranslationFiles, directoryOfInstalledTranslationFiles); break; default: TMXLocalizationManager.DeleteOldTmxFiles(appId, directoryOfWritableTranslationFiles, directoryOfInstalledTranslationFiles); break; } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Loads the string cache from all the specified tmx files /// </summary> /// ------------------------------------------------------------------------------------ internal TMXLocalizedStringCache(TMXLocalizationManager owningManager) { OwningManager = owningManager; TmxDocument = CreateEmptyStringFile(); Documents = new Dictionary <string, TMXDocument> { { LocalizationManager.kDefaultLang, TmxDocument } }; _englishTuIdsNoLongerUsed = new HashSet <string>(); try { MergeTmxFilesIntoCache(OwningManager.FilenamesToAddToCache); } catch (Exception e) { MessageBox.Show("Error occurred reading localization file:" + Environment.NewLine + e.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning); LocalizationManager.SetUILanguage(LocalizationManager.kDefaultLang, false); } _tuUpdater = new TMXTransUnitUpdater(TmxDocument); var replacement = TmxDocument.Header.GetPropValue("x-ampersandreplacement"); if (replacement != null) { _ampersandReplacement = replacement; } replacement = TmxDocument.Header.GetPropValue(kHardLineBreakReplacementProperty); if (replacement != null) { s_literalNewline = replacement; } LeafNodeList = new List <LocTreeNode <TMXDocument> >(); IsDirty = false; }