Skip to content

Commit

Permalink
EV-318: Added translations in english
Browse files Browse the repository at this point in the history
  • Loading branch information
cableman committed Nov 23, 2023
1 parent e06b2d6 commit 8af1c86
Show file tree
Hide file tree
Showing 16 changed files with 894 additions and 72 deletions.
9 changes: 8 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"doctrine/doctrine-bundle": "^2.10",
"doctrine/doctrine-migrations-bundle": "^3.2",
"doctrine/orm": "^2.15",
"elasticsearch/elasticsearch": "^8.10",
"easycorp/easyadmin-bundle": "^4.8",
"elasticsearch/elasticsearch": "^8.10",
"guzzlehttp/guzzle": "^7.7",
"liip/imagine-bundle": "^2.11",
"nelmio/cors-bundle": "^2.3",
Expand Down Expand Up @@ -105,6 +105,13 @@
"coding-standards-check": [
"PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --dry-run"
],
"translations-update": [
"# We need a translation from en to en (!) (without prefix) to be able to process placeholders in en.",
"DEFAULT_LOCALE=en bin/console translation:extract --clean --force en --prefix=''",
"DEFAULT_LOCALE=en bin/console translation:extract --clean --force da",
"# Mark default translations (prefixed with `__`) as “Needs work” in Danish translations",
"sed --in-place='' 's/<target>__/<target state=\"needs-l10n\">__/' translations/*.da.*xlf"
],
"psalm": [
"./vendor/bin/psalm --no-cache"
],
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 20 additions & 10 deletions src/Controller/Admin/AddressCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use EasyCorp\Bundle\EasyAdminBundle\Field\IdField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Symfony\Component\Translation\TranslatableMessage;

class AddressCrudController extends AbstractCrudController
{
Expand All @@ -28,31 +29,40 @@ public function configureFields(string $pageName): iterable
{
return [
IdField::new('id')
->setLabel(new TranslatableMessage('admin.address.id'))
->setDisabled()
->hideWhenCreating(),

FormField::addFieldset('Address'),
TextField::new('street'),
TextField::new('suite'),
TextField::new('region'),
TextField::new('city'),
TextField::new('country'),
TextField::new('postalCode'),
FormField::addFieldset(new TranslatableMessage('admin.address.headline')),
TextField::new('street')
->setLabel(new TranslatableMessage('admin.address.street')),
TextField::new('suite')
->setLabel(new TranslatableMessage('admin.address.suite')),
TextField::new('city')
->setLabel(new TranslatableMessage('admin.address.city')),
TextField::new('postalCode')
->setLabel(new TranslatableMessage('admin.address.postalCode')),
TextField::new('country')
->setLabel(new TranslatableMessage('admin.address.country')),
TextField::new('region')
->setLabel(new TranslatableMessage('admin.address.region')),

FormField::addFieldset('Geo location'),
FormField::addFieldset(new TranslatableMessage('admin.address.location.headline')),
NumberField::new('latitude')
->setLabel(new TranslatableMessage('admin.address.location.latitude'))
->setNumDecimals(8)
->setColumns(2)
->hideOnIndex(),
NumberField::new('longitude')
->setLabel(new TranslatableMessage('admin.address.location.longitude'))
->setNumDecimals(8)
->setColumns(2)
->hideOnIndex(),

FormField::addFieldset('Edited')
FormField::addFieldset(new TranslatableMessage('admin.address.edited.headline'))
->hideWhenCreating(),
DateTimeField::new('updated_at')
->setLabel('Last updated')
->setLabel(new TranslatableMessage('admin.address.edited.updated'))
->setDisabled()
->hideWhenCreating()
->setFormat(DashboardController::DATETIME_FORMAT),
Expand Down
20 changes: 10 additions & 10 deletions src/Controller/Admin/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Translation\TranslatableMessage;

class DashboardController extends AbstractDashboardController
{
Expand All @@ -41,15 +42,14 @@ public function configureDashboard(): Dashboard

public function configureMenuItems(): iterable
{
yield MenuItem::linkToDashboard('Dashboard', 'fa fa-home');
yield MenuItem::linkToCrud('Events', 'fa fa-calendar', Event::class);
yield MenuItem::linkToCrud('Occurrences', 'fa fa-repeat', Occurrence::class);
yield MenuItem::linkToCrud('Location', 'fa fa-location-dot', Location::class);
yield MenuItem::linkToCrud('Address', 'fa fa-address-book', Address::class);
yield MenuItem::linkToCrud('Image', 'fa fa-image', Image::class);
yield MenuItem::linkToCrud('Feeds', 'fa fa-rss', Feed::class);
yield MenuItem::linkToCrud('Tags', 'fa fa-tags', Tag::class);
yield MenuItem::linkToCrud('Organizer', 'fa fa-sitemap', Organization::class);
yield MenuItem::linkToCrud('Users', 'fa fa-user', User::class);
yield MenuItem::linkToCrud(new TranslatableMessage('admin.link.events'), 'fa fa-calendar', Event::class);
yield MenuItem::linkToCrud(new TranslatableMessage('admin.link.occurrences'), 'fa fa-repeat', Occurrence::class);
yield MenuItem::linkToCrud(new TranslatableMessage('admin.link.location'), 'fa fa-location-dot', Location::class);
yield MenuItem::linkToCrud(new TranslatableMessage('admin.link.address'), 'fa fa-address-book', Address::class);
yield MenuItem::linkToCrud(new TranslatableMessage('admin.link.image'), 'fa fa-image', Image::class);
yield MenuItem::linkToCrud(new TranslatableMessage('admin.link.feeds'), 'fa fa-rss', Feed::class);
yield MenuItem::linkToCrud(new TranslatableMessage('admin.link.tags'), 'fa fa-tags', Tag::class);
yield MenuItem::linkToCrud(new TranslatableMessage('admin.link.organizer'), 'fa fa-sitemap', Organization::class);
yield MenuItem::linkToCrud(new TranslatableMessage('admin.link.users'), 'fa fa-user', User::class);
}
}
32 changes: 23 additions & 9 deletions src/Controller/Admin/EventCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use EasyCorp\Bundle\EasyAdminBundle\Field\UrlField;
use Symfony\Component\Translation\TranslatableMessage;

class EventCrudController extends AbstractCrudController
{
Expand All @@ -30,29 +31,42 @@ public function configureFields(string $pageName): iterable
{
return [
IdField::new('id')
->setLabel(new TranslatableMessage('admin.event.id'))
->setDisabled()
->hideWhenCreating(),

FormField::addFieldset('Basic information'),
TextField::new('title'),
FormField::addFieldset('Basic information')
->setLabel(new TranslatableMessage('admin.event.basic.headline')),
TextField::new('title')
->setLabel(new TranslatableMessage('admin.event.basic.title')),
TextEditorField::new('excerpt')
->setLabel(new TranslatableMessage('admin.event.basic.excerpt'))
->hideOnIndex(),
TextEditorField::new('description')
->setLabel(new TranslatableMessage('admin.event.basic.description'))
->hideOnIndex(),
AssociationField::new('image')
->setLabel(new TranslatableMessage('admin.event.basic.image'))
->hideOnIndex(),
AssociationField::new('tags')
->setLabel(new TranslatableMessage('admin.event.basic.tags'))
->hideOnIndex(),

FormField::addFieldset('Location information'),
UrlField::new('url'),
UrlField::new('ticketUrl'),
AssociationField::new('location'),
FormField::addFieldset('Location information')
->setLabel(new TranslatableMessage('admin.event.location.headline')),
UrlField::new('url')
->setLabel(new TranslatableMessage('admin.event.location.url')),
UrlField::new('ticketUrl')
->setLabel(new TranslatableMessage('admin.event.location.ticketUrl')),
AssociationField::new('location')
->setLabel(new TranslatableMessage('admin.event.location.location')),

FormField::addFieldset('Edited'),
AssociationField::new('organization'),
FormField::addFieldset('Edited')
->setLabel(new TranslatableMessage('admin.event.edited.headline')),
AssociationField::new('organization')
->setLabel(new TranslatableMessage('admin.event.edited.organization')),
DateTimeField::new('updated_at')
->setLabel('Last updated')
->setLabel(new TranslatableMessage('admin.event.edited.updated'))
->setDisabled()
->hideWhenCreating()
->setFormat(DashboardController::DATETIME_FORMAT),
Expand Down
12 changes: 8 additions & 4 deletions src/Controller/Admin/FeedCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
use EasyCorp\Bundle\EasyAdminBundle\Field\IdField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Symfony\Component\Translation\TranslatableMessage;

class FeedCrudController extends AbstractCrudController
{
Expand All @@ -21,24 +22,27 @@ public function configureFields(string $pageName): iterable
{
return [
IdField::new('id')
->setLabel(new TranslatableMessage('admin.feed.id'))
->setDisabled()
->hideWhenCreating(),

TextField::new('name'),
TextField::new('name')
->setLabel(new TranslatableMessage('admin.feed.name')),
CodeEditorField::new('configurationField')
->setLabel(new TranslatableMessage('admin.feed.configuration'))
->setLanguage('js')
->hideOnIndex(),

FormField::addFieldset('Edited')
FormField::addFieldset(new TranslatableMessage('admin.feed.edited.headline'))
->hideWhenCreating(),
DateTimeField::new('last_read')
->setLabel('Last parsed')
->setLabel(new TranslatableMessage('admin.feed.edited.last_read'))
->setDisabled()
->hideWhenCreating()
->setFormat(DashboardController::DATETIME_FORMAT),

DateTimeField::new('updated_at')
->setLabel('Last updated')
->setLabel(new TranslatableMessage('admin.feed.edited.update'))
->setDisabled()
->hideWhenCreating()
->setFormat(DashboardController::DATETIME_FORMAT),
Expand Down
13 changes: 10 additions & 3 deletions src/Controller/Admin/ImageCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use EasyCorp\Bundle\EasyAdminBundle\Field\IdField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use EasyCorp\Bundle\EasyAdminBundle\Field\UrlField;
use Symfony\Component\Translation\TranslatableMessage;

class ImageCrudController extends AbstractCrudController
{
Expand All @@ -21,18 +22,24 @@ public function configureFields(string $pageName): iterable
{
return [
IdField::new('id')
->setLabel(new TranslatableMessage('admin.image.id'))
->setDisabled()
->hideWhenCreating(),

TextField::new('title'),
UrlField::new('source'),
TextField::new('title')
->setLabel(new TranslatableMessage('admin.image.title')),
UrlField::new('source')
->setLabel(new TranslatableMessage('admin.image.source')),

FormField::addFieldset('Edited')
->setLabel(new TranslatableMessage('admin.image.edited.headline'))
->hideWhenCreating(),
DateTimeField::new('updated_at')
->setLabel(new TranslatableMessage('admin.image.edited.update'))
->setLabel('Last updated')
->setDisabled()
->hideWhenCreating()
->setFormat(DashboardController::DATETIME_FORMAT), ];
->setFormat(DashboardController::DATETIME_FORMAT),
];
}
}
27 changes: 19 additions & 8 deletions src/Controller/Admin/LocationCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use EasyCorp\Bundle\EasyAdminBundle\Field\TelephoneField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use EasyCorp\Bundle\EasyAdminBundle\Field\UrlField;
use Symfony\Component\Translation\TranslatableMessage;

class LocationCrudController extends AbstractCrudController
{
Expand All @@ -32,27 +33,37 @@ public function configureFields(string $pageName): iterable
{
return [
IdField::new('id')
->setLabel(new TranslatableMessage('admin.location.id'))
->setDisabled()
->hideWhenCreating(),

FormField::addFieldset('Basic information'),
TextField::new('name'),
FormField::addFieldset('Basic information')
->setLabel(new TranslatableMessage('admin.location.basic.headline')),
TextField::new('name')
->setLabel(new TranslatableMessage('admin.location.basic.name')),
AssociationField::new('address')
->setLabel(new TranslatableMessage('admin.location.basic.headline'))
->hideOnIndex(),

FormField::addFieldset('Enriched information'),
UrlField::new('url'),
EmailField::new('mail'),
FormField::addFieldset('Enriched information')
->setLabel(new TranslatableMessage('admin.location.enriched.headline')),
UrlField::new('url')
->setLabel(new TranslatableMessage('admin.location.enriched.url')),
EmailField::new('mail')
->setLabel(new TranslatableMessage('admin.location.enriched.mail')),
UrlField::new('image')
->setLabel(new TranslatableMessage('admin.location.enriched.image'))
->hideOnIndex(),
TelephoneField::new('telephone')
->setLabel(new TranslatableMessage('admin.location.enriched.telephone'))
->hideOnIndex(),
BooleanField::new('disabilityAccess'),
BooleanField::new('disabilityAccess')
->setLabel(new TranslatableMessage('admin.location.enriched.disability-access')),

FormField::addFieldset('Edited')
FormField::addFieldset(new TranslatableMessage('admin.location.edited.headline'))
->hideWhenCreating(),
DateTimeField::new('updated_at')
->setLabel('Last updated')
->setLabel(new TranslatableMessage('admin.location.edited.updated'))
->setDisabled()
->hideWhenCreating()
->setFormat(DashboardController::DATETIME_FORMAT),
Expand Down
22 changes: 15 additions & 7 deletions src/Controller/Admin/OccurrenceCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
use EasyCorp\Bundle\EasyAdminBundle\Field\IdField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Symfony\Component\Translation\TranslatableMessage;

class OccurrenceCrudController extends AbstractCrudController
{
Expand All @@ -28,29 +29,36 @@ public function configureFields(string $pageName): iterable
{
return [
IdField::new('id')
->setLabel(new TranslatableMessage('admin.occurrence.id'))
->setDisabled()
->hideWhenCreating(),

AssociationField::new('event')
->setLabel('Link to event')
->setLabel(new TranslatableMessage('admin.occurrence.event-link'))
->autocomplete(),

FormField::addFieldset('Dates'),
FormField::addFieldset('Dates')
->setLabel(new TranslatableMessage('admin.occurrence.dates.headline')),
DateTimeField::new('start')
->setLabel(new TranslatableMessage('admin.occurrence.dates.start'))
->setColumns(2)
->setLabel('Start time'),
DateTimeField::new('end')
->setLabel(new TranslatableMessage('admin.occurrence.dates.end'))
->setColumns(2)
->setLabel('End time'),

FormField::addFieldset('Basic information'),
TextField::new('ticketPriceRange'),
TextField::new('room'),
FormField::addFieldset('Basic information')
->setLabel(new TranslatableMessage('admin.occurrence.basic.headline')),
TextField::new('ticketPriceRange')
->setLabel(new TranslatableMessage('admin.occurrence.basic.price')),
TextField::new('room')
->setLabel(new TranslatableMessage('admin.occurrence.basic.room')),

FormField::addFieldset('Edited')
FormField::addFieldset(new TranslatableMessage('admin.occurrence.edited.headline'))
->hideWhenCreating(),
DateTimeField::new('updated_at')
->setLabel('Last updated')
->setLabel(new TranslatableMessage('admin.occurrence.edited.updated'))
->setDisabled()
->hideWhenCreating()
->setFormat(DashboardController::DATETIME_FORMAT),
Expand Down
Loading

0 comments on commit 8af1c86

Please sign in to comment.