Permalink
Browse files

implemented translation on a large part of the website

  • Loading branch information...
inmarelibero committed Oct 29, 2012
1 parent e5833f6 commit 017a1d91abc5bfd5992d38ff2a1e30ac8c8884d8
View
@@ -1,6 +1,7 @@
imports:
- { resource: parameters.yml }
- { resource: assetic.yml }
+ - { resource: locales.yml }
- { resource: security.yml }
parameters:
View
@@ -0,0 +1,21 @@
+####################################################################################################################
+# Configuration file for translations and locales #
+####################################################################################################################
+
+parameters:
+
+ # array of available interface translations
+ interface_translation_locales:
+ -
+ code: en
+ -
+ code: it
+
+ # parameter to be used in routes.yml
+ # add |[locale] if a new interface locale is available
+ route_locale_requirements: '^it|en$'
+
+twig:
+ globals:
+ # parameter accessible from twig templates
+ interface_translation_locales: "%interface_translation_locales%"
View
@@ -1,32 +1,71 @@
+# homepage not localized: load the homepage with default language
+index_not_localized:
+ pattern: /
+ defaults: { _controller: BricksSiteBundle:Default:index, _locale: %locale% }
+
# Bricks routes
bricks_site:
resource: "@BricksSiteBundle/Controller/"
type: annotation
- prefix: /
+ prefix: /{_locale}/
+ defaults: { _locale: %locale% }
+ requirements:
+ _locale: %route_locale_requirements%
+
bricks_user:
resource: "@BricksUserBundle/Controller/"
type: annotation
- prefix: /
+ prefix: /{_locale}/
+ defaults: { _locale: %locale% }
+ requirements:
+ _locale: %route_locale_requirements%
+
+# additional unlocalized login action
+login:
+ pattern: /login
+ defaults: { _controller: FOSUserBundle:Security:login, _locale: %locale% }
+
+# required unlocalized logout action
+logout:
+ pattern: /logout
+ defaults: { _controller: FOSUserBundle:Security:logout, _locale: %locale% }
+
# FOSUserBundle routes
fos_user_security:
resource: "@FOSUserBundle/Resources/config/routing/security.xml"
+ prefix: /{_locale}/
+ defaults: { _locale: %locale% }
+ requirements:
+ _locale: %route_locale_requirements%
fos_user_profile:
resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
- prefix: /profile
+ prefix: /{_locale}/profile
+ defaults: { _locale: %locale% }
+ requirements:
+ _locale: %route_locale_requirements%
fos_user_register:
resource: "@FOSUserBundle/Resources/config/routing/registration.xml"
- prefix: /register
+ prefix: /{_locale}/register
+ defaults: { _locale: %locale% }
+ requirements:
+ _locale: %route_locale_requirements%
fos_user_resetting:
resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
- prefix: /resetting
+ prefix: /{_locale}/resetting
+ defaults: { _locale: %locale% }
+ requirements:
+ _locale: %route_locale_requirements%
fos_user_change_password:
resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
- prefix: /profile
+ prefix: /{_locale}/profile
+ defaults: { _locale: %locale% }
+ requirements:
+ _locale: %route_locale_requirements%
# Internal routing configuration to handle ESI
View
@@ -12,7 +12,11 @@ security:
form_login:
provider: fos_userbundle
csrf_provider: form.csrf_provider
- logout: true
+ login_path: fos_user_security_login
+ check_path: fos_user_security_check
+ logout:
+ path: logout
+ target: /
anonymous: true
remember_me:
key: "%secret%"
@@ -21,11 +25,12 @@ security:
domain: ~ # Defaults to the current domain from $_SERVER
access_control:
- - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
+ - { path: ^(/(%route_locale_requirements%)/login)|(/login)$, role: IS_AUTHENTICATED_ANONYMOUSLY }
+ - { path: ^/(%route_locale_requirements%)/login_check$, role: IS_AUTHENTICATED_ANONYMOUSLY }
+ - { path: ^/(%route_locale_requirements%)/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
+ - { path: ^/(%route_locale_requirements%)/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- - { path: ^/user/, role: IS_AUTHENTICATED_FULLY }
+ - { path: ^/(%route_locale_requirements%)/user/, role: IS_AUTHENTICATED_FULLY }
role_hierarchy:
ROLE_ADMIN: ROLE_USER
@@ -116,5 +116,14 @@ MAIN NAVBAR
}
}
}
+
+ li#nav-locales {
+ padding-left: 20px;
+ a {
+ display: inline-block;
+ padding-left: 3px;
+ padding-right: 3px;
+ }
+ }
}
}
@@ -0,0 +1,11 @@
+####################################################################################################################
+# Translations #
+# #
+# route name: homepage #
+####################################################################################################################
+
+how_to_contribute: contribute
+sign_up: Sign up
+relevant_links: Relevant links
+
+homepage.contribute.next_step: 'The next step is to have a look at <a href="%href%">the section "Contribute"</a> for more detailed informations.'
@@ -0,0 +1,11 @@
+####################################################################################################################
+# Translations #
+# #
+# route name: homepage #
+####################################################################################################################
+
+how_to_contribute: contribuisci
+sign_up: Iscriviti
+relevant_links: Link in primo piano
+
+homepage.contribute.next_step: 'Il prossimo passo è visitare <a href="%href%">la sezione "Contribuisci"</a> per avere più informazioni.'
@@ -0,0 +1,18 @@
+####################################################################################################################
+# Translations #
+# #
+# general translations #
+####################################################################################################################
+
+# main navbar
+main_navbar:
+ contribute: contribute
+ github_repository: github repository
+ register: register
+ sign_in: sign in
+
+# entries related to a Brick
+brick:
+ last_update: last update
+ search:
+ title: Results for "%q%"
@@ -1,11 +0,0 @@
-<?xml version="1.0"?>
-<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
- <file source-language="en" datatype="plaintext" original="file.ext">
- <body>
- <trans-unit id="1">
- <source>Symfony2 is great</source>
- <target>J'aime Symfony2</target>
- </trans-unit>
- </body>
- </file>
-</xliff>
@@ -0,0 +1,18 @@
+####################################################################################################################
+# Translations #
+# #
+# general translations #
+####################################################################################################################
+
+# main navbar
+main_navbar:
+ contribute: contribuisci
+ github_repository: repository github
+ register: registrati
+ sign_in: entra
+
+# entries related to a Brick
+brick:
+ last_update: ultimo aggiornamento
+ search:
+ title: Risultati della ricerca "%q%"
@@ -15,7 +15,7 @@
<p>
<i class="icon-user"></i> {{ brick.user }}
|
- <i class="icon-calendar"></i> last update: {{ brick.updatedAt|date('d/m/Y') }}
+ <i class="icon-calendar"></i> {{ 'brick.last_update'|trans }}: {{ brick.updatedAt|date('d/m/Y') }}
</p>
</li>
{% endfor %}
@@ -7,12 +7,22 @@
<div class="row">
<div class="span12">
- <h1>Content not available</h1>
+ <h1>
+ {% if 'it' == app.request.locale %}
+ Contenuto non disponibile
+ {% else %}
+ Content not available
+ {% endif %}
+ </h1>
<br><br>
<p>
- The content you are trying to access exists, but it is currently not published.
+ {% if 'it' == app.request.locale %}
+ Il contenuto al quale stai cercando di accedere esiste, ma è attualmente non pubblicato.
+ {% else %}
+ The content you are trying to access exists, but it is currently not published.
+ {% endif %}
</p>
</div>
@@ -2,13 +2,12 @@
{% block main %}
-
<div id="brick-search-wrapper">
<div class="row">
<div class="span12">
- <h1>Results for "{{ q }}"</h1>
+ <h1>{{ 'brick.search.title'|trans({'%q%': q}) }}</h1>
<hr>
@@ -22,7 +21,7 @@
<p>
<i class="icon-user"></i> <a href="{{ path('userprofile_show', {'username': brick.user.username}) }}">{{ brick.user }}</a>
|
- <i class="icon-calendar"></i> last update: {{ brick.updatedAt|date('d/m/Y') }}
+ <i class="icon-calendar"></i> {{ 'brick.last_update'|trans }}: {{ brick.updatedAt|date('d/m/Y') }}
</p>
</li>
{% endfor %}
@@ -18,7 +18,7 @@
<hr>
<i class="icon-user"></i> <a href="{{ path('userprofile_show', {'username': brick.user.username}) }}">{{ brick.user }}</a>
|
- <i class="icon-calendar"></i> last update: {{ brick.updatedAt|date('d/m/Y') }}
+ <i class="icon-calendar"></i> {{ 'brick.last_update'|trans }}: {{ brick.updatedAt|date('d/m/Y') }}
<a href="https://twitter.com/share" class="twitter-share-button pull-right"
Oops, something went wrong.

0 comments on commit 017a1d9

Please sign in to comment.