From ce94e0cdeebb73509637c065342637fa12fa5234 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 29 Apr 2017 01:23:36 +0200 Subject: [PATCH] Add translation messages --- app/Resources/assets/style/main.scss | 11 ++++++++++ app/Resources/translations/menu.en.yml | 0 app/Resources/translations/messages.en.yml | 21 +++++++++++++++++++ .../views/brickset/instructions.html.twig | 5 ++--- .../views/brickset/reviews.html.twig | 8 +++++-- app/Resources/views/macros/blocks.html.twig | 6 +++--- app/Resources/views/model/index.html.twig | 17 ++++++--------- app/Resources/views/set/tabs/models.html.twig | 12 +++++++---- app/config/config.yml | 21 +++++++++---------- app/config/service/loader.yml | 4 ++-- src/AppBundle/Controller/SetController.php | 2 -- 11 files changed, 69 insertions(+), 38 deletions(-) create mode 100644 app/Resources/translations/menu.en.yml create mode 100644 app/Resources/translations/messages.en.yml diff --git a/app/Resources/assets/style/main.scss b/app/Resources/assets/style/main.scss index 8477e93..bd989c4 100644 --- a/app/Resources/assets/style/main.scss +++ b/app/Resources/assets/style/main.scss @@ -44,4 +44,15 @@ background-size: cover; } +} + +@each $i in 5 10 15 20 25 30 40 50 60 { + .ui.spacing.#{$i} { + margin-bottom: #{$i}px; + margin-top: #{$i}px; + } +} + +.ui.text.right { + text-align: right; } \ No newline at end of file diff --git a/app/Resources/translations/menu.en.yml b/app/Resources/translations/menu.en.yml new file mode 100644 index 0000000..e69de29 diff --git a/app/Resources/translations/messages.en.yml b/app/Resources/translations/messages.en.yml new file mode 100644 index 0000000..4928af7 --- /dev/null +++ b/app/Resources/translations/messages.en.yml @@ -0,0 +1,21 @@ +set: + number: Set number + name: Name + year: Year released + theme: Theme + parts: Count of parts + minifigs: Minifig count + rating: Rating + download: Download + models: + text: | + This set inventory has been obtained from Rebrickable. + According to the Brickset, this set has %brickset% parts. The inventory from Rebrickable contains %rebrickable% parts. + instructions: + description: Description + filesize: Filesize + filename: Filename + text: | + The table below lists all instructions for this set that have been available at LEGO Customer Services. Those that are no longer listed there may still be available to download. + + 'NA' or 'V39' indicates the US/Canadian version. 'IN' or 'V29' indicates the international version. diff --git a/app/Resources/views/brickset/instructions.html.twig b/app/Resources/views/brickset/instructions.html.twig index 20fd05c..639168b 100644 --- a/app/Resources/views/brickset/instructions.html.twig +++ b/app/Resources/views/brickset/instructions.html.twig @@ -2,9 +2,8 @@ {% block content %} {% if instructions|length != 0 %} -

- {{ 'set.instructions.text' | trans }} -

+

{{ 'set.instructions.text' | trans | raw | nl2br }}

+

Text and data obtained from Brickset

diff --git a/app/Resources/views/brickset/reviews.html.twig b/app/Resources/views/brickset/reviews.html.twig index efdc0c8..252101f 100644 --- a/app/Resources/views/brickset/reviews.html.twig +++ b/app/Resources/views/brickset/reviews.html.twig @@ -12,13 +12,17 @@

{{ review.title }}

- {{ review.author }} {{ review.hTML }} + {{ review.author }}
{{ review.datePosted|date("Y.m.d H:m:i")}}
- {{ review.review|raw }} + {% if review.hTML %} + {{ review.review|raw }} + {% else %} +

{{ review.review }}

+ {% endif %}
Overall rating
diff --git a/app/Resources/views/macros/blocks.html.twig b/app/Resources/views/macros/blocks.html.twig index 7f50f4b..1374d42 100644 --- a/app/Resources/views/macros/blocks.html.twig +++ b/app/Resources/views/macros/blocks.html.twig @@ -1,6 +1,6 @@ {% macro modelImageMin(model, color) %}
- +
{% endmacro %} @@ -10,13 +10,13 @@
{% endmacro %} -{% macro model(model, quantity) %} +{% macro model(model, quantity = null) %}
diff --git a/app/Resources/views/model/index.html.twig b/app/Resources/views/model/index.html.twig index 183dcc8..d42f494 100644 --- a/app/Resources/views/model/index.html.twig +++ b/app/Resources/views/model/index.html.twig @@ -23,17 +23,12 @@
-
- {% for model in models %} - - {% endfor %} +
+
+ {% for model in models %} + {{ blocks.model(model) }} + {% endfor %} +
{{ knp_pagination_render(models) }} diff --git a/app/Resources/views/set/tabs/models.html.twig b/app/Resources/views/set/tabs/models.html.twig index 07a3c8c..9ad9408 100644 --- a/app/Resources/views/set/tabs/models.html.twig +++ b/app/Resources/views/set/tabs/models.html.twig @@ -1,15 +1,19 @@ {% extends 'ajax.html.twig' %} {% block content %} +

{{ 'set.models.text' | trans | nl2br }}

+ {% if models|length > 0 %}

Regular parts

-
- {% for model in models %} - {{ blocks.model(model['model'],model['quantity']) }} - {% endfor %} +
+
+ {% for model in models %} + {{ blocks.model(model['model'],model['quantity']) }} + {% endfor %} +
{% endif %} diff --git a/app/config/config.yml b/app/config/config.yml index 0176d01..906d45c 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -8,8 +8,8 @@ imports: parameters: locale: en # rebrickable csv files root URL (http://rebrickable.com/media/downloads/ or local dir containing csv files) - rebrickable_downloads_url: 'http://rebrickable.com/media/downloads/' - media_root: "%kernel.root_dir%/../var/media/" + app.rebrickable_downloads_url: 'http://rebrickable.com/media/downloads/' + app.media_root: "%kernel.root_dir%/../var/media/" framework: #esi: ~ @@ -104,20 +104,20 @@ knp_paginator: sort_direction_name: direction # sort direction query parameter name distinct: true # ensure distinct results, useful when ORM queries are using GROUP BY statements template: - pagination: KnpPaginatorBundle:Pagination:semantic_ui_pagination.html.twig # sliding pagination controls template + pagination: :pagination:knp_pagination.html.twig sortable: KnpPaginatorBundle:Pagination:sortable_link.html.twig # sort link template liip_imagine: loaders: media: - flysystem: - filesystem_service: oneup_flysystem.media_filesystem + flysystem: + filesystem_service: oneup_flysystem.media_filesystem rebrickable: - stream: - wrapper: 'http://rebrickable.com/media/' + stream: + wrapper: 'http://rebrickable.com/media/' brickset: - stream: - wrapper: 'https://images.brickset.com/' + stream: + wrapper: 'https://images.brickset.com/' resolvers: @@ -131,7 +131,6 @@ liip_imagine: data_loader: media cache: ~ quality: 80 - default_image: '/resources/images/unknown_image.png' filters: thumbnail: { size: [200, 200], mode: inset } background: { size: [250, 250], position: center, color: '#FFFFFF' } @@ -174,7 +173,7 @@ oneup_flysystem: adapters: media: local: - directory: "%media_root%" + directory: "%app.media_root%" filesystems: media: adapter: media \ No newline at end of file diff --git a/app/config/service/loader.yml b/app/config/service/loader.yml index 9bd585d..f3b4a5b 100644 --- a/app/config/service/loader.yml +++ b/app/config/service/loader.yml @@ -7,7 +7,7 @@ services: service.loader.rebrickable: class: AppBundle\Service\Loader\RebrickableLoader - arguments: ['%rebrickable_downloads_url%'] + arguments: ['%app.rebrickable_downloads_url%'] parent: service.loader.base service.loader.model: @@ -22,5 +22,5 @@ services: service.loader.image: class: AppBundle\Service\Loader\ImageLoader - arguments: ['@oneup_flysystem.media_filesystem', '%rebrickable_downloads_url%','@service.renderer.stl'] + arguments: ['@oneup_flysystem.media_filesystem', '%app.rebrickable_downloads_url%','@service.renderer.stl'] parent: service.loader.base \ No newline at end of file diff --git a/src/AppBundle/Controller/SetController.php b/src/AppBundle/Controller/SetController.php index 061ffeb..b581a47 100644 --- a/src/AppBundle/Controller/SetController.php +++ b/src/AppBundle/Controller/SetController.php @@ -59,8 +59,6 @@ class SetController extends Controller try { $bricksetSet = $this->get('api.manager.brickset')->getSetByNumber($set->getNumber()); - } catch (EmptyResponseException $e) { - $this->addFlash('warning', 'Set not found in Brickset database'); } catch (ApiException $e) { $this->addFlash('error', $e->getService()); } catch (\Exception $e) {