<commit_before>function Get-DbaAvailableCollation {
	<#
		.SYNOPSIS
			Function to get available collations for a given SQL Server

		.DESCRIPTION
			The Get-DbaAvailableCollation function returns the list of collations available on each SQL Server.
			Only the connect permission is required to get this information.

		.PARAMETER SqlInstance
			The SQL Server instance, or instances. Only connect permission is required.

		.PARAMETER SqlCredential
			SqlCredential object to connect as. If not specified, current Windows login will be used.

		.PARAMETER Silent
			Use this switch to disable any kind of verbose messages

		.NOTES
			Author: <NAME> (@galador)

			Website: https://dbatools.io
			Copyright: (C) <NAME>, <EMAIL>
			License: GNU GPL v3 https://opensource.org/licenses/GPL-3.0

		.LINK
			https://dbatools.io/Get-DbaAvailableCollation

		.EXAMPLE
			Get-DbaAvailableCollation -SqlInstance sql2016

			Gets all the collations from server sql2016 using NT authentication 

	#>
	[CmdletBinding()]
	Param (
		[parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true)]
		[Alias("ServerInstance", "SqlServer")]
		[DbaInstanceParameter[]]$SqlInstance,
		[PSCredential]$SqlCredential,
		[switch]$Silent
	)

	begin {
		#Functions to get/cache the code page and language description.
		#It runs about 9x faster caching these (2 vs 18 seconds) in my test,
		#since there are so many duplicates

		#No longer supported by Windows, but still shows up in SQL Server
		#http://www.databaseteam.org/1-ms-sql-server/982faddda7a789a1.htm
		$locales = @{66577 = "Japanese_Unicode"}
		$codePages = @{}

		function Get-LocaleDescription ($LocaleId) {
			if ($locales.ContainsKey($LocaleId)) {
				$localeName = $locales.Get_Item($LocaleId)
			}
			else {
				try {
					$localeName = (Get-Language $LocaleId).DisplayName	
				}
				catch {
					$localeName = $null
				}
				$locales.Set_Item($LocaleId, $localeName)
			}
			return $localeName			
		}

		function Get-CodePageDescription ($codePageId) {
			if ($codePages.ContainsKey($codePageId)) {
				$codePageName = $codePages.Get_Item($codePageId)
			}
			else {
				try {
					$codePageName = (Get-CodePage $codePageId).EncodingName	
				}
				catch {
					$codePageName = $null
				}
				$codePages.Set_Item($codePageId, $codePageName)
			}
			return $codePageName			
		}
	}

	process {
		foreach ($Instance in $sqlInstance) {
			try {
				Write-Message -Level Verbose -Message "Connecting to $instance"
				$server = Connect-SqlInstance -SqlInstance $instance -SqlCredential $SqlCredential
			}
			catch {
				Stop-Function -Message "Failure" -Category ConnectionError -ErrorRecord $_ -Target $instance -Continue
			}

			$availableCollations = $server.EnumCollations()
			foreach ($collation in $availableCollations) {
				Add-Member -InputObject $collation -Force -MemberType NoteProperty -Name Instance -Value $Instance
				Add-Member -InputObject $collation -Force -MemberType NoteProperty -Name CodePageName -Value (Get-CodePageDescription $collation.CodePage)
				Add-Member -InputObject $collation -Force -MemberType NoteProperty -Name LocaleName -Value (Get-LocaleDescription $collation.LocaleID)
			}

			Select-DefaultView -InputObject $availableCollations -Property Instance, Name, CodePage, CodePageName, LocaleID, LocaleName, Description
		} 
	} 
}<commit_msg>added default members<commit_after>function Get-DbaAvailableCollation {
	<#
		.SYNOPSIS
			Function to get available collations for a given SQL Server

		.DESCRIPTION
			The Get-DbaAvailableCollation function returns the list of collations available on each SQL Server.
			Only the connect permission is required to get this information.

		.PARAMETER SqlInstance
			The SQL Server instance, or instances. Only connect permission is required.

		.PARAMETER SqlCredential
			SqlCredential object to connect as. If not specified, current Windows login will be used.

		.PARAMETER Silent
			Use this switch to disable any kind of verbose messages

		.NOTES
			Author: <NAME> (@galador)

			Website: https://dbatools.io
			Copyright: (C) <NAME>, <EMAIL>
			License: GNU GPL v3 https://opensource.org/licenses/GPL-3.0

		.LINK
			https://dbatools.io/Get-DbaAvailableCollation

		.EXAMPLE
			Get-DbaAvailableCollation -SqlInstance sql2016

			Gets all the collations from server sql2016 using NT authentication 

	#>
	[CmdletBinding()]
	Param (
		[parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true)]
		[Alias("ServerInstance", "SqlServer")]
		[DbaInstanceParameter[]]$SqlInstance,
		[PSCredential]$SqlCredential,
		[switch]$Silent
	)

	begin {
		#Functions to get/cache the code page and language description.
		#It runs about 9x faster caching these (2 vs 18 seconds) in my test,
		#since there are so many duplicates

		#No longer supported by Windows, but still shows up in SQL Server
		#http://www.databaseteam.org/1-ms-sql-server/982faddda7a789a1.htm
		$locales = @{66577 = "Japanese_Unicode"}
		$codePages = @{}

		function Get-LocaleDescription ($LocaleId) {
			if ($locales.ContainsKey($LocaleId)) {
				$localeName = $locales.Get_Item($LocaleId)
			}
			else {
				try {
					$localeName = (Get-Language $LocaleId).DisplayName	
				}
				catch {
					$localeName = $null
				}
				$locales.Set_Item($LocaleId, $localeName)
			}
			return $localeName			
		}

		function Get-CodePageDescription ($codePageId) {
			if ($codePages.ContainsKey($codePageId)) {
				$codePageName = $codePages.Get_Item($codePageId)
			}
			else {
				try {
					$codePageName = (Get-CodePage $codePageId).EncodingName	
				}
				catch {
					$codePageName = $null
				}
				$codePages.Set_Item($codePageId, $codePageName)
			}
			return $codePageName			
		}
	}

	process {
		foreach ($Instance in $sqlInstance) {
			try {
				Write-Message -Level Verbose -Message "Connecting to $instance"
				$server = Connect-SqlInstance -SqlInstance $instance -SqlCredential $SqlCredential
			}
			catch {
				Stop-Function -Message "Failure" -Category ConnectionError -ErrorRecord $_ -Target $instance -Continue
			}

			$availableCollations = $server.EnumCollations()
			foreach ($collation in $availableCollations) {
				Add-Member -Force -InputObject $collation -MemberType NoteProperty -Name ComputerName -value $server.NetName
				Add-Member -Force -InputObject $collation -MemberType NoteProperty -Name InstanceName -value $server.ServiceName
				Add-Member -Force -InputObject $collation -MemberType NoteProperty -Name SqlInstance -value $server.DomainInstanceName
				Add-Member -Force -InputObject $collation -MemberType NoteProperty -Name CodePageName -Value (Get-CodePageDescription $collation.CodePage)
				Add-Member -Force -InputObject $collation -MemberType NoteProperty -Name LocaleName -Value (Get-LocaleDescription $collation.LocaleID)
			}
			
			Select-DefaultView -InputObject $availableCollations -Property ComputerName, InstanceName, SqlInstance, Name, CodePage, CodePageName, LocaleID, LocaleName, Description
		} 
	} 
}
{'fraction_non_alphanumeric': 0.0948622273249139, 'fraction_numerical': 0.008610792192881744, 'mean_word_length': 3.756996587030717, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2351685', 'n_tokens_mistral': 2490, 'n_tokens_neox': 2080, 'n_words': 594}