Add plugin system and improve language handling
Add global and page-level plugin support Implement language-aware content filtering Add month translations to language files Refactor date formatting to use translations Move translation loading to plugin system Improve content availability checks
This commit is contained in:
parent
875408a27c
commit
24ee209e17
9 changed files with 196 additions and 30 deletions
|
|
@ -32,20 +32,11 @@ function extractTitle(string $filePath, string $lang, string $defaultLang): ?str
|
|||
return null;
|
||||
}
|
||||
|
||||
function formatNorwegianDate(string $dateString): string {
|
||||
if (preg_match('/^(\d{4})-(\d{2})-(\d{2})/', $dateString, $matches)) {
|
||||
$months = ['januar', 'februar', 'mars', 'april', 'mai', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'desember'];
|
||||
$day = (int)$matches[3];
|
||||
$month = $months[(int)$matches[2] - 1];
|
||||
$year = $matches[1];
|
||||
return "$day. $month $year";
|
||||
}
|
||||
return $dateString;
|
||||
}
|
||||
|
||||
function extractDateFromFolder(string $folderName): ?string {
|
||||
|
||||
function extractDateFromFolder(string $folderName, string $lang): ?string {
|
||||
if (preg_match('/^(\d{4})-(\d{2})-(\d{2})-/', $folderName, $matches)) {
|
||||
return formatNorwegianDate($matches[1] . '-' . $matches[2] . '-' . $matches[3]);
|
||||
return formatDate($matches[1] . '-' . $matches[2] . '-' . $matches[3], $lang);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue