added script
continuous-integration/drone/push Build is passing Details

pull/5/head
Dmitry Kirdyashkin 2023-09-27 00:38:33 +03:00
parent 76f733b9ce
commit 35e205e2d3
1 changed files with 19 additions and 0 deletions

19
translate.ps1 100644
View File

@ -0,0 +1,19 @@
#replace spell name and description to localized one
$db = "src\packs\sc-spells.db"
$spellList = "C:\Users\dmitr\Documents\Repos\local\modules\sc-spells\src\packs\sc-spells.json"
$localizationFile = "localization\ru.json"
$null | Set-Content $db
$data = get-content $spellList | ConvertFrom-Json
$localizationData = get-content $localizationFile | ConvertFrom-Json
foreach ($entry in $data){
if ($entry.name -in $localizationData.name){
$localizedEntry = $localizationData | Where-Object -Property name -eq "$($entry.name)"
$entry.name = "$($localizedEntry.localizedName)/$($entry.name)"
$entry.system.description.value = "$($localizedEntry.description)"
} else {
Write-Warning "$($entry.name) is absent in localization file"
}
@($entry) | convertto-json -Depth 32 -Compress >> $db
}