2017 © Pedro Peláez
 

symfony-bundle g11n-bundle

Symfony G11n Bundle

image

elkuku/g11n-bundle

Symfony G11n Bundle

  • Thursday, July 19, 2018
  • by elkuku
  • Repository
  • 1 Watchers
  • 0 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

G11n Bundle

The G11n bundle integrates the G11n language library into Synfony projects., (*1)

Installation

composer require elkuku/g11n-bundle

If you are not using Flex add, (*2)

# /config.bundles.php
    ...
    ElKuKu\G11nBundle\ElKuKuG11nBundle::class => ['all' => true],
    ...

Usage

See the G11n Wiki for general information., (*3)

Twig

A shorthand function _() is provided for usage in twig templates, (*4)

{{ _('Translate this string') }}

Configuration

Default values

  • Default language: en-GB
  • Debug: off

To change those values create the file, (*5)

# /config/packages/elkuku_g11n.yaml
elkuku_g11n:
  defaultLang: en-GB
  debug: false

Commands

g11n:templates

Create or update the language template files., (*6)

g11n:langfiles

Create or update the language files., (*7)

Templates

Language switcher

There is a simple language switcher template that you might take as a ... template ;), (*8)

{% import "@ElKuKuG11n/_macro/g11n.html.twig" as g11n %}
...
{{ g11n.switcher(getLangs(), getCurrentLang()) }}

Debugging

Te enable debugging set the debug flag in the config file to 1., (*9)

[screenshot], (*10)

The Versions