Customize welcome text from room and OU

This commit is contained in:
2026-09-17 11:46:33 -06:00
parent 6c52a9546c
commit 2de1105ecd
3 changed files with 28 additions and 8 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ El saludo usa `Bienvenido/ubicado` para `Male` y `Bienvenida/ubicada` para
neutral `Te damos la bienvenida` y `Ubicación:`. El texto secundario sigue estas
reglas:
1. Con `location` y OU: `Estás ubicado en la Sala de Inmersión del Centro de Experiencia Digital.`
1. Con `location` y OU: `Acceso al Aula Flexible del Centro de Experiencia Digital.`
2. Con sólo uno de los datos: muestra únicamente el dato disponible.
3. Sin ambos: el texto adaptado `Bienvenido/Bienvenida al Laboratorio...`; sin
sexo disponible, la forma neutral `Acceso al Laboratorio de Cómputo de Ingeniería.`
+12 -4
View File
@@ -170,10 +170,10 @@ function Get-DirectoryWelcomeMetadata {
function Get-SpanishArticle {
param([Parameter(Mandatory)][string]$Value)
if ($Value -match '^(Sala|Aula|Facultad|Unidad|Biblioteca|Oficina|Coordinaci.n)\b') {
if ($Value -match '^(Sala|Facultad|Unidad|Biblioteca|Oficina|Coordinaci.n)\b') {
return 'la'
}
if ($Value -match '^(Laboratorio|Centro|Edificio|Campus|Taller|Auditorio)\b') {
if ($Value -match '^(Aula|Laboratorio|Centro|Edificio|Campus|Taller|Auditorio)\b') {
return 'el'
}
return $null
@@ -202,9 +202,17 @@ function Get-WelcomeLocationText {
if ($Room -and $OuName) {
$roomArticle = Get-SpanishArticle -Value $Room
$ouArticle = Get-SpanishArticle -Value $OuName
$roomPhrase = if ($roomArticle) { "$roomArticle $Room" } else { $Room }
$roomPhrase = if ($roomArticle -eq 'el') {
"al $Room"
}
elseif ($roomArticle) {
"a $roomArticle $Room"
}
else {
"a $Room"
}
$ouPhrase = if ($ouArticle -eq 'el') { "del $OuName" } elseif ($ouArticle) { "de $ouArticle $OuName" } else { "de $OuName" }
return "$located $roomPhrase $ouPhrase."
return "Acceso $roomPhrase $ouPhrase."
}
if ($Room) {
$article = Get-SpanishArticle -Value $Room
+15 -3
View File
@@ -12,15 +12,20 @@ $lookup = $ast.Find({
}, $true)
function Invoke-WelcomeFixture {
param($DirectoryGender, [string]$ExplicitGender)
param(
$DirectoryGender,
[string]$ExplicitGender,
[string]$DirectoryLocation = 'Sala de pruebas',
[string]$DirectoryOu = 'Laboratorio'
)
# Replace only the external directory lookup. Execute the actual script,
# including its validated parameters, metadata assignment and JPEG renderer.
$fixtureJson = [pscustomobject]@{
DisplayName = 'Usuario de prueba'
Gender = $DirectoryGender
Location = 'Sala de pruebas'
OrganizationalUnit = 'Laboratorio'
Location = $DirectoryLocation
OrganizationalUnit = $DirectoryOu
} | ConvertTo-Json -Compress
$fixtureFunction = 'function Get-DirectoryWelcomeMetadata { param($UserName, $MachineName); ConvertFrom-Json ''' +
$fixtureJson.Replace("'", "''") + ''' }'
@@ -69,4 +74,11 @@ Describe 'Welcome wallpaper with AD metadata' {
It 'honors an explicit gender over directory metadata' {
(Invoke-WelcomeFixture -DirectoryGender 'Female' -ExplicitGender 'Male').WelcomeHeading | Should Be 'Bienvenido,'
}
It 'renders the flexible classroom and immediate OU as an access label' {
$result = Invoke-WelcomeFixture -DirectoryGender $null `
-DirectoryLocation 'Aula Flexible' `
-DirectoryOu 'Centro de Experiencia Digital'
$result.LocationText | Should Be 'Acceso al Aula Flexible del Centro de Experiencia Digital.'
}
}