diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/translation.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/translation.html.twig index b37da94681..a8a5c27365 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/translation.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/translation.html.twig @@ -13,7 +13,7 @@ {% set text %}
Locale | + {% if is_fallback %} +Fallback locale | + {% endif %}Domain | Times used | Message ID | @@ -177,6 +180,9 @@ {% for message in messages %}
---|---|---|---|---|
{{ message.locale }} | + {% if is_fallback %} +{{ message.fallbackLocale|default('-') }} | + {% endif %}{{ message.domain }} | {{ message.count }} |
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig
index bc42b1a5fe..083c70b419 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig
@@ -422,7 +422,7 @@
newToken = (newToken || token);
this.load(
'sfwdt' + token,
- '{{ path("_wdt", { "token": "xxxxxx" }) }}'.replace(/xxxxxx/, newToken),
+ '{{ path("_wdt", { "token": "xxxxxx" })|escape('js') }}'.replace(/xxxxxx/, newToken),
function(xhr, el) {
/* Evaluate in global scope scripts embedded inside the toolbar */
@@ -525,7 +525,7 @@
sfwdt.innerHTML = '\
\
\
- An error occurred while loading the web debug toolbar. Open the web profiler.\
+ An error occurred while loading the web debug toolbar. Open the web profiler.\
\
';
sfwdt.setAttribute('class', 'sf-toolbar sf-error-toolbar');
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php
index 7a9fd54695..2000e1501e 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php
@@ -32,8 +32,6 @@ class LanguageTypeTest extends BaseTypeTest
->createView()->vars['choices'];
$this->assertContainsEquals(new ChoiceView('en', 'en', 'English'), $choices);
- $this->assertContainsEquals(new ChoiceView('en_GB', 'en_GB', 'British English'), $choices);
- $this->assertContainsEquals(new ChoiceView('en_US', 'en_US', 'American English'), $choices);
$this->assertContainsEquals(new ChoiceView('fr', 'fr', 'French'), $choices);
$this->assertContainsEquals(new ChoiceView('my', 'my', 'Burmese'), $choices);
}
@@ -51,7 +49,6 @@ class LanguageTypeTest extends BaseTypeTest
// Don't check objects for identity
$this->assertContainsEquals(new ChoiceView('en', 'en', 'англійська'), $choices);
- $this->assertContainsEquals(new ChoiceView('en_US', 'en_US', 'англійська (США)'), $choices);
$this->assertContainsEquals(new ChoiceView('fr', 'fr', 'французька'), $choices);
$this->assertContainsEquals(new ChoiceView('my', 'my', 'бірманська'), $choices);
}
diff --git a/src/Symfony/Component/Translation/DataCollectorTranslator.php b/src/Symfony/Component/Translation/DataCollectorTranslator.php
index 0284b77e9b..7ef41839ab 100644
--- a/src/Symfony/Component/Translation/DataCollectorTranslator.php
+++ b/src/Symfony/Component/Translation/DataCollectorTranslator.php
@@ -157,6 +157,7 @@ class DataCollectorTranslator implements LegacyTranslatorInterface, TranslatorIn
$id = (string) $id;
$catalogue = $this->translator->getCatalogue($locale);
$locale = $catalogue->getLocale();
+ $fallbackLocale = null;
if ($catalogue->defines($id, $domain)) {
$state = self::MESSAGE_DEFINED;
} elseif ($catalogue->has($id, $domain)) {
@@ -165,10 +166,9 @@ class DataCollectorTranslator implements LegacyTranslatorInterface, TranslatorIn
$fallbackCatalogue = $catalogue->getFallbackCatalogue();
while ($fallbackCatalogue) {
if ($fallbackCatalogue->defines($id, $domain)) {
- $locale = $fallbackCatalogue->getLocale();
+ $fallbackLocale = $fallbackCatalogue->getLocale();
break;
}
-
$fallbackCatalogue = $fallbackCatalogue->getFallbackCatalogue();
}
} else {
@@ -177,6 +177,7 @@ class DataCollectorTranslator implements LegacyTranslatorInterface, TranslatorIn
$this->messages[] = [
'locale' => $locale,
+ 'fallbackLocale' => $fallbackLocale,
'domain' => $domain,
'id' => $id,
'translation' => $translation,
diff --git a/src/Symfony/Component/Translation/Tests/DataCollectorTranslatorTest.php b/src/Symfony/Component/Translation/Tests/DataCollectorTranslatorTest.php
index 138172e21d..06f4b20ba6 100644
--- a/src/Symfony/Component/Translation/Tests/DataCollectorTranslatorTest.php
+++ b/src/Symfony/Component/Translation/Tests/DataCollectorTranslatorTest.php
@@ -34,6 +34,7 @@ class DataCollectorTranslatorTest extends TestCase
'id' => 'foo',
'translation' => 'foo (en)',
'locale' => 'en',
+ 'fallbackLocale' => null,
'domain' => 'messages',
'state' => DataCollectorTranslator::MESSAGE_DEFINED,
'parameters' => [],
@@ -42,7 +43,8 @@ class DataCollectorTranslatorTest extends TestCase
$expectedMessages[] = [
'id' => 'bar',
'translation' => 'bar (fr)',
- 'locale' => 'fr',
+ 'locale' => 'en',
+ 'fallbackLocale' => 'fr',
'domain' => 'messages',
'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK,
'parameters' => [],
@@ -52,6 +54,7 @@ class DataCollectorTranslatorTest extends TestCase
'id' => 'choice',
'translation' => 'choice',
'locale' => 'en',
+ 'fallbackLocale' => null,
'domain' => 'messages',
'state' => DataCollectorTranslator::MESSAGE_MISSING,
'parameters' => ['%count%' => 0],
@@ -60,7 +63,8 @@ class DataCollectorTranslatorTest extends TestCase
$expectedMessages[] = [
'id' => 'bar_ru',
'translation' => 'bar (ru)',
- 'locale' => 'ru',
+ 'locale' => 'en',
+ 'fallbackLocale' => 'ru',
'domain' => 'messages',
'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK,
'parameters' => [],
@@ -69,7 +73,8 @@ class DataCollectorTranslatorTest extends TestCase
$expectedMessages[] = [
'id' => 'bar_ru',
'translation' => 'bar (ru)',
- 'locale' => 'ru',
+ 'locale' => 'en',
+ 'fallbackLocale' => 'ru',
'domain' => 'messages',
'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK,
'parameters' => ['foo' => 'bar'],
diff --git a/src/Symfony/Component/Validator/Constraints/UrlValidator.php b/src/Symfony/Component/Validator/Constraints/UrlValidator.php
index cc0522a62a..a15a92313f 100644
--- a/src/Symfony/Component/Validator/Constraints/UrlValidator.php
+++ b/src/Symfony/Component/Validator/Constraints/UrlValidator.php
@@ -26,7 +26,7 @@ class UrlValidator extends ConstraintValidator
(%s):// # protocol
(([\.\pL\pN-]+:)?([\.\pL\pN-]+)@)? # basic auth
(
- ([\pL\pN\pS\-\.])+(\.?([\pL\pN]|xn\-\-[\pL\pN-]+)+\.?) # a domain name
+ ([\pL\pN\pS\-\_\.])+(\.?([\pL\pN]|xn\-\-[\pL\pN-]+)+\.?) # a domain name
| # or
\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} # an IP address
| # or
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php
index 391d124db2..669e7d2d97 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php
@@ -73,7 +73,6 @@ class LanguageValidatorTest extends ConstraintValidatorTestCase
{
return [
['en'],
- ['en_US'],
['my'],
];
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php
index 31dacc4613..a073a390f2 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php
@@ -106,6 +106,8 @@ class UrlValidatorTest extends ConstraintValidatorTestCase
['http://www.example.museum'],
['https://example.com/'],
['https://example.com:80/'],
+ ['http://examp_le.com'],
+ ['http://www.sub_domain.examp_le.com'],
['http://www.example.coop/'],
['http://www.test-example.com/'],
['http://www.symfony.com/'],
@@ -239,7 +241,6 @@ class UrlValidatorTest extends ConstraintValidatorTestCase
['://example.com'],
['http ://example.com'],
['http:/example.com'],
- ['http://examp_le.com'],
['http://example.com::aa'],
['http://example.com:aa'],
['ftp://example.fr'],
|