Ejemplo n.º 1
0
        public ImportResult[] AddOrUpdateTranslationUnits(TranslationUnit[] translationUnits, int[] previousTranslationHashes, ImportSettings settings)
        {
            var results = _fileBasedTranslationProviderLanguageDirection.AddOrUpdateTranslationUnits(translationUnits,
                                                                                                     previousTranslationHashes, settings);
            var tmDataAccess = TmDataAccess.OpenConnection(TranslationProvider.Uri);

            for (int i = 0; i < results.Length; i++)
            {
                var result = results[i];
                if (result == null)
                {
                    continue;
                }
                var translationUnit = translationUnits[i];

                if (result.Action == Action.Add || result.Action == Action.Merge || result.Action == Action.Overwrite)
                {
                    var customFieldsValue = new CustomFieldValues
                    {
                        FileNameFullPath = translationUnit.GetFilePath(),
                        ProjectName      = translationUnit.GetProjectName()
                    };
                    tmDataAccess.AddOrUpdateCustomFields(result.TuId.Id, customFieldsValue);
                }
            }

            return(results);
        }
Ejemplo n.º 2
0
        public ImportResult[] AddOrUpdateTranslationUnits(TranslationUnit[] translationUnits, int[] previousTranslationHashes, ImportSettings settings)
        {
            var results = _fileBasedTranslationProviderLanguageDirection.AddOrUpdateTranslationUnits(
                translationUnits,
                previousTranslationHashes,
                settings);

            ProcessTranslationUnits(translationUnits, results);

            return(results);
        }
        public ImportResult[] AddOrUpdateTranslationUnits(TranslationUnit[] translationUnits, int[] previousTranslationHashes, ImportSettings settings)
        {
            var results = _fileBasedTranslationProviderLanguageDirection.AddOrUpdateTranslationUnits(translationUnits,
                                                                                                     previousTranslationHashes, settings);
            var tmDataAccess = TmDataAccess.OpenConnection(TranslationProvider.Uri);

            for (int i = 0; i < results.Length; i++)
            {
                var result = results[i];
                if (result == null)
                {
                    continue;
                }
                var translationUnit = translationUnits[i];

                if (result.Action == Action.Add || result.Action == Action.Merge || result.Action == Action.Overwrite)
                {
                    tmDataAccess.AddOrUpdateSourceFile(result.TuId.Id, translationUnit.DocumentProperties.LastOpenedAsPath);
                }
            }

            return(results);
        }