Skip to content

Added support for symfony translations providers like loco#130

Open
luksh123 wants to merge 6 commits intocontributte:masterfrom
luksh123:devel
Open

Added support for symfony translations providers like loco#130
luksh123 wants to merge 6 commits intocontributte:masterfrom
luksh123:devel

Conversation

@luksh123
Copy link

Added support for symfony translations providers like loco (https://localise.biz/)

https://symfony.com/doc/current/translation.html#installing-and-configuring-a-third-party-provider

New config items for translation in config.neon looks like:
providers:
loco:
provider: Symfony\Component\Translation\Bridge\Loco\LocoProviderFactory
dsn: %loco.dsn%
locales: [cs_CZ, sk_SK]
domains: []

Copy link
Member

@aleswita aleswita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"symfony/translation": "^6.0|^7.0",
"symfony/config": "^6.0|^7.0"
"symfony/config": "^6.0|^7.0",
"symfony/finder": "^6.0|^7.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this dependency?

}

$reader = $builder->addDefinition($this->prefix('providerTranslationReader'))
->setFactory(TranslationReader::class);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

coding style, missing one more tab



$neonFileDumper = $builder->addDefinition($this->prefix('neonFileDumper'))
->setFactory(NeonFileDumper::class);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cs

$providers = [];
foreach ($this->config->providers as $k1 => $v1) {

if (!isset($v1['provider']))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing brackets


$providers[$k1] = $provider;

/*if (!isset($this->config->providers[$k1]['domains']) || empty($this->config->providers[$k1]['domains'])) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this?

// Symfony providers

$builder->addDefinition($this->prefix('providerCurlHttpClient'))
->setFactory(CurlHttpClient::class);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cs and more on other places

}

$builder->addDefinition($this->prefix('providerCollectionFatory'))
->setFactory(TranslationProviderCollectionFactory::class, ["factories" => $providers, 'enabledLocales' => $this->config->locales->whitelist]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mixing single quotes and double quotes

/**
* NeonFileDumper generates yaml files from a message catalogue.
*
* @author Lukas Divacky <lukas.divacky@ldtech.cz>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need, your name will be in release notes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants