refactor: use english for routes, parameters and internal messages

This commit is contained in:
fromme committed 2026-09-13 18:58:24 +02:00
1 parent bce8f58be3
commit a88ff7ff24
22 files changed
+106 -135

No files matched your search

+5 -24
View File
@@ -8,13 +8,14 @@ namespace App\Entity;
* The kinds of thing that can be booked.
*
* **This enum is the extension point.** The dashboard builds one tile per case, the board route
* accepts one slug per case, and the floor plan is looked up by convention from the case's
* value. Adding a third bookable kind is therefore: a case here, a
* accepts one backing value per case, and the floor plan is looked up by convention from that
* same value. Adding a third bookable kind is therefore: a case here, a
* `templates/board/plan/_<value>.html.twig` with its geometry, and rows in `app:seed`. Nothing
* else needs editing — in particular no template lists the kinds by hand.
*
* The backing values are persisted in `resource.type`, which is why they stay English while the
* URLs do not: `slug()` is what appears in a path, so the routes read German like the rest.
* The backing value is both what is persisted in `resource.type` and what appears in a URL, so
* there is no slug mapping to keep in sync. The label, plural and description are the only
* things here anyone sees, which is why they are the only German ones.
*/
enum ResourceType: string
{
@@ -52,24 +53,4 @@ enum ResourceType: string
self::PARKING => 'lucide:car',
};
}
/** What appears in a URL. */
public function slug(): string
{
return match ($this) {
self::DESK => 'schreibtische',
self::PARKING => 'parkplaetze',
};
}
public static function fromSlug(string $slug): self
{
foreach (self::cases() as $case) {
if ($case->slug() === $slug) {
return $case;
}
}
throw new \ValueError(\sprintf('"%s" ist kein bekannter Buchungsbereich.', $slug));
}
}