2023-09-26 21:38:33 +00:00
|
|
|
#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"
|
2023-09-26 21:47:05 +00:00
|
|
|
$brokenNames = "localization\broken.json"
|
2023-09-26 21:38:33 +00:00
|
|
|
|
2023-09-26 21:47:05 +00:00
|
|
|
$null | Set-Content $brokenNames
|
2023-09-26 21:38:33 +00:00
|
|
|
$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)"
|
2023-09-26 21:47:05 +00:00
|
|
|
|
|
|
|
@($entry) | convertto-json -Depth 32 -Compress >> $db
|
2023-09-26 21:38:33 +00:00
|
|
|
} else {
|
|
|
|
Write-Warning "$($entry.name) is absent in localization file"
|
2023-09-26 21:47:05 +00:00
|
|
|
@($entry) | convertto-json -Depth 32 -Compress >> $brokenNames
|
2023-09-26 21:38:33 +00:00
|
|
|
}
|
|
|
|
}
|