2017 © Pedro Peláez
 

library messages-bundle

Zicht Messages bundle

image

zicht/messages-bundle

Zicht Messages bundle

  • Wednesday, July 25, 2018
  • by muhammedeminakbulut
  • Repository
  • 0 Watchers
  • 1 Stars
  • 249 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 4 Open issues
  • 67 Versions
  • 592 % Grown

The README.md

ZichtMessagesBundle: manage your translatable messages in the database

The ZichtMessagesBundle provides an Doctrine entity and admin screens for managing messages and have the database provide translations for message keys. Additionally, some console tools are available for your convenience., (*1)

Admin

The admin is based on the SonataAdminBundle., (*2)

Console tools

Some utility console tools are available., (*3)

  • zicht:messages:add adds a message to the database catalogue
  • zicht:messages:load loads a translation file into the database catalogue
  • zicht:messages:flush flushes Symfony's translation cache

Installing

  • Make sure the translations/ directory is present in your project.
    • Using translations is/seems to be dependent on the order of scanned directories. By using this directory we assure we are the last in line, overwriting templates with database.
  • Add the db file for each domain-locale combination, for instance: message.en.db
  • Add a translation via the CMS.
  • Clear the cache with php app/console cache:clear
  • All existing message states will be unknown, you need to update these once by running zicht:messages:load --sync

Configure manual cache clear

Edit your zicht_admin.yml and add:, (*4)

zicht_admin:
    rc:
        messages:
            route: zicht_messages_rc_flush
            method: DELETE
            title: Clear translation cache
            button: Clear

Message state

The messages-bundle maintains a state for each message, this state can be either import, user, or unknown. You can configure z to import messages on every deploy by adding the following:, (*5)

tasks:
    deploy:
        post: 
            - @messages.load_files

To ensure that the message state is properly updated, add the following to you z config:, (*6)

messages:
    overwrite_compatibility: false

Automatic translation

Leverage the zicht:message:translate command with automatic translation through an API of choice. Kickstart the usage by using the provided Google Translate API., (*7)

Setup

composer require google/cloud-translate, (*8)

Configuration

Define the Google Translator as a service in your project. Your API key should be the private key from a service account (https://cloud.google.com/translate/docs/basic/setup-basic), (*9)

parameters:
    env(GOOGLE_API_KEY): '%kernel.root_dir%/config/your-google-api-key.json'

```xml %env(json:file:resolve:GOOGLE_API_KEY)% , (*10)


Add a `CompilerPass` to register a `BatchTranslatorInterface` on the `MessageTranslator`: ```php use Zicht\Bundle\MessagesBundle\Translator\GoogleTranslator; use Zicht\Bundle\MessagesBundle\Translator\MessageTranslator; /** * {@inheritDoc} */ public function process(ContainerBuilder $container) { $container ->getDefinition(MessageTranslator::class) ->addMethodCall('setBatchTranslator', [new Reference(GoogleTranslator::class)]); }

Usage

In this example we have copied a .nl.yaml to a es.yaml and we are informing the command that the sourcelanguage is nl and the targetlanguage should be es. As we have already renamed the file, only contents of this file will be rewritten., (*11)

```shell script php bin/console zicht:message:translate /dir/to/project/translations/validators.es.(yaml|xlf) --source=nl --target=es, (*12)


### Conditions The targetlanguage (`--target=xx`) is required for `yaml` as it cannot be autodiscovered. For `xlf` we use the `target-language` attribute inside the file, but can be forced by using the target-option as well. Parameters in the translations are rewritten and not sent to the translation-api to prevent translating them. They should be in the format of `%param%`, `!param` or `{param}`. If your file is in `xliff`, we only support `1.2`. If your file is in `yaml`, and has hierarchical contents, this will be lost and the file will be rewritten with single lines containing the full path to your translation. #### Before ```yaml app: index: title: Abc

After

app.index.title: Abc

Maintainer(s)

The Versions

25/07 2018

dev-release/2.5.x

dev-release/2.5.x

Zicht Messages bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Zicht online

26/06 2018

dev-release/4.x

dev-release/4.x

Zicht Messages bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Zicht online

26/06 2018

4.0.0

4.0.0.0

Zicht Messages bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Zicht online

26/06 2018

dev-release/3.x

dev-release/3.x

Zicht Messages bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Zicht online

26/06 2018

3.1.0

3.1.0.0

Zicht Messages bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Zicht online

25/06 2018

3.1.0-rc.1

3.1.0.0-RC1

Zicht Messages bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Zicht online

01/06 2018

dev-feature/sf2.8

dev-feature/sf2.8

Zicht Messages bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Zicht online

22/01 2018

3.0.0

3.0.0.0

Zicht Messages bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Zicht online

16/01 2018

dev-feature/allow-for-php7

dev-feature/allow-for-php7

Zicht Messages bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Zicht online

12/07 2017

dev-feature/prevent-null-value

dev-feature/prevent-null-value

Zicht Messages bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Zicht online

12/07 2017

2.5.9-rc.1

2.5.9.0-RC1

Zicht Messages bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Zicht online

04/05 2017

dev-release/2.0.x

dev-release/2.0.x

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

04/05 2017

2.5.8

2.5.8.0

Zicht Messages bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Zicht online

17/03 2017

2.5.7

2.5.7.0

Zicht Messages bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Zicht online

16/03 2017

2.5.6

2.5.6.0

Zicht Messages bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Zicht online

16/03 2017

2.5.5-rc.3

2.5.5.0-RC3

Zicht Messages bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Zicht online

16/03 2017

2.5.5

2.5.5.0

Zicht Messages bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Zicht online

16/03 2017

2.5.5-rc.2

2.5.5.0-RC2

Zicht Messages bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Zicht online

16/03 2017

2.5.5-rc.1

2.5.5.0-RC1

Zicht Messages bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Zicht online

22/02 2017

2.5.4

2.5.4.0

Zicht Messages bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Zicht online

22/02 2017

2.5.3

2.5.3.0

Zicht Messages bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Zicht online

22/02 2017

2.5.2

2.5.2.0

Zicht Messages bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Zicht online

22/02 2017

2.5.1

2.5.1.0

Zicht Messages bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Zicht online

26/01 2017

2.0.6-rc.1

2.0.6.0-RC1

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

23/01 2017

2.0.5

2.0.5.0

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

12/10 2016
11/10 2016

dev-feature/sync-state

dev-feature/sync-state

Zicht Messages bundle

  Sources   Download

The Requires

 

The Development Requires

by Zicht online

03/10 2016
03/10 2016

2.2.4

2.2.4.0

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

03/10 2016

2.1.2

2.1.2.0

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

03/10 2016
03/10 2016

2.2.3

2.2.3.0

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

03/10 2016

2.1.1

2.1.1.0

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

21/09 2016
19/09 2016
16/08 2016
27/07 2016
22/07 2016
20/05 2016

2.3.0-rc.1

2.3.0.0-RC1

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

04/05 2016

2.2.2

2.2.2.0

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

04/04 2016

2.2.1

2.2.1.0

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

11/03 2016

2.2.0

2.2.0.0

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

11/02 2016

2.1.0

2.1.0.0

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

11/12 2015

1.3.2

1.3.2.0

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

11/12 2015

1.3.1

1.3.1.0

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

19/10 2015

2.1.0-rc.1

2.1.0.0-RC1

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

15/09 2015

2.0.4

2.0.4.0

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

15/09 2015

2.0.3

2.0.3.0

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

09/09 2015

2.0.3-rc.1

2.0.3.0-RC1

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

03/09 2015

2.0.2

2.0.2.0

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

03/09 2015

2.0.1

2.0.1.0

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

21/04 2015

1.3.0

1.3.0.0

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

21/04 2015

1.3.0-rc.1

1.3.0.0-RC1

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

16/01 2015

2.0.0-rc.1

2.0.0.0-RC1

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

29/12 2014

1.2.1

1.2.1.0

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

29/12 2014

1.2.1-rc.1

1.2.1.0-RC1

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

12/11 2014

1.2.0

1.2.0.0

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

01/10 2014

1.2.0-rc.2

1.2.0.0-RC2

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

01/10 2014

1.2.0-rc.1

1.2.0.0-RC1

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

01/10 2014

1.2.0-beta.1

1.2.0.0-beta1

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

01/10 2014

1.1.0

1.1.0.0

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

11/06 2014

1.0.5

1.0.5.0

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

12/05 2014

1.0.4

1.0.4.0

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

12/05 2014

1.0.3

1.0.3.0

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

30/04 2014

1.0.2

1.0.2.0

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

11/04 2014

1.0.1

1.0.1.0

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online

19/11 2013

1.0

1.0.0.0

Zicht Messages bundle

  Sources   Download

The Requires

  • php >=5.3

 

by Zicht online