Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for symfony translations providers like loco #130

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

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.

@@ -25,7 +25,8 @@
"nette/routing": "^3.0",
"nette/utils": "^3.2.1|~4.0.0",
"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?

@@ -187,6 +201,9 @@ public function loadConfiguration(): void
$translator->setAutowired($autowired);
}

$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 <[email protected]>
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
Development

Successfully merging this pull request may close these issues.

2 participants