Skip to content

Commit

Permalink
feature #15 Translation of main backend messages EN+FR (Pierstoval)
Browse files Browse the repository at this point in the history
This PR was squashed before being merged into the master branch (closes #15).

Discussion
----------

Translation of main backend messages EN+FR

Reference issue #3
Added the `trans` and `transchoice` filter wherever needed.
Added XLIFF translation files for English and French locales

Commits
-------

b3caa7c Translation of main backend messages EN+FR
  • Loading branch information
javiereguiluz committed Jan 18, 2015
2 parents 8eaf830 + b3caa7c commit 26a6216
Show file tree
Hide file tree
Showing 9 changed files with 208 additions and 27 deletions.
87 changes: 87 additions & 0 deletions Resources/translations/EasyAdminBundle.en.xlf
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
<file source-language="fr-FR" target-language="en" datatype="plaintext" original="file.ext">
<body>
<trans-unit id="5906974714c4ef24e85f512fdfd9f2e0" resname="header.close">
<source>header.close</source>
<target>Close</target>
</trans-unit>
<trans-unit id="3ac3d3d6ba7ba9dc06b4fa7bc7c9c9e8" resname="entity.create">
<source>entity.create</source>
<target>Create new %entity%</target>
</trans-unit>
<trans-unit id="bd1de21ff527f453d8eaafb308ec7f63" resname="list.actions">
<source>list.actions</source>
<target>Actions</target>
</trans-unit>
<trans-unit id="9d0784601d1d4ace8d20d57d5e332be8" resname="list.no_results">
<source>list.no_results</source>
<target>No results found.</target>
</trans-unit>
<trans-unit id="f5655c6df0dc76f572fbd9715b92e276" resname="entity.edit">
<source>entity.edit</source>
<target>Edit</target>
</trans-unit>
<trans-unit id="55078ca599d1c4ccb63c668afe116037" resname="entity.delete">
<source>entity.delete</source>
<target>Delete</target>
</trans-unit>
<trans-unit id="6984ed60a4b8ea3882d2461a39455cf9" resname="link.back_to_listing">
<source>link.back_to_listing</source>
<target>Back to listing</target>
</trans-unit>
<trans-unit id="82b3c2bee99d549a45db5c689b1ca4b5" resname="entity.save_changes">
<source>entity.save_changes</source>
<target>Save changes</target>
</trans-unit>
<trans-unit id="f12944e08bb7fd8c83d1644e730e9e1a" resname="paginator.first">
<source>paginator.first</source>
<target>First</target>
</trans-unit>
<trans-unit id="745056fc6a34e33d3b1361e1c1b6bf58" resname="paginator.previous">
<source>paginator.previous</source>
<target>Previous</target>
</trans-unit>
<trans-unit id="5802b82004de30ea0be2856051ad8514" resname="paginator.next">
<source>paginator.next</source>
<target>Next</target>
</trans-unit>
<trans-unit id="ea70461466c734648ea6a19256dd9401" resname="paginator.last">
<source>paginator.last</source>
<target>Last</target>
</trans-unit>
<trans-unit id="f3981b88fce3abc19c9204ffd52fb874" resname="paginator.counter">
<source>paginator.counter</source>
<target><![CDATA[<strong>%start%</strong> - <strong>%end%</strong> of <strong>%results%</strong>]]></target>
</trans-unit>
<trans-unit id="74e499f962b95df3e668409e2fd4548f" resname="actions.list">
<source>actions.list</source>
<target>List</target>
</trans-unit>
<trans-unit id="4bc515b9f878829413c3b4c588ec7d47" resname="actions.edit">
<source>actions.edit</source>
<target>Edit</target>
</trans-unit>
<trans-unit id="b7371fe56637358b91cbb350a39c6c19" resname="actions.new">
<source>actions.new</source>
<target>New</target>
</trans-unit>
<trans-unit id="1993fe5e1a5cf62d9e95f6278122ec8b" resname="actions.show">
<source>actions.show</source>
<target>Show</target>
</trans-unit>
<trans-unit id="5ff6f4fb7ab3bcfc530854d8fa6ea623" resname="actions.search">
<source>actions.search</source>
<target>Search</target>
</trans-unit>
<trans-unit id="f5ee7da631b579bfedb09148635dfa52" resname="actions.delete">
<source>actions.delete</source>
<target>Delete</target>
</trans-unit>
<trans-unit id="81258756bbf8404446823a5bc9f961a8" resname="list.results_found">
<source>list.results_found</source>
<target><![CDATA[{1} <strong>1</strong> result found|]1,Inf] <strong>%count%</strong> results found]]></target>
</trans-unit>
</body>
</file>
</xliff>
87 changes: 87 additions & 0 deletions Resources/translations/EasyAdminBundle.fr.xlf
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
<file source-language="fr-FR" target-language="fr" datatype="plaintext" original="file.ext">
<body>
<trans-unit id="5906974714c4ef24e85f512fdfd9f2e0" resname="header.close">
<source>header.close</source>
<target>Fermer</target>
</trans-unit>
<trans-unit id="3ac3d3d6ba7ba9dc06b4fa7bc7c9c9e8" resname="entity.create">
<source>entity.create</source>
<target>Créer nouvel élément "%entity%"</target>
</trans-unit>
<trans-unit id="bd1de21ff527f453d8eaafb308ec7f63" resname="list.actions">
<source>list.actions</source>
<target>Actions</target>
</trans-unit>
<trans-unit id="4bc515b9f878829413c3b4c588ec7d47" resname="actions.edit">
<source>actions.edit</source>
<target>Éditer</target>
</trans-unit>
<trans-unit id="f12944e08bb7fd8c83d1644e730e9e1a" resname="paginator.first">
<source>paginator.first</source>
<target>Premier</target>
</trans-unit>
<trans-unit id="745056fc6a34e33d3b1361e1c1b6bf58" resname="paginator.previous">
<source>paginator.previous</source>
<target>Précédent</target>
</trans-unit>
<trans-unit id="5802b82004de30ea0be2856051ad8514" resname="paginator.next">
<source>paginator.next</source>
<target>Suivant</target>
</trans-unit>
<trans-unit id="ea70461466c734648ea6a19256dd9401" resname="paginator.last">
<source>paginator.last</source>
<target>Dernier</target>
</trans-unit>
<trans-unit id="f3981b88fce3abc19c9204ffd52fb874" resname="paginator.counter">
<source>paginator.counter</source>
<target><![CDATA[<strong>%start%</strong> - <strong>%end%</strong> sur <strong>%results%</strong>]]></target>
</trans-unit>
<trans-unit id="f5655c6df0dc76f572fbd9715b92e276" resname="entity.edit">
<source>entity.edit</source>
<target>Éditer</target>
</trans-unit>
<trans-unit id="82b3c2bee99d549a45db5c689b1ca4b5" resname="entity.save_changes">
<source>entity.save_changes</source>
<target>Sauvegarder les modifications</target>
</trans-unit>
<trans-unit id="55078ca599d1c4ccb63c668afe116037" resname="entity.delete">
<source>entity.delete</source>
<target>Supprimer</target>
</trans-unit>
<trans-unit id="6984ed60a4b8ea3882d2461a39455cf9" resname="link.back_to_listing">
<source>link.back_to_listing</source>
<target>Retour à la liste</target>
</trans-unit>
<trans-unit id="74e499f962b95df3e668409e2fd4548f" resname="actions.list">
<source>actions.list</source>
<target>Lister</target>
</trans-unit>
<trans-unit id="b7371fe56637358b91cbb350a39c6c19" resname="actions.new">
<source>actions.new</source>
<target>Créer</target>
</trans-unit>
<trans-unit id="1993fe5e1a5cf62d9e95f6278122ec8b" resname="actions.show">
<source>actions.show</source>
<target>Voir</target>
</trans-unit>
<trans-unit id="5ff6f4fb7ab3bcfc530854d8fa6ea623" resname="actions.search">
<source>actions.search</source>
<target>Rechercher</target>
</trans-unit>
<trans-unit id="f5ee7da631b579bfedb09148635dfa52" resname="actions.delete">
<source>actions.delete</source>
<target>Supprimer</target>
</trans-unit>
<trans-unit id="81258756bbf8404446823a5bc9f961a8" resname="list.results_found">
<source>list.results_found</source>
<target><![CDATA[{1} <strong>1</strong> résultat trouvé|]1,Inf] <strong>%count%</strong> résultats trouvés]]></target>
</trans-unit>
<trans-unit id="9d0784601d1d4ace8d20d57d5e332be8" resname="list.no_results">
<source>list.no_results</source>
<target>Aucun résultat trouvé</target>
</trans-unit>
</body>
</file>
</xliff>
19 changes: 10 additions & 9 deletions Resources/views/_list_paginator.html.twig
Original file line number Diff line number Diff line change
@@ -1,64 +1,65 @@
{% trans_default_domain "EasyAdminBundle" %}
{% if paginator.haveToPaginate %}
<div class="list-pagination">
<div class="row">
<div class="col-sm-2 hidden-xs" class="list-pagination-counter">
<strong>{{ paginator.currentPageOffsetStart }}</strong> - <strong>{{ paginator.currentPageOffsetEnd }}</strong> of <strong>{{ paginator.nbResults }}</strong>
{{ 'paginator.counter' | trans({"%start%": paginator.currentPageOffsetStart, "%end%": paginator.currentPageOffsetEnd, "%results%": paginator.nbResults}) | raw }}
</div>

<div class="col-xs-12 col-sm-10">
<ul class="pagination list-pagination-paginator">
{% if 1 == paginator.currentPage %}
<li class="disabled">
<span>
<i class="fa fa-angle-double-left"></i> First
<i class="fa fa-angle-double-left"></i> {{ 'paginator.first' | trans }}
</span>
</li>
{% else %}
<li>
<a href="{{ path('admin', request_attributes|merge({ page: 1 }) ) }}">
<i class="fa fa-angle-double-left"></i> First
<i class="fa fa-angle-double-left"></i> {{ 'paginator.first' | trans }}
</a>
</li>
{% endif %}

{% if paginator.hasPreviousPage %}
<li>
<a href="{{ path('admin', request_attributes|merge({ page: paginator.previousPage }) ) }}">
<i class="fa fa-angle-left"></i> Previous
<i class="fa fa-angle-left"></i> {{ 'paginator.previous' | trans }}
</a>
</li>
{% else %}
<li class="disabled">
<span>
<i class="fa fa-angle-left"></i> Previous
<i class="fa fa-angle-left"></i> {{ 'paginator.previous' | trans }}
</span>
</li>
{% endif %}

{% if paginator.hasNextPage %}
<li>
<a href="{{ path('admin', request_attributes|merge({ page: paginator.nextPage }) ) }}">
Next <i class="fa fa-angle-right"></i>
{{ 'paginator.next' | trans }} <i class="fa fa-angle-right"></i>
</a>
</li>
{% else %}
<li class="disabled">
<span>
Next <i class="fa fa-angle-right"></i>
{{ 'paginator.next' | trans }} <i class="fa fa-angle-right"></i>
</span>
</li>
{% endif %}

{% if paginator.currentPage < paginator.nbPages %}
<li>
<a href="{{ path('admin', request_attributes|merge({ page: paginator.nbPages }) ) }}">
Last <i class="fa fa-angle-double-right"></i>
{{ 'paginator.last' | trans }} <i class="fa fa-angle-double-right"></i>
</a>
</li>
{% else %}
<li class="disabled">
<span>
Last <i class="fa fa-angle-double-right"></i>
{{ 'paginator.last' | trans }} <i class="fa fa-angle-double-right"></i>
</span>
</li>
{% endif %}
Expand Down
11 changes: 6 additions & 5 deletions Resources/views/edit.html.twig
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{% extends '@EasyAdmin/layout.html.twig' %}
{% trans_default_domain "EasyAdminBundle" %}

{% form_theme form '@EasyAdmin/form/bootstrap_3_horizontal_layout.html.twig' %}

{% block body_class 'admin edit ' ~ entity.name|lower %}

{% block content_title %}
Edit {{ entity.name ~ ' #' ~ item.id }}
{{ 'entity.edit' | trans({'%label%': entity.name~' #'~item.id}) }}
{% endblock %}

{% block main %}
Expand All @@ -15,15 +16,15 @@
<div class="form-group">
<div class="col-sm-10 col-sm-offset-2">
<button type="submit" class="btn">
<i class="fa fa-save"></i> Save changes
<i class="fa fa-save"></i> {{ 'entity.save_changes' | trans }}
</button>

<button type="button" onclick="document.getElementById('delete-form').submit()" class="btn btn-danger">
<i class="fa fa-trash"></i> Delete
<button onclick="document.getElementById('delete-form').submit()" class="btn btn-danger">
<i class="fa fa-trash"></i> {{ 'entity.delete' | trans() }}
</button>

<a class="btn btn-list btn-secondary" href="{{ path('admin', ({ entity: entity.name, action: 'list' }) ) }}">
Back to Listing
{{ 'link.back_to_listing' | trans }}
</a>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions Resources/views/form/bootstrap_3_layout.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends "form_div_layout.html.twig" %}
{% trans_default_domain "EasyAdminBundle" %}

{# Widgets #}

Expand Down
5 changes: 3 additions & 2 deletions Resources/views/layout.html.twig
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{% trans_default_domain "EasyAdminBundle" %}
<!DOCTYPE html>
<html lang="en">
<head>
Expand Down Expand Up @@ -46,15 +47,15 @@
</li>
{% endfor %}
<li class="visible-xs visible-sm header-nav-close">
<a href="#header">Close</a>
<a href="#header">{{ 'header.close' | trans }}</a>
</li>
</ul>
</div>

{% if app.user %}
<div id="header-security" class="col-xs-12 col-md-2 col-lg-12">
<p>
<small><i class="fa fa-lock"></i> <span>Logged in as</span></small>
<small><i class="fa fa-lock"></i> <span>{{ 'header.logged_in_as' | trans }}</span></small>
{{ app.user.username|default('Unnamed User') }}
</p>
</div>
Expand Down
11 changes: 6 additions & 5 deletions Resources/views/list.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends '@EasyAdmin/layout.html.twig' %}
{% trans_default_domain "EasyAdminBundle" %}

{% block body_class 'admin list ' ~ entity.name|lower %}

Expand All @@ -14,15 +15,15 @@
<div class="row">
<div class="col-xs-12 col-sm-5">
{% if 'search' == app.request.get('action') %}
<h1 class="title"><strong>{{ paginator.nbResults }}</strong> result{{ paginator.nbResults == 1 ? '' : 's' }} found</h1>
<h1 class="title">{{ 'list.results_found' | transchoice(paginator.nbResults) | raw }}</h1>
{% else %}
<h1 class="title">{{ config['entities'][entity.name]['label'] }}</h1>
{% endif %}
</div>
<div class="col-xs-12 col-sm-7">
<div id="content-actions">
<a class="btn" href="{{ path('admin', { entity: entity.name, action: 'new' }) }}">
Create {{ entity.name }}
{{ 'entity.create' | trans({"%entity%": entity.name}) }}
</a>
</div>
<form id="content-search" class="col-xs-6 col-sm-8" method="get" action="{{ path('admin') }}">
Expand Down Expand Up @@ -73,7 +74,7 @@
</th>
{% endfor %}
<th>
<span>Actions</span>
<span>{{ 'list.actions' | trans }}</span>
</th>
</tr>
</thead>
Expand Down Expand Up @@ -127,7 +128,7 @@
<td class="actions">
{% for action in config['list_actions'] %}
<a href="{{ path('admin', { action: action, entity: entity.name, id: attribute(item, 'id') }) }}">
{{ action|humanize }}
{{ ('actions.'~action)|trans }}
</a>
{% endfor %}

Expand All @@ -144,7 +145,7 @@
</tr>
{% else %}
<tr>
<td colspan="{{ fields|length + 1 }}">No results found.</<td>
<td colspan="{{ fields|length + 1 }}">{{ 'list.no_results' | trans }}</td>
</tr>
{% endfor %}
</tbody>
Expand Down
7 changes: 4 additions & 3 deletions Resources/views/new.html.twig
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{% extends '@EasyAdmin/layout.html.twig' %}
{% trans_default_domain "EasyAdminBundle" %}

{% form_theme form '@EasyAdmin/form/bootstrap_3_horizontal_layout.html.twig' %}

{% block body_class 'admin new ' ~ entity.name|lower %}

{% block content_title %}
Create {{ entity.name }}
{{ 'entity.create' | trans({"%entity%": entity.name}) }}
{% endblock %}

{% block main %}
Expand All @@ -15,11 +16,11 @@
<div class="form-group">
<div class="col-sm-10 col-sm-offset-2">
<button type="submit" class="btn">
<i class="fa fa-save"></i> Save changes
<i class="fa fa-save"></i> {{ 'entity.save_changes' | trans }}
</button>

<a class="btn btn-list btn-secondary" href="{{ path('admin', ({ entity: entity.name, action: 'list' }) ) }}">
Back to Listing
{{ 'link.back_to_listing' | trans }}
</a>
</div>
</div>
Expand Down

0 comments on commit 26a6216

Please sign in to comment.