Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@

<ItemGroup>
<PackageReference Include="contentful.csharp" Version="8.6.1" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.15" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.15" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="9.0.15" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.15" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="9.0.15" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.16" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.16" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="9.0.16" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.16" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="9.0.16" />
</ItemGroup>

<ItemGroup>
Expand Down
118 changes: 59 additions & 59 deletions src/contentful/CareLeavers.ContentfulMigration/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,56 +14,56 @@
},
"Microsoft.Extensions.Configuration": {
"type": "Direct",
"requested": "[9.0.15, )",
"resolved": "9.0.15",
"contentHash": "qxlTxFw69SHEljR49rJ1PPZn2Z/uqEixCb2vFE77BaX1CSyt+6aHvCOfj1LD7kXtKwxxrBaJBgLdu19c8jipLg==",
"requested": "[9.0.16, )",
"resolved": "9.0.16",
"contentHash": "QetFHhyFfoKjFeZCHl2gLrMFzTfMpy/F805+gYKnZjonG/QvHJNHiP1M8wlziHYqI8qsG/1B8gX6lAUivj202g==",
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "9.0.15",
"Microsoft.Extensions.Primitives": "9.0.15"
"Microsoft.Extensions.Configuration.Abstractions": "9.0.16",
"Microsoft.Extensions.Primitives": "9.0.16"
}
},
"Microsoft.Extensions.Configuration.Binder": {
"type": "Direct",
"requested": "[9.0.15, )",
"resolved": "9.0.15",
"contentHash": "6hOTcdyGlJBBHl1DqbnvqSbHsJp814r5HMXGkTH1Jg6IosqwqZhh00/UCUJ0oXrACO096wWuCMfKMIPbnMGWIQ==",
"requested": "[9.0.16, )",
"resolved": "9.0.16",
"contentHash": "TCDQP8lhJJ2tCINCrgwSzfTPVAHSemXj+awfkY1n6F1qxuojz0kQlUId/21qfN02cosyHHb0fQlJtaJyYn1VYw==",
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "9.0.15"
"Microsoft.Extensions.Configuration.Abstractions": "9.0.16"
}
},
"Microsoft.Extensions.Configuration.EnvironmentVariables": {
"type": "Direct",
"requested": "[9.0.15, )",
"resolved": "9.0.15",
"contentHash": "5laaPT77pVbLlj2vZklHhvapPcG2hXmRAM04OtDdhZv9dDfibm5NLYq81M7/W3JgVqdRl7TL4CxM1+0qduQi4Q==",
"requested": "[9.0.16, )",
"resolved": "9.0.16",
"contentHash": "cuZm5fbFVbe3ylEXV43IhJcsUZ0jhdh7Km9F0AMuYSyfjPNeJItzTlNxQdts4Y0LjfNl7cIFEEkJ13zJmXC8iA==",
"dependencies": {
"Microsoft.Extensions.Configuration": "9.0.15",
"Microsoft.Extensions.Configuration.Abstractions": "9.0.15"
"Microsoft.Extensions.Configuration": "9.0.16",
"Microsoft.Extensions.Configuration.Abstractions": "9.0.16"
}
},
"Microsoft.Extensions.Configuration.Json": {
"type": "Direct",
"requested": "[9.0.15, )",
"resolved": "9.0.15",
"contentHash": "rZidIJ2FOyOUPlXwgsdVP2BeAr0CTxzHA21wZoCVhMZx08bMkGvuJGIjDswNh1LmEwPLmEf/E9LOigT3EpKMGA==",
"requested": "[9.0.16, )",
"resolved": "9.0.16",
"contentHash": "vuuJyt3Ic262mpZxDcR5/LHmswQ68OcqKp+lS96nrWEHdxJ6NCtmouNoT136Ea06/l5Lat5KzC05JRGSJIN+ow==",
"dependencies": {
"Microsoft.Extensions.Configuration": "9.0.15",
"Microsoft.Extensions.Configuration.Abstractions": "9.0.15",
"Microsoft.Extensions.Configuration.FileExtensions": "9.0.15",
"Microsoft.Extensions.FileProviders.Abstractions": "9.0.15",
"System.Text.Json": "9.0.15"
"Microsoft.Extensions.Configuration": "9.0.16",
"Microsoft.Extensions.Configuration.Abstractions": "9.0.16",
"Microsoft.Extensions.Configuration.FileExtensions": "9.0.16",
"Microsoft.Extensions.FileProviders.Abstractions": "9.0.16",
"System.Text.Json": "9.0.16"
}
},
"Microsoft.Extensions.Configuration.UserSecrets": {
"type": "Direct",
"requested": "[9.0.15, )",
"resolved": "9.0.15",
"contentHash": "z+uJopcjxkfu6ywNBcOm2gGXwne/q+LTL/6z5MEol0pCmQ+gH5nIU00SZZGCR14vbW33z3M3HLVvfoKEjsORmQ==",
"requested": "[9.0.16, )",
"resolved": "9.0.16",
"contentHash": "+roFrhfQW7V/AufiXHIJz9lcH9NUnaqVYXxpongLcsuOtT0BJAMFwbmQ+T7D9QhUctoxE0O/O+1myrTdX80eqA==",
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "9.0.15",
"Microsoft.Extensions.Configuration.Json": "9.0.15",
"Microsoft.Extensions.FileProviders.Abstractions": "9.0.15",
"Microsoft.Extensions.FileProviders.Physical": "9.0.15"
"Microsoft.Extensions.Configuration.Abstractions": "9.0.16",
"Microsoft.Extensions.Configuration.Json": "9.0.16",
"Microsoft.Extensions.FileProviders.Abstractions": "9.0.16",
"Microsoft.Extensions.FileProviders.Physical": "9.0.16"
}
},
"Microsoft.CSharp": {
Expand All @@ -73,51 +73,51 @@
},
"Microsoft.Extensions.Configuration.Abstractions": {
"type": "Transitive",
"resolved": "9.0.15",
"contentHash": "M9s2mDxtfNdS6SbemODzDxHgm+eIhZPSuTc0s0QazQoSceTXTv+OjthKqf8r/FehXtABXD01ijQNdtODDFtnxg==",
"resolved": "9.0.16",
"contentHash": "+Hgfx2NC+lLG7S47DxhASWp9bbCuEPyzO7s/JTJ9DLc0QXpFTBdJVQouoHaqqQCOD+78k+Np+/cSaQdqrhrf5g==",
"dependencies": {
"Microsoft.Extensions.Primitives": "9.0.15"
"Microsoft.Extensions.Primitives": "9.0.16"
}
},
"Microsoft.Extensions.Configuration.FileExtensions": {
"type": "Transitive",
"resolved": "9.0.15",
"contentHash": "HtxlK3nOdSt/AInMnTFbvg6tToOMXmsl+jZ6g6pYjzDhlfeQZksE/yKS8YG14yzvtgIFTUkh95qZ+UCqqguxSQ==",
"resolved": "9.0.16",
"contentHash": "Pyk9/H+V7PSibfJgu0yEWi9wwunct5I1XMUNsvLyOH5aH5hJL07deJBY5Q+h9zatl+Uw6us+34c4az/x3Z0oRA==",
"dependencies": {
"Microsoft.Extensions.Configuration": "9.0.15",
"Microsoft.Extensions.Configuration.Abstractions": "9.0.15",
"Microsoft.Extensions.FileProviders.Abstractions": "9.0.15",
"Microsoft.Extensions.FileProviders.Physical": "9.0.15",
"Microsoft.Extensions.Primitives": "9.0.15"
"Microsoft.Extensions.Configuration": "9.0.16",
"Microsoft.Extensions.Configuration.Abstractions": "9.0.16",
"Microsoft.Extensions.FileProviders.Abstractions": "9.0.16",
"Microsoft.Extensions.FileProviders.Physical": "9.0.16",
"Microsoft.Extensions.Primitives": "9.0.16"
}
},
"Microsoft.Extensions.FileProviders.Abstractions": {
"type": "Transitive",
"resolved": "9.0.15",
"contentHash": "yzWilnNU/MvHINapPhY6iFAeApZnhToXbEBplORucn01hFc1F6ZaKt0V9dHYpUMun8WR9cSnq1ky35FWREVZbA==",
"resolved": "9.0.16",
"contentHash": "/YLSWDs+p0Y4+UGPoWI3uUNq7R5/f/8zw8XeViuhfSTGnPowoqbllBE9aR4TteFgNfIH4IHkhUwSlhMLB0aL8g==",
"dependencies": {
"Microsoft.Extensions.Primitives": "9.0.15"
"Microsoft.Extensions.Primitives": "9.0.16"
}
},
"Microsoft.Extensions.FileProviders.Physical": {
"type": "Transitive",
"resolved": "9.0.15",
"contentHash": "iFT4OZXDitw6IHkQTE7G//UZAKIPS14wuM6aVZTlfzVvR6PdICnL3f2OKayu2nEamE5XBzpvUKcOT0xOX93eBA==",
"resolved": "9.0.16",
"contentHash": "jRD7Q/gUMwcd3qhjv+j72apkLhxV0bci1AiqUVAZ9Cy53XgZG1Qwy4/MVxUN4xh8F0L/J8UP0l4+FLnhfZnJ7A==",
"dependencies": {
"Microsoft.Extensions.FileProviders.Abstractions": "9.0.15",
"Microsoft.Extensions.FileSystemGlobbing": "9.0.15",
"Microsoft.Extensions.Primitives": "9.0.15"
"Microsoft.Extensions.FileProviders.Abstractions": "9.0.16",
"Microsoft.Extensions.FileSystemGlobbing": "9.0.16",
"Microsoft.Extensions.Primitives": "9.0.16"
}
},
"Microsoft.Extensions.FileSystemGlobbing": {
"type": "Transitive",
"resolved": "9.0.15",
"contentHash": "zr0KtzBYm8f8pD3jLNlg9jy/8K9p9z9rCZebRJmQ0nWAikNwHVx2zc5MbDt88bctC8gc8jtqGhy/e7TFNW3gOg=="
"resolved": "9.0.16",
"contentHash": "e+DBK3rmeR4UUUprclszcOu1b6KB6sVpyw2fL7WQLSEt2D29NMFZpEa+2VeFzZWm7IAou7ELBq67LtWs6H6CXQ=="
},
"Microsoft.Extensions.Primitives": {
"type": "Transitive",
"resolved": "9.0.15",
"contentHash": "WRPJ9kpIwsOcghRT0tduIqiz7CDv7WsnL4kTJavtHS4j5AW++4LlR63oOSTL2o/zLR4T1z0/FQMgrnsPJ5bpQQ=="
"resolved": "9.0.16",
"contentHash": "w5RE1MR0lnAElsRJaFd2POIXl/H62aBKmfX8ibYmRmbk0JB9V/9jR0VD5NxiP1ETWpnDAnPguTSe7fF/FdsHEQ=="
},
"Newtonsoft.Json": {
"type": "Transitive",
Expand All @@ -126,21 +126,21 @@
},
"System.IO.Pipelines": {
"type": "Transitive",
"resolved": "9.0.15",
"contentHash": "oPtlPToTsvPCPKWglEzoBvyAOAkebDNSIZeEda2z4wVGji1BV1+1NVqLrceMXRUY8yrXzi8cqrOwaWRq4XEBxg=="
"resolved": "9.0.16",
"contentHash": "wULNihoFgu6JMzwxSbvG2fYtp8h3dxM8aIzcvQv535aMRECy+c3b8YL5m/36vwETPOcRJjyIN8SASTITdm8JZg=="
},
"System.Text.Encodings.Web": {
"type": "Transitive",
"resolved": "9.0.15",
"contentHash": "EPjnxVcoecQEtdsFMlLW2yh/NdqhMny4CV6Y5dHeDZXyOxVQOnmmifIoDCcQfcx+5kqNTQ27xJDNFYPcuaKiEw=="
"resolved": "9.0.16",
"contentHash": "860BMNxGLHCc8QWHb+ERfDgzEIsRk3GXZnWYMyMmynuFNAoabHhWSWBElPbzI839MBf+hUJWADp/1rLH1+/2Eg=="
},
"System.Text.Json": {
"type": "Transitive",
"resolved": "9.0.15",
"contentHash": "rQUurOZYEo81Cvq253gO4FTDO9r+RBUBQVI3q7qwS31SH1wtUfP+Aw23I81ZkFSUBC4f1hPqea0wxo15rR5/dA==",
"resolved": "9.0.16",
"contentHash": "BgvJQq4uc6jOiiuZ/5LTxrZ+hXTmnm/Q/Sq9/RM2LtBqY8YSA7UB8NgF6j0ZdqWrfvk9Z8AfwV+WMTONIOXESw==",
"dependencies": {
"System.IO.Pipelines": "9.0.15",
"System.Text.Encodings.Web": "9.0.15"
"System.IO.Pipelines": "9.0.16",
"System.Text.Encodings.Web": "9.0.16"
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/web/CareLeavers.Web/CareLeavers.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@

<ItemGroup>
<PackageReference Include="Azure.AI.Translation.Document" Version="2.0.0" />
<PackageReference Include="Azure.AI.Translation.Text" Version="1.0.0" />
<PackageReference Include="Azure.Core" Version="1.55.0" />
<PackageReference Include="Azure.AI.Translation.Text" Version="2.0.0" />
<PackageReference Include="Azure.Core" Version="1.57.0" />
<PackageReference Include="Azure.Monitor.OpenTelemetry.AspNetCore" Version="1.5.0" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.28.0" />
<PackageReference Include="contentful.aspnetcore" Version="8.6.1" />
<PackageReference Include="HtmlAgilityPack" Version="1.12.4" />
<PackageReference Include="Joonasw.AspNetCore.SecurityHeaders" Version="6.0.0" />
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.23.0" />
<PackageReference Include="Microsoft.Extensions.Azure" Version="1.14.0" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="9.0.15" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="9.0.16" />
<PackageReference Include="OpenTelemetry.Api" Version="1.15.3" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.15.3" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.15.2" />
Expand Down
11 changes: 4 additions & 7 deletions src/web/CareLeavers.Web/Translation/AzureTranslationService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Text;
using Azure;
using Azure.AI.Translation.Document;
using Azure.AI.Translation.Text;
using CareLeavers.Web.Configuration;
Expand All @@ -13,7 +14,7 @@
IContentfulConfiguration contentfulConfiguration)
: ITranslationService
{
public async Task<string?> TranslateHtml(string html, string toLanguage)

Check warning on line 17 in src/web/CareLeavers.Web/Translation/AzureTranslationService.cs

View workflow job for this annotation

GitHub Actions / Build, Test & Analyse

Rename parameter 'html' to 'text' to match the interface declaration.
{
var language = await GetLanguage(toLanguage);

Expand All @@ -27,14 +28,10 @@
return await TranslateDocument(html, language.Code);
}

var translateOptions = new TextTranslationTranslateOptions(toLanguage, html)
{
TextType = TextType.Html
};

var response = await azureTranslationClient.TranslateAsync(translateOptions);
Response<IReadOnlyList<TranslatedTextItem>>? response =
await azureTranslationClient.TranslateAsync(toLanguage, html, "en");

return response.Value.FirstOrDefault()?.Translations.FirstOrDefault()?.Text;
return response.HasValue ? response.Value[0].Translations[0].Text : null;
}

private async Task<string?> TranslateDocument(string html, string language)
Expand Down
34 changes: 16 additions & 18 deletions src/web/CareLeavers.Web/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,25 @@
},
"Azure.AI.Translation.Text": {
"type": "Direct",
"requested": "[1.0.0, )",
"resolved": "1.0.0",
"contentHash": "1NuUYXydLzlJH8NXuq3SIBvCJ1VDSXJym0BA24bFWkLMDluYQaS4pwmrVyEfTqFmqO1fqzAxP87RMqH+zWdr4Q==",
"requested": "[2.0.0, )",
"resolved": "2.0.0",
"contentHash": "v0U87B7PkjvxppAVWSMZSDshTB1uPBR6nPcdGWrhzUW/v9RG5sP7QdjxJtyJtHVzrUmY9lM8Y2T2mO7KAAXBpQ==",
"dependencies": {
"Azure.Core": "1.39.0",
"System.ClientModel": "1.0.0",
"System.Text.Json": "4.7.2"
"Azure.Core": "1.57.0"
}
},
"Azure.Core": {
"type": "Direct",
"requested": "[1.55.0, )",
"resolved": "1.55.0",
"contentHash": "c7femvYS/xEUrLP1sNZN+DoQZmx3X+G3ZXtOOz0RL/7cGMCM3JVqepVmRd3AwM4IK8AtTGS4GOigCO+d/zaSsQ==",
"requested": "[1.57.0, )",
"resolved": "1.57.0",
"contentHash": "POStMP+rxaAEYScwGBpIUcnEpSj/3ctYmCmt2IqU3recuAjjddEgTq4q4TLImEdQCfsFr/HpEuYjiY/wKeAprQ==",
"dependencies": {
"Microsoft.Bcl.AsyncInterfaces": "10.0.3",
"Microsoft.Extensions.Configuration.Abstractions": "10.0.3",
"Microsoft.Extensions.Hosting.Abstractions": "10.0.3",
"Microsoft.Identity.Client": "4.83.1",
"Microsoft.Identity.Client.Extensions.Msal": "4.83.1",
"System.ClientModel": "1.11.0",
"System.ClientModel": "1.13.0",
"System.Diagnostics.DiagnosticSource": "10.0.3",
"System.Memory.Data": "10.0.3",
"System.Text.Encodings.Web": "10.0.3",
Expand Down Expand Up @@ -120,13 +118,13 @@
},
"Microsoft.Extensions.Caching.StackExchangeRedis": {
"type": "Direct",
"requested": "[9.0.15, )",
"resolved": "9.0.15",
"contentHash": "A6cPl6wUW4wLOl03kqVzFYOzMVpFlOOjK5czvpYoqMMJgx3guzbyaugkeLmLfT5Vv2HXPkvBebxRgylgkkGuSg==",
"requested": "[9.0.16, )",
"resolved": "9.0.16",
"contentHash": "cW/17J/3KoCY2JhrWuS/R6wLIDUJHRs4DWXriACdfWRH7arXChcMleWDj5YMCrK5Lw4pQi4Ac10ZAM01nozSSg==",
"dependencies": {
"Microsoft.Extensions.Caching.Abstractions": "9.0.15",
"Microsoft.Extensions.Logging.Abstractions": "9.0.15",
"Microsoft.Extensions.Options": "9.0.15",
"Microsoft.Extensions.Caching.Abstractions": "9.0.16",
"Microsoft.Extensions.Logging.Abstractions": "9.0.16",
"Microsoft.Extensions.Options": "9.0.16",
"StackExchange.Redis": "2.7.27"
}
},
Expand Down Expand Up @@ -1243,8 +1241,8 @@
},
"System.ClientModel": {
"type": "Transitive",
"resolved": "1.11.0",
"contentHash": "1Wl32zh7TbvN+HAO8NqDuaN0Ao2Qu/0j0NJSrXGDtpUQsTXQYJ3C6hd9/Ds2IrgP4agMQYFoXB35GZfC21ByHw==",
"resolved": "1.13.0",
"contentHash": "UneZiqYV3vmsCQJ2bO3fEzSGqK84kxEOOLN0OGDxxhAzef91gZLBQ5J8tgP0oTuwYmUSvwXGzvuq3Cvkedv8tA==",
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "10.0.3",
"Microsoft.Extensions.Hosting.Abstractions": "10.0.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@

<ItemGroup>
<PackageReference Include="AngleSharp" Version="1.4.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.26" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.27" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageReference Include="NSubstitute" Version="5.3.0" />
<PackageReference Include="NUnit" Version="4.6.0" />
<PackageReference Include="NUnit" Version="4.6.1" />
<PackageReference Include="NUnit3TestAdapter" Version="6.2.0" />
<PackageReference Include="NUnit.Analyzers" Version="4.13.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="10.0.0">
<PackageReference Include="coverlet.collector" Version="10.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Loading
Loading