Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #8

Merged
merged 7 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Apps.Crowdin/Actions/TaskActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using Blackbird.Applications.Sdk.Utils.Utilities;
using Crowdin.Api.Tasks;
using TaskStatus = Crowdin.Api.Tasks.TaskStatus;
using System.IO;

namespace Apps.Crowdin.Actions;

Expand Down Expand Up @@ -127,8 +128,8 @@ [ActionParameter] [Display("Task ID")] string taskId)
if (downloadLink is null)
throw new("No string found for this task");

var fileContent = await FileDownloader.DownloadFileBytes(downloadLink.Url, _fileManagementClient);

return new(fileContent);
var fileContent = await FileDownloader.DownloadFileBytes(downloadLink.Url);
var file = await _fileManagementClient.UploadAsync(fileContent.FileStream, fileContent.ContentType, fileContent.Name);
return new(file);
}
}
3 changes: 1 addition & 2 deletions Apps.Crowdin/Actions/TranslationActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ public async Task<PreTranslationEntity> PreTranslate(
EngineId = intEngineId,
DuplicateTranslations = input.DuplicateTranslations,
TranslateUntranslatedOnly = input.TranslateUntranslatedOnly,
TranslateWithPerfectMatchOnly = input.TranslateWithPerfectMatchOnly,
MarkAddedTranslationsAsDone = input.MarkAddedTranslationsAsDone
TranslateWithPerfectMatchOnly = input.TranslateWithPerfectMatchOnly
};
var response = await client.Translations
.ApplyPreTranslation(intProjectId!.Value, request);
Expand Down
6 changes: 4 additions & 2 deletions Apps.Crowdin/Actions/TranslationMemoryActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Blackbird.Applications.Sdk.Utils.Parsers;
using Blackbird.Applications.Sdk.Utils.Utilities;
using Crowdin.Api.TranslationMemory;
using System.IO;

namespace Apps.Crowdin.Actions;

Expand Down Expand Up @@ -114,8 +115,9 @@ public async Task<DownloadFileResponse> DownloadTranslationMemory(
var client = new CrowdinClient(Creds);

var response = await client.TranslationMemory.DownloadTm(intTmId!.Value, input.ExportId);
var fileContent = await FileDownloader.DownloadFileBytes(response.Url, _fileManagementClient);
return new(fileContent);
var fileContent = await FileDownloader.DownloadFileBytes(response.Url);
var file = await _fileManagementClient.UploadAsync(fileContent.FileStream, fileContent.ContentType, fileContent.Name);
return new(file);
}

[Action("Add translation memory segment", Description = "Add new segment to the translation memory")]
Expand Down
6 changes: 3 additions & 3 deletions Apps.Crowdin/Apps.Crowdin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<Nullable>enable</Nullable>
<Product>Crowdin</Product>
<Description>Cloud-based solution that streamlines localization management</Description>
<Version>1.0.3</Version>
<Version>1.0.4</Version>
<AssemblyName>Apps.Crowdin</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Blackbird.Applications.Sdk.Common" Version="2.6.0" />
<PackageReference Include="Blackbird.Applications.SDK.Extensions.FileManagement" Version="1.0.1" />
<PackageReference Include="Blackbird.Applications.Sdk.Utils" Version="1.0.16" />
<PackageReference Include="Crowdin.Api" Version="2.17.1" />
<PackageReference Include="Blackbird.Applications.Sdk.Utils" Version="1.0.25" />
<PackageReference Include="Crowdin.Api" Version="2.22.1" />
<PackageReference Include="MimeTypes" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,4 @@ public class PreTranslateRequest
[Display("Translate with perfect match only")]
public bool? TranslateWithPerfectMatchOnly { get; set; }

[Display("Mark added translations as done")]
public bool? MarkAddedTranslationsAsDone { get; set; }
}