From fb9c7f8eecc30f5e20d394e500a6ab73d15dda48 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Thu, 21 Jul 2016 16:54:00 +0200 Subject: [PATCH] Used twig extension to load translations on twig templates --- module/Core/config/translator.config.php | 14 +++++++ module/Core/lang/es.mo | Bin 0 -> 1036 bytes module/Core/lang/es.po | 35 ++++++++++++++++++ .../Core/templates/core/error/404.html.twig | 8 ++-- .../Core/templates/core/error/error.html.twig | 8 ++-- 5 files changed, 57 insertions(+), 8 deletions(-) create mode 100644 module/Core/config/translator.config.php create mode 100644 module/Core/lang/es.mo create mode 100644 module/Core/lang/es.po diff --git a/module/Core/config/translator.config.php b/module/Core/config/translator.config.php new file mode 100644 index 00000000..ae120db3 --- /dev/null +++ b/module/Core/config/translator.config.php @@ -0,0 +1,14 @@ + [ + 'translation_file_patterns' => [ + [ + 'type' => 'gettext', + 'base_dir' => __DIR__ . '/../lang', + 'pattern' => '%s.mo', + ], + ], + ], + +]; diff --git a/module/Core/lang/es.mo b/module/Core/lang/es.mo new file mode 100644 index 0000000000000000000000000000000000000000..d34bb83b2b79815b5e36833dd99a0c223c0b994a GIT binary patch literal 1036 zcmZuw!A=xG5N#DTS>r*@YKnsqBQx%7B9PhaL2*%Vkqs>9#h7NM*cqAa-gNhXB>sjU zzzq*3Cf+={U*W|c@Zib2uV)ZAP??w4JzaTKQ~l=G^wcMTxCYz?dcY0fBjDp0=mMXC ztH2*%7WfO?1nyoE;tqHYJbhV+Rq!hIZ?6b(9efP-`Cq}ez(2tR{tZTIRTorgd-gE} zK&lF))v+e`m~3g74s}VnN{TY&lw?tm%b1c(8ksmYc8(5mmyy!MADodiE>+@6>2j?? zv98BQ25hV+R?HuRVrRHu}ZK+8DE<2 zS^uyx+JvHS^m|TRu#yJbXanV9+RTbv?NJmq8~yb`uw=OEBX}kq$JA;@^FebVXhjsw z$B&y2o2{l#3^sT__W~E^MRi_JS{DqARJM>#o0u9ssfMK-axh>yI=7FB?Yr(~V{K)v zd)Aw8YDwc;6l4y^=*MATkH&?}RlAy}W!KpnEC-8cdA{5(o1lw1q`4Z#w78SI#+%?d zD>ii>ea&g^@X?FmLKxw!ei1yCmdDa%F@<5HUzA1`!Ll|Z81sa|$w70q-g zdeA--*wm#-cnLR+&SI)tJC%RQhX>lEwwGHR;^wQtaQkG%b;bW%$M5Pw=j2(MB @@ -10,8 +10,8 @@ {% endblock %} {% block content %} -

Oops!

+

{{ translate('Oops!') }}


-

This short URL doesn't seem to be valid.

-

Make sure you included all the characters, with no extra punctuation.

+

{{ translate('This short URL doesn\'t seem to be valid.') }}

+

{{ translate('Make sure you included all the characters, with no extra punctuation.') }}

{% endblock %} diff --git a/module/Core/templates/core/error/error.html.twig b/module/Core/templates/core/error/error.html.twig index c93b3b7e..7426a33a 100644 --- a/module/Core/templates/core/error/error.html.twig +++ b/module/Core/templates/core/error/error.html.twig @@ -10,11 +10,11 @@ {% endblock %} {% block content %} -

Oops!

+

{{ translate('Oops!') }}


-

We encountered a {{ status }} {{ reason }} error.

+

{{ translate('We encountered a %s %s error.') | format(status, reason) }}

{% if status == 404 %} -

This short URL doesn't seem to be valid.

-

Make sure you included all the characters, with no extra punctuation.

+

{{ translate('This short URL doesn\'t seem to be valid.') }}

+

{{ translate('Make sure you included all the characters, with no extra punctuation.') }}

{% endif %} {% endblock %}