Functions/LanguagePack/Remove-CdsLanguagePack.ps1

<#
    .SYNOPSIS
    Desactivate given language
#>

function Remove-CdsLanguagePack{
    [CmdletBinding()]    
    param
    (        
        [Parameter(Mandatory=$false, ValueFromPipeline)]
        [Microsoft.Xrm.Tooling.Connector.CrmServiceClient]
        $CdsClient = $Global:CdsClient,

        [Parameter(Mandatory=$true)]
        [int]
        $Language 
    )
    begin {
        $StopWatch = [System.Diagnostics.Stopwatch]::StartNew();
        Trace-CdsFunction -Name $MyInvocation.MyCommand.Name -Stage Start -Parameters ($MyInvocation.MyCommand.Parameters);       
    }    
    process {

        $provisionLanguageRequest = New-CdsRequest -Name "DeprovisionLanguage";
        $provisionLanguageRequest | Add-CdsRequestParameter -Name "Language" -Value $Language | Out-Null;

        $CdsClient | Set-CdsClientTimeout -DurationInMinutes 30;
        $response = Invoke-CdsRequest -CdsClient $CdsClient -Request $provisionLanguageRequest;
        $CdsClient | Set-CdsClientTimeout -Revert;
        $response;                
    }
    end {
        $StopWatch.Stop();
        Trace-CdsFunction -Name $MyInvocation.MyCommand.Name -Stage Stop -StopWatch $StopWatch;
    }    
}

Export-ModuleMember -Function Remove-CdsLanguagePack -Alias *;