Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use List[] instead of arrays; removed obsolete -PassThru parameter #27

Merged
merged 1 commit into from
Dec 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions XliffSync/Public/Test-XliffTranslations.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ function Test-XliffTranslations {
[string] $AzureDevOps = 'no',
[switch] $reportProgress,
[switch] $printProblems,
[switch] $PassThru,
[ValidateNotNull()]
[ScriptBlock]$FormatTranslationUnit = { param($TranslationUnit) $TranslationUnit.id }
)
Expand All @@ -78,8 +77,8 @@ function Test-XliffTranslations {
$onePercentCount = 1;
}

[System.Xml.XmlNode[]] $missingTranslationUnits = @();
[System.Xml.XmlNode[]] $needWorkTranslationUnits = @();
$missingTranslationUnits = New-Object -TypeName 'System.Collections.Generic.List[System.Xml.XmlNode]'
$needWorkTranslationUnits = New-Object -TypeName 'System.Collections.Generic.List[System.Xml.XmlNode]'
[bool] $problemResolvedInFile = $false;

Write-Host "Processing unit nodes... (Please be patient)";
Expand Down Expand Up @@ -110,15 +109,15 @@ function Test-XliffTranslations {
if ($checkForMissing) {
if (HasMissingTranslation -targetDocument $targetDocument -unit $unit -missingTranslationText $missingTranslation) {
$targetDocument.SetState($unit, [XlfTranslationState]::MissingTranslation);
$missingTranslationUnits += $unit;
$missingTranslationUnits.Add($unit);
}

}

if ($checkForProblems -and $translationRules) {
if (HasProblem -targetDocument $targetDocument -unit $unit -enabledRules $translationRules) {
$targetDocument.SetState($unit, [XlfTranslationState]::NeedsWorkTranslation);
$needWorkTranslationUnits += $unit;
$needWorkTranslationUnits.Add($unit);
}

# Check for resolved problem (to delete XLIFF Sync note)
Expand Down Expand Up @@ -168,7 +167,8 @@ function Test-XliffTranslations {
$targetDocument.SaveToFilePath($targetPath);
}

return $missingTranslationUnits + $needWorkTranslationUnits;
$missingTranslationUnits
$needWorkTranslationUnits;
}

function HasMissingTranslation {
Expand Down