/// <summary> /// Exports the resource strings from the Babylon.NET project /// </summary> /// <param name="projectName">Name of the project the resources will be exported from</param> /// <param name="projectLocale">The project invariant locale</param> /// <param name="resourceStrings">The strings to be exported</param> /// <param name="resultDelegate">Callback delegate to provide progress information and storage operation results</param> public void ExportResourceStrings(string projectName, string projectLocale, IReadOnlyCollection <string> localesToExport, ICollection <StringResource> resourceStrings, ResourceStorageOperationResultDelegate resultDelegate) { XliffResourceExporter xliffResourceExporter = new XliffResourceExporter(XliffFileHelpers.GetBaseDirectory(StorageLocation, SolutionPath), projectLocale, localesToExport, resourceStrings, (string xliffFileName) => { resultDelegate?.Invoke(new ResourceStorageOperationResultItem(xliffFileName) { ProjectName = projectName }); }, (XliffFileError fileError) => { resultDelegate?.Invoke(new ResourceStorageOperationResultItem(fileError.XliffFilePath) { ProjectName = projectName, Result = ResourceStorageOperationResult.Error, Message = fileError.Ex.Message }); }); xliffResourceExporter.Export(); }
/// <summary> /// Imports the resource strings to be translated into the Babylon.NET project /// </summary> /// <param name="projectName">Name of the project the resources will be imported into</param> /// <param name="projectLocale">The project invariant locale</param> /// <returns>The imported strings</returns> public ICollection <StringResource> ImportResourceStrings(string projectName, string projectLocale) { var resourceImporter = new XliffResourceImporter(projectLocale, XliffFileHelpers.GetBaseDirectory(StorageLocation, SolutionPath)); return(resourceImporter.Import()); }