Skip to content

Commit

Permalink
Merge pull request sonata-project#26 from Taluu/pr-fix-docs
Browse files Browse the repository at this point in the history
Update documentation
  • Loading branch information
rande committed May 7, 2012
2 parents 82e2b96 + 777cfb2 commit 97fc39a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 26 deletions.
12 changes: 7 additions & 5 deletions Resources/doc/reference/datetime.rst
Expand Up @@ -13,8 +13,8 @@ Twig usage
You can format a compatible date with 4 methods, a date can be:

- a ``DateTime`` object
- a timestamp a date string (``375930000``)
- a string date ``1981-11-30``
- a timestamp : ``375930000``
- a date string : ``'1981-11-30'``


.. code-block:: jinja
Expand All @@ -23,8 +23,9 @@ You can format a compatible date with 4 methods, a date can be:
{{ date_time_object | format_time }} => '19:55:26'
{{ date_time_object | format_datetime }} => '1 août 2011 19:55:26'
By default the helpers methods use the current user's locale to display information. Of course this behavior can
be controller from within the template by providing extra parameters:
By default the helpers methods use the current user's locale to display
information. Of course this behavior can be controller from within the template
by providing extra parameters :

* pattern : the pattern to use to render the date
* the locale
Expand All @@ -40,4 +41,5 @@ be controller from within the template by providing extra parameters:
.. note::

More information about patterns can be found here: http://userguide.icu-project.org/formatparse/datetime
More information about patterns can be found here:
http://userguide.icu-project.org/formatparse/datetime
15 changes: 8 additions & 7 deletions Resources/doc/reference/installation.rst
Expand Up @@ -5,13 +5,16 @@ This bundle requires the ``php-intl`` extension.

To begin, add the dependent bundle to the ``vendor/bundles`` directory.

If you use the Symfony's ``bin/vendor`` script, you can add a new entry in the deps file::
If you use the Symfony's ``bin/vendor`` script, you can add a new entry in the
``deps`` file

.. code-block:: ini
[SonataIntlBundle]
git=https://github.com/sonata-project/SonataIntlBundle
target=/bundles/Sonata/IntlBundle
If using git, you can add them as submodules::
If you are using git, you can add them as submodules::

git submodule add git://github.com/sonata-project/SonataIntlBundle.git vendor/bundles/Sonata/IntlBundle

Expand All @@ -33,10 +36,9 @@ Next, be sure to enable the bundles in your application kernel:
Configuration
-------------

You can configure the default timezone used by the date helper with the following configuration. By default the
``php.ini`` value is used (retrieved by the ``date_default_timezone_get()`` function). It is now possible to
configure your own service for timezone detecting or use the naive approach provided by this bundle. If you
configure your own service it should implement the ``Sonata\IntlBundle\Timezone\TimezoneDetectorInterface``.
You can configure the default timezone used by the date helper with the following
configuration. By default the ``php.ini`` value is used (retrieved by the
``date_default_timezone_get()`` function).

The locale value used by the bundle is provided by the request.

Expand All @@ -62,4 +64,3 @@ Or the naive approach mapping the locales to timezones.
locales:
fr: Europe/Paris
en_UK: Europe/London
12 changes: 6 additions & 6 deletions Resources/doc/reference/locale.rst
Expand Up @@ -16,12 +16,12 @@ retrieved by using the request instance.

.. code-block:: jinja
{{ 'FR' | country }} => France (if the current locale in request is 'fr')
{{ 'FR' | country('de') }} => Frankreich (force the locale)
{{ 'FR' | country }} {# => France (if the current locale in session is 'fr') #}
{{ 'FR' | country('de') }} {# => Frankreich (force the locale) #}
{{ 'fr' | language }} => français (if the current locale in request is 'fr')
{{ 'fr' | language('en') }} => French (force the locale)
{{ 'fr' | language }} => {# français (if the current locale in session is 'fr') #}
{{ 'fr' | language('en') }} {# => French (force the locale) #}
{{ 'fr' | locale }} => français (if the current locale in request is 'fr')
{{ 'fr' | locale('en') }} => French (force the locale)
{{ 'fr' | locale }} {# => français (if the current locale in session is 'fr') #}
{{ 'fr' | locale('en') }} {# => French (force the locale) #}
16 changes: 8 additions & 8 deletions Resources/doc/reference/number.rst
Expand Up @@ -20,11 +20,11 @@ retrieved by using the request instance.

.. code-block:: jinja
{{ 10.49 | number_format_currency('EUR') }} => 10,49 €
{{ 10.15459 | number_format_decimal }} => 10,155
{{ 1000 | number_format_scientific }} => 1E3
{{ 1000000 | number_format_duration }} => 1 000 000
{{ 42 | number_format_spellout }} => quarante-deux
{{ 1.999 | number_format_percent }} => 200 %
{{ 1 | number_format_ordinal }} => 1ᵉʳ
{{ -1.1337 | number_format_decimal({'fraction_digits': 2}, {'negative_prefix': 'MINUS'}) }} => MINUS1,34
{{ 10.49 | number_format_currency('EUR') }} {# => 10,49 € #}
{{ 10.15459 | number_format_decimal }} {# => 10,155 #}
{{ 1000 | number_format_scientific }} {# => 1E3 #}
{{ 1000000 | number_format_duration }} {# => 1 000 000 #}
{{ 42 | number_format_spellout }} {# => quarante-deux #}
{{ 1.999 | number_format_percent }} {# => 200 % #}
{{ 1 | number_format_ordinal }} {# => 1ᵉʳ #}
{{ -1.1337 | number_format_decimal({'fraction_digits': 2}, {'negative_prefix': 'MINUS'}) }} {# => MINUS1,34 #}

0 comments on commit 97fc39a

Please sign in to comment.