Skip to content

Commit 7dcbfba

Browse files
committed
auto translate new page when sync
1 parent 0dac47f commit 7dcbfba

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

YAFNET.LanguageManager/YAFNET.LanguageManager/Program.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,18 @@ private static async Task SyncLanguagesAsync(string languageFolder, List<string>
148148
updateFile = true;
149149
DebugHelper.DisplayAndLogMessage($"Adding Missing Resource Page '{sourcePage.Name}' to the language file '{file}'.");
150150

151+
// translate page
152+
foreach (var resource in sourcePage.Resource)
153+
{
154+
// Auto translate
155+
var result = await TranslateWithGoogleAsync(resource.Text, resourcesFile.Resources.Code);
156+
157+
if (!string.IsNullOrEmpty(result))
158+
{
159+
resource.Text = result;
160+
}
161+
}
162+
151163
resourcesFile.Resources.Page.Add(sourcePage);
152164
}
153165
else

YAFNET.LanguageManager/YAFNET.LanguageManager/YAFNET.LanguageManager.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
55
<TargetFramework>net9.0</TargetFramework>
66
<Title>YAFNET.LanguageManager</Title>
7-
<Version>1.0.5</Version>
7+
<Version>1.0.6</Version>
88
<Description>Tool for synchronization, packing and automatic translation of YAF.NET language file</Description>
99
<Copyright>Copyright © YetAnotherForum.NET</Copyright>
1010
</PropertyGroup>

0 commit comments

Comments
 (0)