Skip to content

Commit 1d0e7b3

Browse files
wouterjweaverryan
authored andcommitted
Reread book article
1 parent 55a30ab commit 1d0e7b3

File tree

3 files changed

+29
-16
lines changed

3 files changed

+29
-16
lines changed

book/translation.rst

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
Translations
55
============
66

7-
The term "internationalization" (often abbreviated `i18n`_) refers to the process
8-
of abstracting strings and other locale-specific pieces out of your application
9-
and into a layer where they can be translated and converted based on the user's
10-
locale (i.e. language and country). For text, this means wrapping each with a
11-
function capable of translating the text (or "message") into the language of
12-
the user::
7+
The term "internationalization" (often abbreviated `i18n`_) refers to the
8+
process of abstracting strings and other locale-specific pieces out of your
9+
application and into a layer where they can be translated and converted based
10+
on the user's locale (i.e. language and country). For text, this means
11+
wrapping each with a function capable of translating the text (or "message")
12+
into the language of the user::
1313

1414
// text will *always* print out in English
1515
echo 'Hello World';
@@ -21,10 +21,10 @@ the user::
2121
.. note::
2222

2323
The term *locale* refers roughly to the user's language and country. It
24-
can be any string that your application uses to manage translations
25-
and other format differences (e.g. currency format). The
26-
`ISO639-1`_ *language* code, an underscore (``_``), then the `ISO3166 Alpha-2`_ *country*
27-
code (e.g. ``fr_FR`` for French/France) is recommended.
24+
can be any string that your application uses to manage translations and
25+
other format differences (e.g. currency format). The `ISO639-1`_
26+
*language* code, an underscore (``_``), then the `ISO3166 Alpha-2`_
27+
*country* code (e.g. ``fr_FR`` for French/France) is recommended.
2828

2929
In this chapter, you'll learn how to use the Translation component in the
3030
Symfony2 framework. Read the
@@ -33,7 +33,8 @@ the Translator. Overall, the process has several common steps:
3333

3434
#. Enable and configure Symfony's Translation component;
3535

36-
#. Abstract strings (i.e. "messages") by wrapping them in calls to the ``Translator``;
36+
#. Abstract strings (i.e. "messages") by wrapping them in calls to the
37+
``Translator`` (learn about this in ":doc:`/components/translation/usage`");
3738

3839
#. Create translation resources for each supported locale that translate
3940
each message in the application;
@@ -132,13 +133,14 @@ Using the Translation inside Controllers
132133
----------------------------------------
133134

134135
When you want to use translation inside controllers, you need to get the
135-
``translator`` service and use ``trans`` or ``transChoice``::
136+
``translator`` service and use
137+
:method:`Symfony\\Component\\Translation\\Translator::trans` or
138+
:method:`Symfony\\Component\\Translation\\Translator::transChoice`::
136139

137140
// src/Acme/DemoBundle/Controller/DemoController.php
138141
namespace Amce\DemoBundle\Controller;
139142

140143
// ...
141-
142144
class DemoController extends Controller
143145
{
144146
public function indexAction()
@@ -541,7 +543,8 @@ steps:
541543

542544
* Abstract messages in your application by wrapping each in either the
543545
:method:`Symfony\\Component\\Translation\\Translator::trans` or
544-
:method:`Symfony\\Component\\Translation\\Translator::transChoice` methods;
546+
:method:`Symfony\\Component\\Translation\\Translator::transChoice` methods
547+
(learn about this in ":doc:`/components/translation/usage`");
545548

546549
* Translate each message into multiple locales by creating translation message
547550
files. Symfony2 discovers and processes each file because its name follows

components/translation/introduction.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ using pluralization (more about that later)::
4141
The locale set here is the default locale to use. You can override this
4242
locale when translating strings.
4343

44+
.. note::
45+
46+
The term *locale* refers roughly to the user's language and country. It
47+
can be any string that your application uses to manage translations and
48+
other format differences (e.g. currency format). The `ISO639-1`_
49+
*language* code, an underscore (``_``), then the `ISO3166 Alpha-2`_
50+
*country* code (e.g. ``fr_FR`` for French/France) is recommended.
51+
4452
Loading Message Catalogues
4553
~~~~~~~~~~~~~~~~~~~~~~~~~~
4654

@@ -175,3 +183,5 @@ Usage
175183
Read how to use the Translation components in ":doc:`/components/translation/usage`".
176184

177185
.. _Packagist: https://packagist.org/packages/symfony/translation
186+
.. _`ISO3166 Alpha-2`: http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes
187+
.. _`ISO639-1`: http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes

components/translation/usage.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.. index::
22
single: Translation; Usage
33

4-
Usage
5-
=====
4+
Using the Translator
5+
====================
66

77
Imagine you want to translate the string *"Symfony2 is great"* into French::
88

0 commit comments

Comments
 (0)