Ajout d'un README.md avec le descriptif et les instructions L'ancien README.md s'appelle désormais CHANGELOG.md Activation du pavé numérique par défaut pour les installations sans assistance Nouveau design pour la fenêtre de déploiement. Ajout de paramètre pour pouvoir procéder à une installation totalement automatisée Ajout de paramètre pour copier au choix sources, drivers ou les deux sur C:\DeployVenter avant leur usage par DISM.
56 lines
2.2 KiB
PowerShell
56 lines
2.2 KiB
PowerShell
# DeployCenter - localize application text using the current WinPE language.
|
|
|
|
$script:DeployCenterLocale = 'fr-FR'
|
|
$script:DeployCenterText = @{}
|
|
|
|
function Initialize-DeployCenterLocalization {
|
|
[CmdletBinding()]
|
|
param([AllowNull()][string]$CultureName = [Globalization.CultureInfo]::CurrentUICulture.Name)
|
|
|
|
$culture = if ([string]::IsNullOrWhiteSpace($CultureName)) { 'fr-FR' } else { $CultureName }
|
|
$localeName = if ($culture.StartsWith('fr', [StringComparison]::OrdinalIgnoreCase)) { 'fr-FR' } else { 'en-US' }
|
|
$resourcePath = Join-Path $PSScriptRoot (Join-Path '..' (Join-Path 'Locales' ($localeName + '.psd1')))
|
|
$resourcePath = [IO.Path]::GetFullPath($resourcePath)
|
|
if (-not (Test-Path -LiteralPath $resourcePath -PathType Leaf)) {
|
|
throw "Localization resource not found: $resourcePath"
|
|
}
|
|
|
|
$resource = Import-PowerShellDataFile -LiteralPath $resourcePath
|
|
$script:DeployCenterLocale = $localeName
|
|
$script:DeployCenterText = $resource.Strings
|
|
return $localeName
|
|
}
|
|
|
|
function Get-DeployCenterText {
|
|
[CmdletBinding()]
|
|
param(
|
|
[Parameter(Mandatory=$true)][AllowEmptyString()][string]$Text,
|
|
[AllowEmptyCollection()][object[]]$FormatArguments = @()
|
|
)
|
|
|
|
$localized = $Text
|
|
if ($script:DeployCenterText.ContainsKey($Text)) {
|
|
$localized = [string]$script:DeployCenterText[$Text]
|
|
} else {
|
|
foreach ($key in @($script:DeployCenterText.Keys | Sort-Object { $_.Length } -Descending)) {
|
|
if ($Text.StartsWith([string]$key, [StringComparison]::Ordinal)) {
|
|
$localized = [string]$script:DeployCenterText[$key] + $Text.Substring(([string]$key).Length)
|
|
break
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($FormatArguments.Count -gt 0) {
|
|
return [string]::Format([Globalization.CultureInfo]::CurrentCulture, $localized, $FormatArguments)
|
|
}
|
|
return $localized
|
|
}
|
|
|
|
function ConvertTo-DeployCenterLocalizedLogMessage {
|
|
[CmdletBinding()]
|
|
param([Parameter(Mandatory=$true)][AllowEmptyString()][string]$Message)
|
|
return Get-DeployCenterText -Text $Message
|
|
}
|
|
|
|
Export-ModuleMember -Function Initialize-DeployCenterLocalization, Get-DeployCenterText, ConvertTo-DeployCenterLocalizedLogMessage
|