Skip to content

Commit 42db207

Browse files
committed
fix: resolve localization placeholders rendering as {0}/{1}
1 parent 398d403 commit 42db207

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

DuplicateFinder.ps1

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ $THUMB_W = 120
220220
$THUMB_H = 120
221221

222222
# ==================== YARDIMCI ====================
223-
function T([string]$Key, [object[]]$Args = @()) {
223+
function T([string]$Key, [object[]]$FormatArgs = @()) {
224224
$lang = if ($script:CurrentLanguage -eq 'tr') { 'tr' } else { 'en' }
225225

226226
$text = switch ($lang) {
@@ -518,9 +518,22 @@ function T([string]$Key, [object[]]$Args = @()) {
518518
}
519519
}
520520

521-
if ($Args -and $Args.Count -gt 0) {
521+
if ($null -ne $FormatArgs -and $FormatArgs.Count -gt 0) {
522+
$resolvedArgs = @($FormatArgs)
523+
524+
# PowerShell can bind array inputs as a single nested element; flatten one level.
525+
if ($resolvedArgs.Count -eq 1) {
526+
$first = $resolvedArgs[0]
527+
if ($first -is [System.Array]) {
528+
$resolvedArgs = @($first)
529+
}
530+
elseif ($first -is [System.Collections.IList] -and -not ($first -is [string])) {
531+
$resolvedArgs = @($first)
532+
}
533+
}
534+
522535
try {
523-
return [string]::Format($text, $Args)
536+
return [string]::Format($text, [object[]]$resolvedArgs)
524537
}
525538
catch {
526539
return $text

0 commit comments

Comments
 (0)