You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
simple script for users or volunteers suck in template xml parse through api and manually check as desired ...
if a new language is desired can export a file users can use and make available in new languages or assist you in their upkeep.
# Define the GitHub repository and paths
$repoUrl = "https://github.com/Romanitho/Winget-AutoUpdate/archive/refs/heads/main.zip"
$localePath = "Sources/Winget-AutoUpdate/locale"
$locales = @("ja", "de", "es") # Add more language codes as needed
# Download the latest release zip file
$zipPath = "$env:TEMP\Winget-AutoUpdate.zip"
Invoke-WebRequest -Uri $repoUrl -OutFile $zipPath
# Extract the zip file
Expand-Archive -Path $zipPath -DestinationPath "$env:TEMP\Winget-AutoUpdate"
# Function to translate text using Microsoft Translator API
function Translate-Text {
param (
[string]$text,
[string]$toLanguage
)
# Replace with your Microsoft Translator API key
$apiKey = "YOUR_API_KEY"
$uri = "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=$toLanguage"
$body = @(@{ Text = $text }) | ConvertTo-Json
$headers = @{
"Ocp-Apim-Subscription-Key" = $apiKey
"Content-Type" = "application/json"
}
$response = Invoke-RestMethod -Uri $uri -Method Post -Body $body -Headers $headers
return $response.translations[0].text
}
# Read the original XML file (e.g., fr.xml)
$originalXmlPath = "$env:TEMP\Winget-AutoUpdate\Winget-AutoUpdate-main\$localePath\fr.xml"
[xml]$originalXml = Get-Content -Path $originalXmlPath
# Create translated XML files for each locale
foreach ($locale in $locales) {
$translatedXmlPath = "$env:TEMP\Winget-AutoUpdate\Winget-AutoUpdate-main\$localePath\$locale.xml"
$translatedXml = $originalXml.Clone()
foreach ($node in $translatedXml.SelectNodes("//text()")) {
$node.Value = Translate-Text -text $node.Value -toLanguage $locale
}
$translatedXml.Save($translatedXmlPath)
Write-Output "Translated XML file created: $translatedXmlPath"
}
Write-Output "Translation process completed. Please review and edit the translations as needed."
Is your feature request related to a problem?
Quick Nihongo/ generated via copilot from fr-FR xml
'<local>
<outputs>
<output id="0">
<!--Check network connection-->
<title>ネットワーク接続を確認してください。</title>
<!--Unable to check for software updates at this time!-->
<message>現在、ソフトウェアの更新を確認できません!</message>
</output>
<output id="1">
<!--No internet connection-->
<title>インターネット接続がありません。</title>
<!--Updates could not be verified-->
<message>ソフトウェアの更新を確認できませんでした!</message>
</output>
<output id="2">
<!--{App} will be updated-->
<title>{0} が更新されます!</title>
<!--{v1.0} to {v2.0}-->
<message>{0} から {1} へ</message>
</output>
<output id="3">
<!--{App} updated-->
<title>{0} が更新されました。</title>
<!--Installed version: {v1.0}-->
<message>インストールされたバージョン: {0}</message>
</output>
<output id="4">
<!--{App} could not be updated-->
<title>{0} を更新できませんでした!</title>
<!--Please contact support-->
<message>サポートに連絡してください。</message>
</output>
<output id="5">
<!--Logs are not available yet-->
<message>ログはまだ利用できません</message>
</output>
<output id="6">
<!--Starting a manual check for updated apps-->
<message>ソフトウェアの更新を手動で確認しています...</message>
</output>
<output id="7">
<!--Couldn't start a manual check for updated apps-->
<message>ソフトウェアの更新の手動確認を開始できませんでした!</message>
</output>
<output id="8">
<!--Check for updated apps already running-->
<message>ソフトウェアの更新確認が既に実行されています...</message>
</output>
<output id="9">
<!--Manual check for updated apps completed-->
<message>ソフトウェアの更新確認が完了しました。</message>
</output>
<output id="10">
<!--See changelog-->
<message>変更履歴を見る</message>
</output>
<output id="11">
<!--Open log file-->
<message>ログファイルを開く</message>
</output>
</outputs>
</local>'
Here's the translated XML content to Vietnamese: (current boss in American but of Viet.. decent)
<local>
<outputs>
<output id="0">
<!--Check network connection-->
<title>Kiểm tra kết nối mạng của bạn.</title>
<!--Unable to check for software updates at this time!-->
<message>Không thể kiểm tra cập nhật phần mềm vào lúc này!</message>
</output>
<output id="1">
<!--No internet connection-->
<title>Không có kết nối internet.</title>
<!--Updates could not be verified-->
<message>Không thể xác minh các bản cập nhật!</message>
</output>
<output id="2">
<!--{App} will be updated-->
<title>{0} sẽ được cập nhật!</title>
<!--{v1.0} to {v2.0}-->
<message>{0} từ {1}</message>
</output>
<output id="3">
<!--{App} updated-->
<title>{0} đã được cập nhật.</title>
<!--Installed version: {v1.0}-->
<message>Phiên bản đã cài đặt: {0}</message>
</output>
<output id="4">
<!--{App} could not be updated-->
<title>{0} không thể được cập nhật!</title>
<!--Please contact support-->
<message>Vui lòng liên hệ hỗ trợ.</message>
</output>
<output id="5">
<!--Logs are not available yet-->
<message>Nhật ký chưa có sẵn</message>
</output>
<output id="6">
<!--Starting a manual check for updated apps-->
<message>Đang bắt đầu kiểm tra thủ công các ứng dụng đã cập nhật...</message>
</output>
<output id="7">
<!--Couldn't start a manual check for updated apps-->
<message>Không thể bắt đầu kiểm tra thủ công các ứng dụng đã cập nhật!</message>
</output>
<output id="8">
<!--Check for updated apps already running-->
<message>Kiểm tra các ứng dụng đã cập nhật đang chạy...</message>
</output>
<output id="9">
<!--Manual check for updated apps completed-->
<message>Kiểm tra thủ công các ứng dụng đã cập nhật đã hoàn thành.</message>
</output>
<output id="10">
<!--See changelog-->
<message>Xem nhật ký thay đổi</message>
</output>
<output id="11">
<!--Open log file-->
<message>Mở tệp nhật ký</message>
</output>
</outputs>
</local>
Additional information
No response
The text was updated successfully, but these errors were encountered:
The request
simple script for users or volunteers suck in template xml parse through api and manually check as desired ...
if a new language is desired can export a file users can use and make available in new languages or assist you in their upkeep.
Is your feature request related to a problem?
Additional information
No response
The text was updated successfully, but these errors were encountered: