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 #11

Merged
merged 5 commits into from
Feb 5, 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
17 changes: 15 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,26 @@ name: Invoker
on:
pull_request:
types: [closed]
push:
branches:
- develop

jobs:
trigger-workflow:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main'
steps:
- name: Invoke workflow
- name: Invoke Dev Workflow
if: github.event_name == 'push' && github.ref == 'refs/heads/develop'
uses: benc-uk/workflow-dispatch@v1
with:
workflow: ${{ vars.GH_BUILD_WORKFLOW }}
repo: ${{ vars.GH_BUILD_REPOSITORY }}
token: ${{ secrets.GH_PAT_TOKEN }}
ref: develop
inputs: '{"repository_url": "${{ github.repository }}","ref":"${{ github.ref }}", "sha":"${{ github.sha }}", "commit_url" : "${{ github.event.head_commit.url }}", "commit_message" : "${{ github.event.head_commit.message }}"}'

- name: Invoke Prod Workflow
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main'
uses: benc-uk/workflow-dispatch@v1
with:
workflow: ${{ vars.GH_BUILD_WORKFLOW }}
Expand Down
485 changes: 485 additions & 0 deletions Apps.Memoq/Actions/TermBaseActions.cs

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions Apps.Memoq/Apps.MemoQ.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
<Nullable>enable</Nullable>
<Product>memoQ</Product>
<Description>Computer-assisted translation</Description>
<Version>1.0.7</Version>
<Version>1.1.0</Version>
<AssemblyName>Apps.MemoQ</AssemblyName>
<LangVersion>11</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Blackbird.Applications.Sdk.Common" Version="2.3.2-alpha1" />
<PackageReference Include="Blackbird.Applications.Sdk.Common" Version="2.3.3-alpha1" />
<PackageReference Include="Blackbird.Applications.SDK.Extensions.FileManagement" Version="1.0.1" />
<PackageReference Include="Blackbird.Applications.Sdk.Utils" Version="1.0.12" />
<PackageReference Include="Blackbird.Applications.Sdk.Glossaries.Utils" Version="1.0.0-alpha11" />
<PackageReference Include="Blackbird.Applications.Sdk.Utils" Version="1.0.21" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.2.0" />
<PackageReference Include="Microsoft.Azure.Storage.Blob" Version="11.2.3" />
<PackageReference Include="Microsoft.Extensions.ApiDescription.Client" Version="7.0.13">
Expand Down
34 changes: 34 additions & 0 deletions Apps.Memoq/DataSourceHandlers/TermbaseDataHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using Apps.Memoq.Contracts;
using Apps.Memoq.Models;
using Blackbird.Applications.Sdk.Common;
using Blackbird.Applications.Sdk.Common.Authentication;
using Blackbird.Applications.Sdk.Common.Dynamic;
using Blackbird.Applications.Sdk.Common.Invocation;
using MQS.TB;

namespace Apps.Memoq.DataSourceHandlers;

public class TermbaseDataHandler : BaseInvocable, IAsyncDataSourceHandler
{
private IEnumerable<AuthenticationCredentialsProvider> Creds =>
InvocationContext.AuthenticationCredentialsProviders;

public TermbaseDataHandler(InvocationContext invocationContext) : base(invocationContext)
{
}

public async Task<Dictionary<string, string>> GetDataAsync(DataSourceContext context,
CancellationToken cancellationToken)
{
using var tbService = new MemoqServiceFactory<ITBService>(SoapConstants.TermBasesServiceUrl, Creds);
var termbases = await tbService.Service.ListTBs2Async(null);

return termbases
.Where(termbase => context.SearchString is null ||
termbase.Name.Contains(context.SearchString, StringComparison.OrdinalIgnoreCase))
.OrderByDescending(termbase => termbase.LastModified)
.Take(20)
.ToDictionary(termbase => termbase.Guid.ToString(),
termbase => termbase.IsQTerm ? $"{termbase.Name} (QTerm)" : termbase.Name);
}
}
2 changes: 2 additions & 0 deletions Apps.Memoq/Models/SoapConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public static class SoapConstants
public const string TaskServiceUrl = "/tasks/tasksService";

public const string TranslationMemoryServiceUrl = "/tm/tmservice";

public const string TermBasesServiceUrl = "/tb/tbservice";

public static readonly Guid AdminGuid = new("00000000-0000-0000-0001-000000000001");
}
8 changes: 8 additions & 0 deletions Apps.Memoq/Models/Termbases/GlossaryWrapper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Blackbird.Applications.Sdk.Common.Files;

namespace Apps.Memoq.Models.Termbases;

public class GlossaryWrapper
{
public FileReference Glossary { get; set; }
}
29 changes: 29 additions & 0 deletions Apps.Memoq/Models/Termbases/Requests/CreateTermbaseRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Blackbird.Applications.Sdk.Common;

namespace Apps.Memoq.Models.Termbases.Requests;

public class CreateTermbaseRequest
{
[Display("Is QTerm")]
public bool? IsQTerm { get; set; }

public string? Name { get; set; }

public string? Description { get; set; }

public string? Client { get; set; }

public string? Project { get; set; }

public string? Domain { get; set; }

public string? Subject { get; set; }

[Display("Is moderated")]
public bool? IsModerated { get; set; }

[Display("Late disclosure", Description = "Can be applied only when 'Is moderated' parameter set to 'True'. When set " +
"to 'False', entries appear immediately in a moderated term base. If the " +
"terminologist rejects one later, it will be removed from the term base.")]
public bool? ModLateDisclosure { get; set; }
}
12 changes: 12 additions & 0 deletions Apps.Memoq/Models/Termbases/Requests/TermbaseRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Apps.Memoq.DataSourceHandlers;
using Blackbird.Applications.Sdk.Common;
using Blackbird.Applications.Sdk.Common.Dynamic;

namespace Apps.Memoq.Models.Termbases.Requests;

public class TermbaseRequest
{
[Display("Termbase ID")]
[DataSource(typeof(TermbaseDataHandler))]
public string TermbaseId { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Blackbird.Applications.Sdk.Common;

namespace Apps.Memoq.Models.Termbases.Responses;

public class ImportTermbaseResponse
{
[Display("Termbase GUID")]
public string TermbaseGuid { get; set; }
}
24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@ Before you can connect you need to make sure that:

### Analyses

- **Get document/project analysis**
- **Get document/project analysis**.

### Files

- **List project documents** returns a list of all documents related to a specified project.
- **Slice document** slices specific document based on the specified options.
- **Assign document to user** assigns the document to a specific user.
- **Get/delete/overwrite/deliver document**
- **Get/delete/overwrite/deliver document**.
- **Import/Export document** uploads/downloads file to the project. Make sure your file name contains extension, otherwise the action will fail.
- **Export document as XLIFF** exports and downloads the translation document as XLIFF (MQXLIFF) bilingual.
- **Apply translated content to updated source**
- **Apply translated content to updated source**.

### Groups

- **List groups** returns a list of all groups
- **List groups** returns a list of all groups.

### Packages

Expand All @@ -56,21 +56,30 @@ Before you can connect you need to make sure that:
### Projects

- **List projects** returns a list of all projects.
- **Get/create/delete/distribute project **
- **Get/create/delete/distribute project**.
- **Create project from package/template** creates a new project based on a specified template/package.
- **Add target language to project** adds target language to a specific project.

### Translation memories

- **List translation memories** returns a list of all translation memory.
- **Get/create/update/delete**
- **Get/create/update/delete**.
- **Import TMX file** imports TMX file to the translation memory.
- **Import translation memory scheme from XML** imports translation memory metadata scheme from an XML file.

### Term bases

- **Import glossary** imports a term base.
- **Export glossary** exports an existing term base. This action accepts an optional input parameter called _Include forbidden terms_ which defaults to _False_. When set to _False_, terms with _Forbidden_ status are excluded from the resulting export.

**Import glossary** and **Export glossary** support both regular term bases and QTerm. It's essential to note that the current implementation only facilitates basic imports/exports, covering fundamental information like terms, languages, and definitions. However, additional details such as domain, usage examples, client, project, and other details are not included in the glossaries.

Another important consideration is that our glossaries implementation adheres to the ISO 639-1 standard language codes, in contrast to memoQ. If there is no corresponding ISO 639-1 language code for a language supported by memoQ, our glossaries will utilize memoQ's ISO 639-3 language code. This can result in incompatibility with other systems if such languages are present in a glossary. However, it's worth mentioning that you will still be able to manipulate these glossaries within memoQ.

### Users

- **List users** returns a list of all users.
- **Get/create/delete user**
- **Get/create/delete user**.

## Events

Expand All @@ -80,7 +89,6 @@ Before you can connect you need to make sure that:

In the future we can add actions for:

- Termbases
- Tasks
- Resources

Expand Down
Loading