elkuku/g11n-bundle

Symfony G11n Bundle

Installs: 77

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 3

Forks: 0

Open Issues: 0

Type:symfony-bundle

0.1.2 2018-07-19 16:22 UTC

This package is auto-updated.

Last update: 2024-12-12 00:46:34 UTC


README

The G11n bundle integrates the G11n language library into Synfony projects.

Installation

composer require elkuku/g11n-bundle

If you are not using Flex add

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

Usage

See the G11n Wiki for general information.

Twig

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

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

Configuration

Default values

  • Default language: en-GB
  • Debug: off

To change those values create the file

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

Commands

g11n:templates

Create or update the language template files.

g11n:langfiles

Create or update the language files.

Templates

Language switcher

There is a simple language switcher template that you might take as a ... template ;)

{% 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.

[screenshot]