Skip to content

Commit

Permalink
manually fix some strings
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnRDOrazio committed Dec 9, 2024
1 parent 9378b8d commit 44c925a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/LiturgyOfTheDay.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,14 @@ class LiturgyOfTheDay
private array $LitCalData = [];
private array $LitCalFeed = [];
private \IntlDateFormatter $monthDayFmt;
private const MANUAL_FIXES = [
'it' => [
'/SOLENNITÀ di Immacolata Concezione/' => "SOLENNITÀ dell'Immacolata Concezione",
],
];
private const PHONETIC_PRONUNCATION_MAPPING = [
'/Blessed /' => '<phoneme alphabet="ipa" ph="ˈblɛsɪd">Blessed</phoneme> ',
'/Antiochia/' => '<phoneme alphabet="ipa" ph="ɑntɪˈokiɑ">Antiochia</phoneme>',
'/Antiochia/' => '<phoneme alphabet="ipa" ph="ɑntɪˈokiɑ">Antiochia</phoneme>',
];
private const ROMAN_NUMERAL_PATTERN_1_34 = '/^(I|II|III|IV|V|VI|VII|VIII|IX|X|XI|XII|XIII|XIV|XV|XVI|XVII|XVIII|XIX|XX|XXI|XXII|XXIII|XXIV|XXV|XXVI|XXVII|XXVIII|XXIX|XXX|XXXI|XXXII|XXXIII|XXXIV) /';
private const ROMAN_TO_ARABIC_MAPPING = [
Expand Down Expand Up @@ -566,6 +571,11 @@ private function prepareMainText(Festivity $festivity, int $idx): array
}

$mainText = preg_replace('/ +/', ' ', $mainText);
if (array_key_exists($this->baseLocale, LiturgyOfTheDay::MANUAL_FIXES)) {
foreach( LiturgyOfTheDay::MANUAL_FIXES[$this->baseLocale] as $pattern => $replacement ) {
$mainText = preg_replace($pattern, $replacement, $mainText);
}
}

// Create the <speak> root element
$speak = new \SimpleXMLElement('<speak></speak>');
Expand Down Expand Up @@ -661,7 +671,7 @@ private function sendResponse()
} elseif (count($this->LitCalFeed) > 1) {
echo json_encode($this->LitCalFeed);
} else {
die("Missing data from response: LitCalFeed seems to by empty or null? " . count($this->LitCalFeed));
die("Missing data from response: LitCalFeed seems to be empty or null? " . count($this->LitCalFeed));
}
}

Expand Down

0 comments on commit 44c925a

Please sign in to comment.