Merge branch '4.2' into 4.3

* 4.2:
  [Translation] Fixed case sensitivity of lint:xliff command
  fix type hint for salt in PasswordEncoderInterface
  Simplify code - catch \Throwable capture all exceptions
  fix typo in PR #31802
  update italian validator translation
  Add missing translations
This commit is contained in:
Nicolas Grekas 2019-06-03 22:27:40 +02:00
commit 0a9d724d2a
8 changed files with 81 additions and 11 deletions

View File

@ -751,7 +751,6 @@ class Filesystem
return $result; return $result;
} catch (\Throwable $e) { } catch (\Throwable $e) {
} catch (\Exception $e) {
} }
\restore_error_handler(); \restore_error_handler();

View File

@ -494,7 +494,6 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
$fresh = true; $fresh = true;
} }
} catch (\Throwable $e) { } catch (\Throwable $e) {
} catch (\Exception $e) {
} finally { } finally {
error_reporting($errorLevel); error_reporting($errorLevel);
} }
@ -563,7 +562,6 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
try { try {
$oldContainer = include $cache->getPath(); $oldContainer = include $cache->getPath();
} catch (\Throwable $e) { } catch (\Throwable $e) {
} catch (\Exception $e) {
} finally { } finally {
error_reporting($errorLevel); error_reporting($errorLevel);
} }

View File

@ -48,8 +48,8 @@ abstract class BasePasswordEncoder implements PasswordEncoderInterface
/** /**
* Merges a password and a salt. * Merges a password and a salt.
* *
* @param string $password The password to be used * @param string $password The password to be used
* @param string $salt The salt to be used * @param string|null $salt The salt to be used
* *
* @return string a merged password and salt * @return string a merged password and salt
* *

View File

@ -23,8 +23,8 @@ interface PasswordEncoderInterface
/** /**
* Encodes the raw password. * Encodes the raw password.
* *
* @param string $raw The password to encode * @param string $raw The password to encode
* @param string $salt The salt * @param string|null $salt The salt
* *
* @return string The encoded password * @return string The encoded password
* *
@ -36,9 +36,9 @@ interface PasswordEncoderInterface
/** /**
* Checks a raw password against an encoded password. * Checks a raw password against an encoded password.
* *
* @param string $encoded An encoded password * @param string $encoded An encoded password
* @param string $raw A raw password * @param string $raw A raw password
* @param string $salt The salt * @param string|null $salt The salt
* *
* @return bool true if the password is valid, false otherwise * @return bool true if the password is valid, false otherwise
* *

View File

@ -124,7 +124,9 @@ EOF
$normalizedLocale = preg_quote(str_replace('-', '_', $targetLanguage), '/'); $normalizedLocale = preg_quote(str_replace('-', '_', $targetLanguage), '/');
// strict file names require translation files to be named '____.locale.xlf' // strict file names require translation files to be named '____.locale.xlf'
// otherwise, both '____.locale.xlf' and 'locale.____.xlf' are allowed // otherwise, both '____.locale.xlf' and 'locale.____.xlf' are allowed
$expectedFilenamePattern = $this->requireStrictFileNames ? sprintf('/^.*\.%s\.xlf/', $normalizedLocale) : sprintf('/^(.*\.%s\.xlf|%s\..*\.xlf)/', $normalizedLocale, $normalizedLocale); // also, the regexp matching must be case-insensitive, as defined for 'target-language' values
// http://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html#target-language
$expectedFilenamePattern = $this->requireStrictFileNames ? sprintf('/^.*\.(?i:%s)\.xlf/', $normalizedLocale) : sprintf('/^(.*\.(?i:%s)\.xlf|(?i:%s)\..*\.xlf)/', $normalizedLocale, $normalizedLocale);
if (0 === preg_match($expectedFilenamePattern, basename($file))) { if (0 === preg_match($expectedFilenamePattern, basename($file))) {
$errors[] = [ $errors[] = [

View File

@ -94,6 +94,17 @@ class XliffLintCommandTest extends TestCase
$this->assertContains('There is a mismatch between the language included in the file name ("messages.en.xlf") and the "es" value used in the "target-language" attribute of the file.', trim($tester->getDisplay())); $this->assertContains('There is a mismatch between the language included in the file name ("messages.en.xlf") and the "es" value used in the "target-language" attribute of the file.', trim($tester->getDisplay()));
} }
public function testLintTargetLanguageIsCaseInsensitive()
{
$tester = $this->createCommandTester();
$filename = $this->createFile('note', 'zh-cn', 'messages.zh_CN.xlf');
$tester->execute(['filename' => $filename], ['decorated' => false]);
$this->assertEquals(0, $tester->getStatusCode());
$this->assertContains('[OK] All 1 XLIFF files contain valid syntax.', trim($tester->getDisplay()));
}
/** /**
* @expectedException \RuntimeException * @expectedException \RuntimeException
*/ */

View File

@ -334,6 +334,34 @@
<source>This value should be valid JSON.</source> <source>This value should be valid JSON.</source>
<target>Ova vrijednost treba biti validan JSON.</target> <target>Ova vrijednost treba biti validan JSON.</target>
</trans-unit> </trans-unit>
<trans-unit id="87">
<source>This collection should contain only unique elements.</source>
<target>Ova kolekcija treba sadržavati samo unikatne elemente.</target>
</trans-unit>
<trans-unit id="88">
<source>This value should be positive.</source>
<target>Ova vrijednost treba biti pozitivna.</target>
</trans-unit>
<trans-unit id="89">
<source>This value should be either positive or zero.</source>
<target>Ova vrijednost treba biti pozitivna ili jednaka nuli.</target>
</trans-unit>
<trans-unit id="90">
<source>This value should be negative.</source>
<target>Ova vrijednost treba biti negativna.</target>
</trans-unit>
<trans-unit id="91">
<source>This value should be either negative or zero.</source>
<target>Ova vrijednost treba biti negativna ili jednaka nuli.</target>
</trans-unit>
<trans-unit id="92">
<source>This value is not a valid timezone.</source>
<target>Ova vrijednost nije validna vremenska zona.</target>
</trans-unit>
<trans-unit id="93">
<source>This password has been leaked in a data breach, it must not be used. Please use another password.</source>
<target>Ova lozinka je procurila u nekom od sigurnosnih propusta, te je potrebno koristiti drugu lozinku.</target>
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View File

@ -330,6 +330,38 @@
<source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source>
<target>Questo codice identificativo bancario (BIC) non è associato all'IBAN {{ iban }}.</target> <target>Questo codice identificativo bancario (BIC) non è associato all'IBAN {{ iban }}.</target>
</trans-unit> </trans-unit>
<trans-unit id="86">
<source>This value should be valid JSON.</source>
<target>Questo valore dovrebbe essere un JSON valido.</target>
</trans-unit>
<trans-unit id="87">
<source>This collection should contain only unique elements.</source>
<target>Questa collezione dovrebbe contenere solo elementi unici.</target>
</trans-unit>
<trans-unit id="88">
<source>This value should be positive.</source>
<target>Questo valore dovrebbe essere positivo.</target>
</trans-unit>
<trans-unit id="89">
<source>This value should be either positive or zero.</source>
<target>Questo valore dovrebbe essere positivo oppure zero.</target>
</trans-unit>
<trans-unit id="90">
<source>This value should be negative.</source>
<target>Questo valore dovrebbe essere negativo.</target>
</trans-unit>
<trans-unit id="91">
<source>This value should be either negative or zero.</source>
<target>Questo valore dovrebbe essere negativo oppure zero.</target>
</trans-unit>
<trans-unit id="92">
<source>This value is not a valid timezone.</source>
<target>Questo valore non è un fuso orario valido.</target>
</trans-unit>
<trans-unit id="93">
<source>This password has been leaked in a data breach, it must not be used. Please use another password.</source>
<target>Questa password è trapelata durante una compromissione di dati, non deve essere usata. Si prega di usare una password diversa.</target>
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>