Exemplo n.º 1
0
        private async Task <string> CreateTM()
        {
            languageDirectionId = Guid.NewGuid().ToString();

            var tmRequest = new CreateTmRequest
            {
                TranslationMemoryId = Guid.NewGuid().ToString(),
                Name = $"tm_integration_test_{Guid.NewGuid()}",
                LanguageDirections = new List <LanguageDirection>
                {
                    new LanguageDirection
                    {
                        LanguageDirectionId = languageDirectionId,
                        Source            = "en-us",
                        Target            = "de-de",
                        LastReIndexSize   = null,
                        LastReIndexDate   = null,
                        LastRecomputeDate = null,
                        LastRecomputeSize = null
                    }
                },
                FieldTemplateId            = fieldTemplateId,
                LanguageResourceTemplateId = lrTemplateId,
                Recognizers              = "RecognizeAll",
                FuzzyIndexes             = "SourceWordBased,TargetWordBased",
                WordCountFlags           = "DefaultFlags",
                Location                 = Helper.Organization,
                OwnerId                  = Helper.OrganizationId,
                FuzzyIndexTuningSettings = new FuzzyIndexTuningSettings
                {
                    MinScoreIncrease = 20,
                    MinSearchVectorLengthSourceCharIndex = 5,
                    MinSearchVectorLengthSourceWordIndex = 3,
                    MinSearchVectorLengthTargetCharIndex = 5,
                    MinSearchVectorLengthTargetWordIndex = 3
                },
                ContainerId = containerId
            };

            tmId = await gsClient.TranslationMemories.CreateTm(tmRequest).ConfigureAwait(false);

            Assert.True(tmId != string.Empty);

            return(tmId);
        }
        public async Task <string> CreateTm(string tmName)
        {
            var groupShareClient = await Helper.GetGroupShareClient();

            var tmRequest = new CreateTmRequest
            {
                TranslationMemoryId = Guid.NewGuid().ToString(),
                Name = tmName,
                LanguageDirections = new List <LanguageDirection>
                {
                    new LanguageDirection
                    {
                        LanguageDirectionId = Guid.NewGuid().ToString(),
                        Source            = "en-us",
                        Target            = "de-de",
                        LastReIndexSize   = null,
                        LastReIndexDate   = null,
                        LastRecomputeDate = null,
                        LastRecomputeSize = null
                    }
                },
                FieldTemplateId            = "ec6acfc3-e166-486f-9823-3220499dc95b",
                LanguageResourceTemplateId = "78df3807-06ac-438e-b2c8-5e233df1a6a2",
                Recognizers              = "RecognizeAll",
                FuzzyIndexes             = "SourceWordBased,TargetWordBased",
                Location                 = "/SDL Community Developers",
                WordCountFlags           = "DefaultFlags",
                OwnerId                  = "5bdb10b8-e3a9-41ae-9e66-c154347b8d17",
                FuzzyIndexTuningSettings = new FuzzyIndexTuningSettings
                {
                    MinScoreIncrease = 20,
                    MinSearchVectorLengthSourceCharIndex = 5,
                    MinSearchVectorLengthSourceWordIndex = 3,
                    MinSearchVectorLengthTargetCharIndex = 5,
                    MinSearchVectorLengthTargetWordIndex = 3
                },
                ContainerId = "ee2871af-a5a5-46ca-9b05-0f216744e8fe"
            };

            var tmId = await groupShareClient.TranslationMemories.CreateTm(tmRequest);

            Assert.True(tmId != string.Empty);
            return(tmId);
        }