Functions/LanguagePack/Add-CdsLanguagePack.ps1

<#
    .SYNOPSIS
    Activate given language
#>

function Add-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 "ProvisionLanguage";
        $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 Add-CdsLanguagePack -Alias *;