8000 Added Lokalise Provider · symfony/symfony@d434655 · GitHub
[go: up one dir, main page]

Skip to content

Commit d434655

Browse files
committed
Added Lokalise Provider
1 parent 55574de commit d434655

File tree

14 files changed

+1172
-1
lines changed

14 files changed

+1172
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@
170170
use Symfony\Component\String\LazyString;
171171
use Symfony\Component\String\Slugger\SluggerInterface;
172172
use Symfony\Component\Translation\Bridge\Loco\LocoProviderFactory;
173+
use Symfony\Component\Translation\Bridge\Lokalise\LokaliseProviderFactory;
173174
use Symfony\Component\Translation\Command\XliffLintCommand as BaseXliffLintCommand;
174175
use Symfony\Component\Translation\PseudoLocalizationTranslator;
175176
use Symfony\Component\Translation\Translator;
@@ -1342,14 +1343,15 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
13421343

13431344
$classToServices = [
13441345
LocoProviderFactory::class => 'translation.provider_factory.loco',
1346+
LokaliseProviderFactory::class => 'translation.provider_factory.lokalise',
13451347
];
13461348

13471349
$parentPackages = ['symfony/framework-bundle', 'symfony/translation', 'symfony/http-client'];
13481350

13491351
foreach ($classToServices as $class => $service) {
13501352
$package = sprintf('symfony/%s-translation-provider', substr($service, \strlen('translation.provider_factory.')));
13511353

1352-
if (!$container->hasDefinition('http_client') || !ContainerBuilder::willBeAvailable($package, $class, $parentPackages)) {
1354+
if (!$container->hasDefinition('http_client') || !ContainerBuilder::willBeAvailable(sprintf('symfony/%s-translation-provider', $package), $class, $parentPackages)) {
13531355
$container->removeDefinition($service);
13541356
}
13551357
}

src/Symfony/Bundle/FrameworkBundle/Resources/config/translation_providers.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
1313

1414
use Symfony\Component\Translation\Bridge\Loco\LocoProviderFactory;
15+
use Symfony\Component\Translation\Bridge\Lokalise\LokaliseProviderFactory;
1516
use Symfony\Component\Translation\Provider\NullProviderFactory;
1617
use Symfony\Component\Translation\Provider\TranslationProviderCollection;
1718
use Symfony\Component\Translation\Provider\TranslationProviderCollectionFactory;
@@ -41,5 +42,14 @@
4142
service('translation.loader.xliff'),
4243
])
4344
->tag('translation.provider_factory')
45+
46+
->set('translation.provider_factory.lokalise', LokaliseProviderFactory::class)
47+
->args([
48+
service('http_client'),
49+
service('logger'),
50+
param('kernel.default_locale'),
51+
service('translation.loader.xliff'),
52+
])
53+
->tag('translation.provider_factory')
4454
;
4555
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/Tests export-ignore
2+
/phpunit.xml.dist export-ignore
3+
/.gitattributes export-ignore
4+
/.gitignore export-ignore
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
vendor/
2+
composer.lock
3+
phpunit.xml
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CHANGELOG
2+
=========
3+
4+
5.3
5+
---
6+
7+
* Create the bridge
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2021 Fabien Potencier
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is furnished
8+
to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

0 commit comments

Comments
 (0)
0