Skip to content

Commit

Permalink
ensure an environment locale is set
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnRDOrazio committed Nov 8, 2024
1 parent 8b27307 commit 6d042f7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion php/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@
define("METADATA_URL", "https://litcal.johnromanodorazio.com/api/{$endpointV}/calendars");
$directAccess = (basename(__FILE__) === basename($_SERVER['SCRIPT_FILENAME']));

$baseLocale = Locale::getPrimaryLanguage(setlocale(LC_ALL, 0) ?? 'en-US');
$envLocale = setlocale(LC_TIME, 0);
if (null === $envLocale || 'C' === $envLocale) {
setlocale(LC_ALL, 'en_US.UTF-8');
$envLocale = setlocale(LC_ALL, 0);
}

$baseLocale = Locale::getPrimaryLanguage($envLocale);

$calendarSelectNations = new CalendarSelect();
$calendarSelectNations->label(true)->labelText('nation')->labelClass('d-block mb-1')
Expand Down

0 comments on commit 6d042f7

Please sign in to comment.