Skip to content

Commit

Permalink
fix routing of actions, break routing of events
Browse files Browse the repository at this point in the history
  • Loading branch information
vanekm committed Aug 23, 2024
1 parent 42a96d3 commit 10a0337
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
17 changes: 16 additions & 1 deletion app/RouterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ private static function useTranslateFilter(?array $domainList, array $routerMapp
$params['presenter'] = $routerMapping[$params['lang']][$params['presenter']];
}

// Translate action
if (
isset($routerMapping['actions'][$params['lang']]) &&
isset($routerMapping['actions'][$params['lang']][$params['action']])
) {
$params['action'] = $routerMapping['actions'][$params['lang']][$params['action']];
}

return $params;
},

Expand All @@ -97,6 +105,14 @@ private static function useTranslateFilter(?array $domainList, array $routerMapp
}
}

// Translate action
if (isset($routerMapping['actions'][$params['lang']])) {
$key = array_search($params['action'], $routerMapping['actions'][$params['lang']]);
if ($key !== false) {
$params['action'] = $key;
}
}

// Either set the language in the domain, or in lang parameter
if (isset($domainList) && count($domainList)) {
$params['domain'] = array_search($params['lang'], $domainList);
Expand Down Expand Up @@ -187,7 +203,6 @@ public static function createFykosRouter(?array $domainList, array $routerMappin
{
$router = new RouteList();


$router->addRoute('//<domain>/<lang results|poradi>[/<year ([0-9]{1,2})>]', [
'module' => 'Default',
'presenter' => 'Results',
Expand Down
21 changes: 12 additions & 9 deletions app/config/fykos-router-mapping.neon
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@ parameters:
Default: Default
ONas: About
Pravidla: Rules
Organizatori: Organizers
Historie: History
Kontakt: Contact
Zadani: Problems
ArchivUloh: ProblemsArchive
actions:
cs:
historie: history
organizatori: organizers
kontakt: contact
events:
cs:
Default: Default
Akce: Events
Experimenty: Experiments
Pravidla: Rules
jakPsat: TexTutorial

Soustredeni: Camps
actions:
cs:
pravidla: rules
jakPsat: texTutorial
experimenty: experiments
cena: price

0 comments on commit 10a0337

Please sign in to comment.