Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 575ce2b

Browse filesBrowse files
committed
rename
1 parent bf820d0 commit 575ce2b
Copy full SHA for 575ce2b

14 files changed

+36
-36
lines changed

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ private function addTranslatorSection(ArrayNodeDefinition $rootNode, callable $e
931931
->fixXmlConfig('fallback')
932932
->fixXmlConfig('path')
933933
->fixXmlConfig('provider')
934-
->fixXmlConfig('default_parameter')
934+
->fixXmlConfig('global')
935935
->children()
936936
->arrayNode('fallbacks')
937937
->info('Defaults to the value of "default_locale".')
@@ -986,8 +986,8 @@ private function addTranslatorSection(ArrayNodeDefinition $rootNode, callable $e
986986
->end()
987987
->defaultValue([])
988988
->end()
989-
->arrayNode('default_parameters')
990-
->info('Default parameters.')
989+
->arrayNode('globals')
990+
->info('Global parameters.')
991991
->example(['app_version' => 3.14])
992992
->defaultValue([])
993993
->normalizeKeys(false)

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,13 +1568,13 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
15681568
}
15691569
}
15701570

1571-
if ([] !== $config['default_parameters']) {
1571+
if ([] !== $config['globals']) {
15721572
$container
15731573
->register('translator.default_parameters', DefaultParametersTranslator::class)
15741574
->setDecoratedService('translator', null, -1) // Lower priority than "translator.data_collector"
15751575
->setArguments([
15761576
new Reference('translator.default_parameters.inner'),
1577-
$config['default_parameters'],
1577+
$config['globals'],
15781578
]);
15791579
}
15801580

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,15 +231,15 @@
231231
<xsd:element name="path" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
232232
<xsd:element name="pseudo-localization" type="pseudo_localization" minOccurs="0" maxOccurs="1" />
233233
<xsd:element name="provider" type="translation_provider" minOccurs="0" maxOccurs="unbounded" />
234-
<xsd:element name="default-parameter" type="translation_default_parameter" minOccurs="0" maxOccurs="unbounded" />
234+
<xsd:element name="global" type="translation_global" minOccurs="0" maxOccurs="unbounded" />
235235
</xsd:sequence>
236236
<xsd:attribute name="enabled" type="xsd:boolean" />
237237
<xsd:attribute name="fallback" type="xsd:string" />
238238
<xsd:attribute name="logging" type="xsd:boolean" />
239239
<xsd:attribute name="formatter" type="xsd:string" />
240240
<xsd:attribute name="cache-dir" type="xsd:string" />
241241
<xsd:attribute name="default-path" type="xsd:string" />
242-
<xsd:attribute name="default-parameter" type="xsd:string" />
242+
<xsd:attribute name="global" type="xsd:string" />
243243
</xsd:complexType>
244244

245245
<xsd:complexType name="pseudo_localization">
@@ -262,7 +262,7 @@
262262
<xsd:attribute name="dsn" type="xsd:string" />
263263
</xsd:complexType>
264264

265-
<xsd:complexType name="translation_default_parameter" mixed="true">
265+
<xsd:complexType name="translation_global" mixed="true">
266266
<xsd:attribute name="name" type="xsd:string" use="required" />
267267
<xsd:attribute name="value" type="xsd:string" />
268268
</xsd:complexType>

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ protected static function getBundleDefaultConfig()
668668
'localizable_html_attributes' => [],
669669
],
670670
'providers' => [],
671-
'default_parameters' => [],
671+
'globals' => [],
672672
],
673673
'validation' => [
674674
'enabled' => !class_exists(FullStack::class),
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
'handle_all_throwables' => true,
77
'php_errors' => ['log' => true],
88
'translator' => [
9-
'default_parameters' => [
9+
'globals' => [
1010
'%%app_name%%' => 'My application',
1111
'{app_version}' => '1.2.3',
1212
],
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
'http_method_override' => false,
66
'handle_all_throwables' => true,
77
'php_errors' => ['log' => true],
8-
'translator' => ['default_parameters' => []],
8+
'translator' => ['globals' => []],
99
]);
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
<framework:annotations enabled="false" />
1111
<framework:php-errors log="true" />
1212
<framework:translator enabled="true">
13-
<framework:default-parameter name="%%app_name%%" value="My application" />
14-
<framework:default-parameter name="{app_version}" value="1.2.3" />
13+
<framework:global name="%%app_name%%" value="My application" />
14+
<framework:global name="{app_version}" value="1.2.3" />
1515
</framework:translator>
1616
</framework:config>
1717
</container>
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ framework:
55
php_errors:
66
log: true
77
translator:
8-
default_parameters:
8+
globals:
99
'%%app_name%%': 'My application'
1010
'{app_version}': '1.2.3'
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ framework:
55
php_errors:
66
log: true
77
translator:
8-
default_parameters: []
8+
globals: []

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTestCase.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTestCase.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,18 +1198,18 @@ public function testTranslatorCacheDirDisabled()
11981198
$this->assertNull($options['cache_dir']);
11991199
}
12001200

1201-
public function testTranslatorDefaultParameters()
1201+
public function testTranslatorGlobals()
12021202
{
1203-
$container = $this->createContainerFromFile('translator_default_parameters');
1203+
$container = $this->createContainerFromFile('translator_globals');
12041204
$this->assertSame(
12051205
['%%app_name%%' => 'My application', '{app_version}' => '1.2.3'],
12061206
$container->getDefinition('translator.default_parameters')->getArgument(1),
12071207
);
12081208
}
12091209

1210-
public function testTranslatorWithoutDefaultParameters()
1210+
public function testTranslatorWithoutGlobals()
12111211
{
1212-
$container = $this->createContainerFromFile('translator_without_default_parameters');
1212+
$container = $this->createContainerFromFile('translator_without_globals');
12131213
$this->assertFalse($container->hasDefinition('translator.default_parameters'));
12141214
}
12151215

‎src/Symfony/Component/Translation/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/Translation/CHANGELOG.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ CHANGELOG
55
---
66

77
* Mark class `DataCollectorTranslator` as `final`
8-
* Add `DefaultParametersTranslator` to allow defining default parameters
8+
* Add `GlobalsTranslator` to allow defining default parameters
99

1010
7.0
1111
---

‎src/Symfony/Component/Translation/DefaultParametersTranslator.php renamed to ‎src/Symfony/Component/Translation/GlobalsTranslator.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Translation/GlobalsTranslator.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@
1313

1414
use Symfony\Contracts\Translation\TranslatorInterface;
1515

16-
final class DefaultParametersTranslator implements TranslatorInterface
16+
final class GlobalsTranslator implements TranslatorInterface
1717
{
1818
/**
19-
* @param array<string, string> $defaultParameters
19+
* @param array<string, string> $globals
2020
*/
2121
public function __construct(
2222
private readonly TranslatorInterface $translator,
23-
private readonly array $defaultParameters,
23+
private readonly array $globals,
2424
) {
2525
}
2626

2727
public function trans(string $id, array $parameters = [], string $domain = null, string $locale = null): string
2828
{
29-
$parameters = array_replace($this->defaultParameters, $parameters);
29+
$parameters = array_replace($this->globals, $parameters);
3030

3131
return $this->translator->trans($id, $parameters, $domain, $locale);
3232
}

‎src/Symfony/Component/Translation/Tests/DefaultParametersTranslatorTest.php renamed to ‎src/Symfony/Component/Translation/Tests/GlobalsTranslatorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Translation/Tests/GlobalsTranslatorTest.php
+12-12Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
namespace Symfony\Component\Translation\Tests;
1313

1414
use PHPUnit\Framework\TestCase;
15-
use Symfony\Component\Translation\DefaultParametersTranslator;
15+
use Symfony\Component\Translation\GlobalsTranslator;
1616
use Symfony\Component\Translation\Loader\ArrayLoader;
1717
use Symfony\Component\Translation\MessageCatalogue;
1818
use Symfony\Component\Translation\Translator;
1919

20-
class DefaultParametersTranslatorTest extends TestCase
20+
class GlobalsTranslatorTest extends TestCase
2121
{
2222
public function testTrans()
2323
{
@@ -26,12 +26,12 @@ public function testTrans()
2626
$translator->addResource('array', ['welcome' => 'Welcome {name}!'], 'en');
2727
$translator->addResource('array', ['welcome' => 'Bienvenue {name}!'], 'fr');
2828

29-
$defaultParametersTranslator = new DefaultParametersTranslator($translator, ['{name}' => 'Global name']);
29+
$globalsTranslator = new GlobalsTranslator($translator, ['{name}' => 'Global name']);
3030

31-
$this->assertSame('Welcome Global name!', $defaultParametersTranslator->trans('welcome'));
32-
$this->assertSame('Bienvenue Global name!', $defaultParametersTranslator->trans('welcome', [], null, 'fr'));
33-
$this->assertSame('Welcome John!', $defaultParametersTranslator->trans('welcome', ['{name}' => 'John']));
34-
$this->assertSame('Bienvenue Jean!', $defaultParametersTranslator->trans('welcome', ['{name}' => 'Jean'], null, 'fr'));
31+
$this->assertSame('Welcome Global name!', $globalsTranslator->trans('welcome'));
32+
$this->assertSame('Bienvenue Global name!', $globalsTranslator->trans('welcome', [], null, 'fr'));
33+
$this->assertSame('Welcome John!', $globalsTranslator->trans('welcome', ['{name}' => 'John']));
34+
$this->assertSame('Bienvenue Jean!', $globalsTranslator->trans('welcome', ['{name}' => 'Jean'], null, 'fr'));
3535
}
3636

3737
public function testTransICU()
@@ -48,17 +48,17 @@ public function testTransICU()
4848
'apples' => '{apples, plural, =0 {There are no apples} one {There is one apple} other {There are # apples}}',
4949
], 'en', $domain);
5050

51-
$defaultParametersTranslator = new DefaultParametersTranslator($translator, ['{apples}' => 42]);
51+
$globalsTranslator = new GlobalsTranslator($translator, ['{apples}' => 42]);
5252

53-
$this->assertSame('There are 42 apples', $defaultParametersTranslator->trans('apples', [], $domain));
54-
$this->assertSame('There is one apple', $defaultParametersTranslator->trans('apples', ['{apples}' => 1], $domain));
53+
$this->assertSame('There are 42 apples', $globalsTranslator->trans('apples', [], $domain));
54+
$this->assertSame('There is one apple', $globalsTranslator->trans('apples', ['{apples}' => 1], $domain));
5555
}
5656

5757
public function testGetLocale()
5858
{
5959
$translator = new Translator('en');
60-
$defaultParametersTranslator = new DefaultParametersTranslator($translator, []);
60+
$globalsTranslator = new GlobalsTranslator($translator, []);
6161

62-
$this->assertSame('en', $defaultParametersTranslator->getLocale());
62+
$this->assertSame('en', $globalsTranslator->getLocale());
6363
}
6464
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.