From 60e0216a3a6b1c8f4614119ceee53cb94126279c Mon Sep 17 00:00:00 2001 From: SASSU Thomas <thomas.sassu5@etu.univ-lorraine.fr> Date: Tue, 3 Mar 2020 19:49:32 +0100 Subject: [PATCH] fonction eloquent et etc --- composer.json | 1 + composer.lock | 68 +- index.php | 168 +- php/script_TD1.php | 18 + src/controleurs/ControleurScript.php | 75 + vendor/composer/ClassLoader.php | 8 +- vendor/composer/autoload_psr4.php | 4 +- vendor/composer/autoload_static.php | 16 +- vendor/composer/installed.json | 775 +++--- vendor/doctrine/inflector/composer.json | 6 +- .../Doctrine/Common/Inflector/Inflector.php | 121 +- vendor/symfony/polyfill-mbstring/Mbstring.php | 9 +- .../symfony/polyfill-mbstring/composer.json | 2 +- vendor/symfony/translation/.gitignore | 3 - vendor/symfony/translation/CHANGELOG.md | 39 + .../translation/Catalogue/MergeOperation.php | 7 +- .../translation/Catalogue/TargetOperation.php | 7 +- .../translation/Command/XliffLintCommand.php | 116 +- .../TranslationDataCollector.php | 23 +- .../translation/DataCollectorTranslator.php | 39 +- .../TranslationDumperPass.php | 2 +- .../TranslationExtractorPass.php | 2 +- .../DependencyInjection/TranslatorPass.php | 34 +- .../translation/Dumper/DumperInterface.php | 3 +- .../symfony/translation/Dumper/FileDumper.php | 52 +- .../translation/Dumper/IcuResFileDumper.php | 4 +- .../translation/Dumper/JsonFileDumper.php | 6 +- .../translation/Dumper/MoFileDumper.php | 2 +- .../translation/Dumper/PoFileDumper.php | 82 +- .../translation/Dumper/QtFileDumper.php | 11 + .../translation/Dumper/XliffFileDumper.php | 23 +- .../translation/Dumper/YamlFileDumper.php | 2 +- .../Exception/ExceptionInterface.php | 2 +- .../Extractor/AbstractFileExtractor.php | 11 +- .../translation/Extractor/ChainExtractor.php | 3 +- .../Extractor/ExtractorInterface.php | 3 +- .../translation/Extractor/PhpExtractor.php | 21 +- .../Extractor/PhpStringTokenParser.php | 2 +- .../ChoiceMessageFormatterInterface.php | 2 + .../Formatter/MessageFormatter.php | 45 +- .../translation/IdentityTranslator.php | 48 +- vendor/symfony/translation/Interval.php | 5 +- vendor/symfony/translation/LICENSE | 2 +- .../translation/Loader/ArrayLoader.php | 28 +- .../translation/Loader/IcuDatFileLoader.php | 1 - .../translation/Loader/IcuResFileLoader.php | 1 - .../translation/Loader/JsonFileLoader.php | 6 +- .../translation/Loader/MoFileLoader.php | 5 +- .../translation/Loader/PhpFileLoader.php | 16 +- .../translation/Loader/XliffFileLoader.php | 227 +- .../translation/Loader/YamlFileLoader.php | 11 +- .../dic/xliff-core/xliff-core-1.2-strict.xsd | 2223 ----------------- .../schema/dic/xliff-core/xliff-core-2.0.xsd | 411 --- .../Loader/schema/dic/xliff-core/xml.xsd | 309 --- .../symfony/translation/LoggingTranslator.php | 39 +- .../symfony/translation/MessageCatalogue.php | 66 +- .../translation/MessageCatalogueInterface.php | 2 + .../symfony/translation/MessageSelector.php | 10 +- .../translation/PluralizationRules.php | 12 +- vendor/symfony/translation/README.md | 20 +- .../Tests/Catalogue/AbstractOperationTest.php | 74 - .../Tests/Catalogue/MergeOperationTest.php | 83 - .../Tests/Catalogue/TargetOperationTest.php | 82 - .../TranslationDataCollectorTest.php | 150 -- .../Tests/DataCollectorTranslatorTest.php | 97 - .../TranslationDumperPassTest.php | 48 - .../TranslationExtractorPassTest.php | 61 - .../TranslationPassTest.php | 103 - .../Tests/Dumper/CsvFileDumperTest.php | 30 - .../Tests/Dumper/FileDumperTest.php | 89 - .../Tests/Dumper/IcuResFileDumperTest.php | 29 - .../Tests/Dumper/IniFileDumperTest.php | 29 - .../Tests/Dumper/JsonFileDumperTest.php | 39 - .../Tests/Dumper/MoFileDumperTest.php | 29 - .../Tests/Dumper/PhpFileDumperTest.php | 29 - .../Tests/Dumper/PoFileDumperTest.php | 29 - .../Tests/Dumper/QtFileDumperTest.php | 29 - .../Tests/Dumper/XliffFileDumperTest.php | 115 - .../Tests/Dumper/YamlFileDumperTest.php | 45 - .../Tests/Extractor/PhpExtractorTest.php | 97 - .../Tests/Formatter/MessageFormatterTest.php | 82 - .../Tests/IdentityTranslatorTest.php | 112 - .../translation/Tests/IntervalTest.php | 47 - .../Tests/Loader/CsvFileLoaderTest.php | 57 - .../Tests/Loader/IcuDatFileLoaderTest.php | 60 - .../Tests/Loader/IcuResFileLoaderTest.php | 47 - .../Tests/Loader/IniFileLoaderTest.php | 49 - .../Tests/Loader/JsonFileLoaderTest.php | 58 - .../Tests/Loader/LocalizedTestCase.php | 24 - .../Tests/Loader/MoFileLoaderTest.php | 71 - .../Tests/Loader/PhpFileLoaderTest.php | 46 - .../Tests/Loader/PoFileLoaderTest.php | 120 - .../Tests/Loader/QtFileLoaderTest.php | 65 - .../Tests/Loader/XliffFileLoaderTest.php | 246 -- .../Tests/Loader/YamlFileLoaderTest.php | 65 - .../Tests/LoggingTranslatorTest.php | 50 - .../Tests/MessageCatalogueTest.php | 216 -- .../translation/Tests/MessageSelectorTest.php | 137 - .../Tests/PluralizationRulesTest.php | 122 - .../translation/Tests/TranslatorCacheTest.php | 312 --- .../translation/Tests/TranslatorTest.php | 547 ---- .../Tests/Util/ArrayConverterTest.php | 74 - .../Tests/Writer/TranslationWriterTest.php | 82 - .../Tests/fixtures/empty-translation.mo | Bin 49 -> 0 bytes .../Tests/fixtures/empty-translation.po | 3 - .../translation/Tests/fixtures/empty.csv | 0 .../translation/Tests/fixtures/empty.ini | 0 .../translation/Tests/fixtures/empty.json | 0 .../translation/Tests/fixtures/empty.mo | 0 .../translation/Tests/fixtures/empty.po | 0 .../translation/Tests/fixtures/empty.xlf | 0 .../translation/Tests/fixtures/empty.yml | 0 .../translation/Tests/fixtures/encoding.xlf | 16 - .../Tests/fixtures/escaped-id-plurals.po | 10 - .../translation/Tests/fixtures/escaped-id.po | 8 - .../fixtures/extractor/resource.format.engine | 0 .../this.is.a.template.format.engine | 0 .../fixtures/extractor/translation.html.php | 59 - .../Tests/fixtures/fuzzy-translations.po | 10 - .../Tests/fixtures/invalid-xml-resources.xlf | 23 - .../translation/Tests/fixtures/malformed.json | 3 - .../translation/Tests/fixtures/messages.yml | 3 - .../Tests/fixtures/messages_linear.yml | 2 - .../Tests/fixtures/missing-plurals.po | 4 - .../translation/Tests/fixtures/non-valid.xlf | 11 - .../translation/Tests/fixtures/non-valid.yml | 1 - .../translation/Tests/fixtures/plurals.mo | Bin 448 -> 0 bytes .../translation/Tests/fixtures/plurals.po | 7 - .../translation/Tests/fixtures/resname.xlf | 22 - .../resourcebundle/corrupted/resources.dat | 1 - .../Tests/fixtures/resourcebundle/dat/en.res | Bin 120 -> 0 bytes .../Tests/fixtures/resourcebundle/dat/en.txt | 3 - .../Tests/fixtures/resourcebundle/dat/fr.res | Bin 124 -> 0 bytes .../Tests/fixtures/resourcebundle/dat/fr.txt | 3 - .../resourcebundle/dat/packagelist.txt | 2 - .../fixtures/resourcebundle/dat/resources.dat | Bin 352 -> 0 bytes .../Tests/fixtures/resourcebundle/res/en.res | Bin 84 -> 0 bytes .../Tests/fixtures/resources-2.0-clean.xlf | 23 - .../resources-2.0-multi-segment-unit.xlf | 17 - .../Tests/fixtures/resources-2.0.xlf | 25 - .../Tests/fixtures/resources-clean.xlf | 25 - .../Tests/fixtures/resources-notes-meta.xlf | 26 - .../fixtures/resources-target-attributes.xlf | 14 - .../Tests/fixtures/resources-tool-info.xlf | 14 - .../translation/Tests/fixtures/resources.csv | 4 - .../Tests/fixtures/resources.dump.json | 1 - .../translation/Tests/fixtures/resources.ini | 1 - .../translation/Tests/fixtures/resources.json | 3 - .../translation/Tests/fixtures/resources.mo | Bin 52 -> 0 bytes .../translation/Tests/fixtures/resources.php | 5 - .../translation/Tests/fixtures/resources.po | 11 - .../translation/Tests/fixtures/resources.ts | 10 - .../translation/Tests/fixtures/resources.xlf | 23 - .../translation/Tests/fixtures/resources.yml | 1 - .../translation/Tests/fixtures/valid.csv | 4 - .../Tests/fixtures/with-attributes.xlf | 21 - .../Tests/fixtures/withdoctype.xlf | 12 - .../translation/Tests/fixtures/withnote.xlf | 22 - vendor/symfony/translation/Translator.php | 160 +- .../translation/TranslatorInterface.php | 5 +- .../translation/Writer/TranslationWriter.php | 29 +- .../Writer/TranslationWriterInterface.php | 5 +- vendor/symfony/translation/composer.json | 28 +- vendor/symfony/translation/phpunit.xml.dist | 30 - 164 files changed, 1449 insertions(+), 8496 deletions(-) create mode 100644 php/script_TD1.php create mode 100644 src/controleurs/ControleurScript.php delete mode 100644 vendor/symfony/translation/.gitignore delete mode 100644 vendor/symfony/translation/Loader/schema/dic/xliff-core/xliff-core-1.2-strict.xsd delete mode 100644 vendor/symfony/translation/Loader/schema/dic/xliff-core/xliff-core-2.0.xsd delete mode 100644 vendor/symfony/translation/Loader/schema/dic/xliff-core/xml.xsd delete mode 100644 vendor/symfony/translation/Tests/Catalogue/AbstractOperationTest.php delete mode 100644 vendor/symfony/translation/Tests/Catalogue/MergeOperationTest.php delete mode 100644 vendor/symfony/translation/Tests/Catalogue/TargetOperationTest.php delete mode 100644 vendor/symfony/translation/Tests/DataCollector/TranslationDataCollectorTest.php delete mode 100644 vendor/symfony/translation/Tests/DataCollectorTranslatorTest.php delete mode 100644 vendor/symfony/translation/Tests/DependencyInjection/TranslationDumperPassTest.php delete mode 100644 vendor/symfony/translation/Tests/DependencyInjection/TranslationExtractorPassTest.php delete mode 100644 vendor/symfony/translation/Tests/DependencyInjection/TranslationPassTest.php delete mode 100644 vendor/symfony/translation/Tests/Dumper/CsvFileDumperTest.php delete mode 100644 vendor/symfony/translation/Tests/Dumper/FileDumperTest.php delete mode 100644 vendor/symfony/translation/Tests/Dumper/IcuResFileDumperTest.php delete mode 100644 vendor/symfony/translation/Tests/Dumper/IniFileDumperTest.php delete mode 100644 vendor/symfony/translation/Tests/Dumper/JsonFileDumperTest.php delete mode 100644 vendor/symfony/translation/Tests/Dumper/MoFileDumperTest.php delete mode 100644 vendor/symfony/translation/Tests/Dumper/PhpFileDumperTest.php delete mode 100644 vendor/symfony/translation/Tests/Dumper/PoFileDumperTest.php delete mode 100644 vendor/symfony/translation/Tests/Dumper/QtFileDumperTest.php delete mode 100644 vendor/symfony/translation/Tests/Dumper/XliffFileDumperTest.php delete mode 100644 vendor/symfony/translation/Tests/Dumper/YamlFileDumperTest.php delete mode 100644 vendor/symfony/translation/Tests/Extractor/PhpExtractorTest.php delete mode 100644 vendor/symfony/translation/Tests/Formatter/MessageFormatterTest.php delete mode 100644 vendor/symfony/translation/Tests/IdentityTranslatorTest.php delete mode 100644 vendor/symfony/translation/Tests/IntervalTest.php delete mode 100644 vendor/symfony/translation/Tests/Loader/CsvFileLoaderTest.php delete mode 100644 vendor/symfony/translation/Tests/Loader/IcuDatFileLoaderTest.php delete mode 100644 vendor/symfony/translation/Tests/Loader/IcuResFileLoaderTest.php delete mode 100644 vendor/symfony/translation/Tests/Loader/IniFileLoaderTest.php delete mode 100644 vendor/symfony/translation/Tests/Loader/JsonFileLoaderTest.php delete mode 100644 vendor/symfony/translation/Tests/Loader/LocalizedTestCase.php delete mode 100644 vendor/symfony/translation/Tests/Loader/MoFileLoaderTest.php delete mode 100644 vendor/symfony/translation/Tests/Loader/PhpFileLoaderTest.php delete mode 100644 vendor/symfony/translation/Tests/Loader/PoFileLoaderTest.php delete mode 100644 vendor/symfony/translation/Tests/Loader/QtFileLoaderTest.php delete mode 100644 vendor/symfony/translation/Tests/Loader/XliffFileLoaderTest.php delete mode 100644 vendor/symfony/translation/Tests/Loader/YamlFileLoaderTest.php delete mode 100644 vendor/symfony/translation/Tests/LoggingTranslatorTest.php delete mode 100644 vendor/symfony/translation/Tests/MessageCatalogueTest.php delete mode 100644 vendor/symfony/translation/Tests/MessageSelectorTest.php delete mode 100644 vendor/symfony/translation/Tests/PluralizationRulesTest.php delete mode 100644 vendor/symfony/translation/Tests/TranslatorCacheTest.php delete mode 100644 vendor/symfony/translation/Tests/TranslatorTest.php delete mode 100644 vendor/symfony/translation/Tests/Util/ArrayConverterTest.php delete mode 100644 vendor/symfony/translation/Tests/Writer/TranslationWriterTest.php delete mode 100644 vendor/symfony/translation/Tests/fixtures/empty-translation.mo delete mode 100644 vendor/symfony/translation/Tests/fixtures/empty-translation.po delete mode 100644 vendor/symfony/translation/Tests/fixtures/empty.csv delete mode 100644 vendor/symfony/translation/Tests/fixtures/empty.ini delete mode 100644 vendor/symfony/translation/Tests/fixtures/empty.json delete mode 100644 vendor/symfony/translation/Tests/fixtures/empty.mo delete mode 100644 vendor/symfony/translation/Tests/fixtures/empty.po delete mode 100644 vendor/symfony/translation/Tests/fixtures/empty.xlf delete mode 100644 vendor/symfony/translation/Tests/fixtures/empty.yml delete mode 100644 vendor/symfony/translation/Tests/fixtures/encoding.xlf delete mode 100644 vendor/symfony/translation/Tests/fixtures/escaped-id-plurals.po delete mode 100644 vendor/symfony/translation/Tests/fixtures/escaped-id.po delete mode 100644 vendor/symfony/translation/Tests/fixtures/extractor/resource.format.engine delete mode 100644 vendor/symfony/translation/Tests/fixtures/extractor/this.is.a.template.format.engine delete mode 100644 vendor/symfony/translation/Tests/fixtures/extractor/translation.html.php delete mode 100644 vendor/symfony/translation/Tests/fixtures/fuzzy-translations.po delete mode 100644 vendor/symfony/translation/Tests/fixtures/invalid-xml-resources.xlf delete mode 100644 vendor/symfony/translation/Tests/fixtures/malformed.json delete mode 100644 vendor/symfony/translation/Tests/fixtures/messages.yml delete mode 100644 vendor/symfony/translation/Tests/fixtures/messages_linear.yml delete mode 100644 vendor/symfony/translation/Tests/fixtures/missing-plurals.po delete mode 100644 vendor/symfony/translation/Tests/fixtures/non-valid.xlf delete mode 100644 vendor/symfony/translation/Tests/fixtures/non-valid.yml delete mode 100644 vendor/symfony/translation/Tests/fixtures/plurals.mo delete mode 100644 vendor/symfony/translation/Tests/fixtures/plurals.po delete mode 100644 vendor/symfony/translation/Tests/fixtures/resname.xlf delete mode 100644 vendor/symfony/translation/Tests/fixtures/resourcebundle/corrupted/resources.dat delete mode 100644 vendor/symfony/translation/Tests/fixtures/resourcebundle/dat/en.res delete mode 100644 vendor/symfony/translation/Tests/fixtures/resourcebundle/dat/en.txt delete mode 100644 vendor/symfony/translation/Tests/fixtures/resourcebundle/dat/fr.res delete mode 100644 vendor/symfony/translation/Tests/fixtures/resourcebundle/dat/fr.txt delete mode 100644 vendor/symfony/translation/Tests/fixtures/resourcebundle/dat/packagelist.txt delete mode 100644 vendor/symfony/translation/Tests/fixtures/resourcebundle/dat/resources.dat delete mode 100644 vendor/symfony/translation/Tests/fixtures/resourcebundle/res/en.res delete mode 100644 vendor/symfony/translation/Tests/fixtures/resources-2.0-clean.xlf delete mode 100644 vendor/symfony/translation/Tests/fixtures/resources-2.0-multi-segment-unit.xlf delete mode 100644 vendor/symfony/translation/Tests/fixtures/resources-2.0.xlf delete mode 100644 vendor/symfony/translation/Tests/fixtures/resources-clean.xlf delete mode 100644 vendor/symfony/translation/Tests/fixtures/resources-notes-meta.xlf delete mode 100644 vendor/symfony/translation/Tests/fixtures/resources-target-attributes.xlf delete mode 100644 vendor/symfony/translation/Tests/fixtures/resources-tool-info.xlf delete mode 100644 vendor/symfony/translation/Tests/fixtures/resources.csv delete mode 100644 vendor/symfony/translation/Tests/fixtures/resources.dump.json delete mode 100644 vendor/symfony/translation/Tests/fixtures/resources.ini delete mode 100644 vendor/symfony/translation/Tests/fixtures/resources.json delete mode 100644 vendor/symfony/translation/Tests/fixtures/resources.mo delete mode 100644 vendor/symfony/translation/Tests/fixtures/resources.php delete mode 100644 vendor/symfony/translation/Tests/fixtures/resources.po delete mode 100644 vendor/symfony/translation/Tests/fixtures/resources.ts delete mode 100644 vendor/symfony/translation/Tests/fixtures/resources.xlf delete mode 100644 vendor/symfony/translation/Tests/fixtures/resources.yml delete mode 100644 vendor/symfony/translation/Tests/fixtures/valid.csv delete mode 100644 vendor/symfony/translation/Tests/fixtures/with-attributes.xlf delete mode 100644 vendor/symfony/translation/Tests/fixtures/withdoctype.xlf delete mode 100644 vendor/symfony/translation/Tests/fixtures/withnote.xlf delete mode 100644 vendor/symfony/translation/phpunit.xml.dist diff --git a/composer.json b/composer.json index d378585..18cb192 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,7 @@ { "require":{ "illuminate/database": "5.5.*", + "illuminate/pagination": ">=5.0", "php": ">=7.0", "slim/slim": "2.*" }, diff --git a/composer.lock b/composer.lock index 5d44437..8295e51 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "58ad4665ea57037daa2176094db2d412", + "content-hash": "cc18e66e95cadfdfa2cb91becd1b4524", "packages": [ { "name": "doctrine/inflector", @@ -220,6 +220,50 @@ ], "time": "2018-09-23T18:58:54+00:00" }, + { + "name": "illuminate/pagination", + "version": "v5.5.44", + "source": { + "type": "git", + "url": "https://github.com/illuminate/pagination.git", + "reference": "686b121987164d161fe3440f407014ad026bdbbc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/pagination/zipball/686b121987164d161fe3440f407014ad026bdbbc", + "reference": "686b121987164d161fe3440f407014ad026bdbbc", + "shasum": "" + }, + "require": { + "illuminate/contracts": "5.5.*", + "illuminate/support": "5.5.*", + "php": ">=7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.5-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Pagination\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Pagination package.", + "homepage": "https://laravel.com", + "time": "2017-10-13T15:07:13+00:00" + }, { "name": "illuminate/support", "version": "v5.5.44", @@ -529,16 +573,16 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.13.1", + "version": "v1.14.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f" + "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f", - "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/34094cfa9abe1f0f14f48f490772db7a775559f2", + "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2", "shasum": "" }, "require": { @@ -550,7 +594,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.14-dev" } }, "autoload": { @@ -584,20 +628,20 @@ "portable", "shim" ], - "time": "2019-11-27T14:18:11+00:00" + "time": "2020-01-13T11:15:53+00:00" }, { "name": "symfony/translation", - "version": "v4.4.3", + "version": "v4.4.5", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "f5d2ac46930238b30a9c2f1b17c905f3697d808c" + "reference": "0a19a77fba20818a969ef03fdaf1602de0546353" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/f5d2ac46930238b30a9c2f1b17c905f3697d808c", - "reference": "f5d2ac46930238b30a9c2f1b17c905f3697d808c", + "url": "https://api.github.com/repos/symfony/translation/zipball/0a19a77fba20818a969ef03fdaf1602de0546353", + "reference": "0a19a77fba20818a969ef03fdaf1602de0546353", "shasum": "" }, "require": { @@ -660,7 +704,7 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2020-01-15T13:29:06+00:00" + "time": "2020-02-04T09:32:40+00:00" }, { "name": "symfony/translation-contracts", diff --git a/index.php b/index.php index 3fd04db..fb872a7 100644 --- a/index.php +++ b/index.php @@ -3,9 +3,11 @@ require_once __DIR__ . '/vendor/autoload.php'; session_start(); use \Slim\Slim as Slim; use Illuminate\Database\Capsule\Manager as DB; +use \gp\controleurs\ControleurPrincipal as ControleurPrincipal; +use \gp\controleurs\ControleurScript as ControleurScript; $db = new DB(); -$db->addConnection(parse_ini_file('./src/conf/conf.ini')); +$db->addConnection(parse_ini_file('./conf/conf.ini')); $db->setAsGlobal(); $db->bootEloquent(); @@ -13,169 +15,15 @@ $db->bootEloquent(); $app = new \Slim\Slim(); $app->get('/',function () { - $c = new \fridgie\controleurs\ControleurPrincipal(); - $c->afficherAccueil(); + $c = new ControleurPrincipal(); +// $c->afficherAccueil(); }); -/* - * ---------------------------------------------------------------- - * Controleur Recette - * ---------------------------------------------------------------- - */ - -$app->get('/indexrecette', function() { - $c = new \fridgie\controleurs\ControleurRecette(); - $c->indexRecette(); -}); - -$app->get('/recette',function () { - $c = new \fridgie\controleurs\ControleurRecette(); - $c->getRecette(); -}); - -$app->post('/recette',function () { - $c = new \fridgie\controleurs\ControleurRecette(); - $c->afficherRecette(); -}); - -$app->get('/afficherrecette/:id',function ($id) { - $c = new \fridgie\controleurs\ControleurRecette(); - $c->afficherRecetteId($id); -}); - -$app->get('/nouvellerecette', function() { - $c = new \fridgie\controleurs\ControleurRecette(); - $c->formulaireInsererRecette(); -}); - -$app->post('/nouvellerecette', function() { - $c = new \fridgie\controleurs\ControleurRecette(); - $c->traitementformulaireInsererRecette(); -}); - -$app->get('/rechercherecette', function() { - $c = new \fridgie\controleurs\ControleurRecette(); - $c->formulaireRechercheRecette(); -}); - -$app->post('/rechercherecette', function() { - $c = new \fridgie\controleurs\ControleurRecette(); - $c->traitementFormulaireRechercheRecette(); -}); - -/* - * ---------------------------------------------------------------- - * Controleur Evenement - * ---------------------------------------------------------------- - */ - -$app->get('/indexevenement', function() { - $c = new \fridgie\controleurs\ControleurEvenement(); - $c->indexEvenement(); -}); - -$app->get('/creationevenement',function () { - $c = new \fridgie\controleurs\ControleurEvenement(); - $c->creerEvenement(); -}); - -$app->post('/creationevenement',function () { - $c = new \fridgie\controleurs\ControleurEvenement(); - $c->creerEvenementPost(); -}); - -$app->get('/afficherevenements', function() { - $c = new \fridgie\controleurs\ControleurEvenement(); - $c->afficherEvenements(); -}); - -$app->get('/afficherevenement/:token',function ($token) { - $c = new \fridgie\controleurs\ControleurEvenement(); - $c->afficherEvenement($token); +$app->get('/script_TD1/',function () { + $c = new ControleurScript(); + $c->td1(); }); -//$app->get('/participerevenement/:token', function($token) { -// $c = new \fridgie\controleurs\ControleurEvenement(); -// $c->participerEvenement($token); -//}); -$app->post('/participerevenement/:token', function($token) { - $c = new \fridgie\controleurs\ControleurEvenement(); - $c->participerEvenementPost($token); -}); - -//par nom -$app->get('/rechercheevenement/:recherche',function ($recherche) { - $c = new \fridgie\controleurs\ControleurEvenement(); - $c->rechercheEvenement($recherche); -}); - -/* - * ---------------------------------------------------------------- - * Controleur Ingredient - * ---------------------------------------------------------------- - */ - -$app->post('/apporteringredient/:token', function($token) { //token = token de l'event - $c = new \fridgie\controleurs\ControleurIngredient(); - $c->apporterIngredient($token); - header('Location: ../afficherevenement/' . $token); - exit(); -}); - -$app->get('/apporteringredient/:token', function($token) { //token = token de l'event - $c = new \fridgie\controleurs\ControleurIngredient(); - $c->apporterIngredientForm($token); -}); - -$app->get('/ingredient/:id', function($id) { //id = id de l'ingredient à afficher - $c = new \fridgie\controleurs\ControleurIngredient(); - $c->afficherIngredient($id); -}); - -/* - * ---------------------------------------------------------------- - * Controleur Client - * ---------------------------------------------------------------- - */ - -$app->get('/inscription', function() { - $c = new \fridgie\controleurs\ControleurClient(); - $c->creerCompte(); -}); - -$app->post('/inscription', function() { - $c = new \fridgie\controleurs\ControleurClient(); - $c->traitementInscription(); -}); - -$app->get('/connexion', function() { - $c = new \fridgie\controleurs\ControleurClient(); - if (isset($_SESSION['Connexion']) == true) { - header('Location: ./moncompte'); - exit(); - } - else $c->identification(); -}); - -$app->post('/connexion', function() { - $c = new \fridgie\controleurs\ControleurClient(); - $c->traitementIdentification(); -}); - -$app->post('/deconnexion', function() { - $c = new \fridgie\controleurs\ControleurClient(); - $c->deconnexion(); -}); - -$app->get('/moncompte', function() { - $c = new \fridgie\controleurs\ControleurClient(); - $c->afficherCompte(); -}); - -$app->post('/suppression', function() { - $c = new \fridgie\controleurs\ControleurClient(); - $c->delete(); -}); $app->run(); \ No newline at end of file diff --git a/php/script_TD1.php b/php/script_TD1.php new file mode 100644 index 0000000..ce837f8 --- /dev/null +++ b/php/script_TD1.php @@ -0,0 +1,18 @@ +<?php + +require_once __DIR__ . '../vendor/autoload.php'; +session_start(); + +use \Slim\Slim as Slim; +use Illuminate\Database\Capsule\Manager as DB; +use \gp\controleurs\ControleurPrincipal as ControleurPrincipal; +use \gp\controleurs\ControleurScript as ControleurScript; + +$db = new DB(); +$db->addConnection(parse_ini_file('./conf/conf.ini')); + +$db->setAsGlobal(); +$db->bootEloquent(); + +$c = new ControleurScript(); +$c->td1(); diff --git a/src/controleurs/ControleurScript.php b/src/controleurs/ControleurScript.php new file mode 100644 index 0000000..93d00a4 --- /dev/null +++ b/src/controleurs/ControleurScript.php @@ -0,0 +1,75 @@ +<?php + + +namespace gp\controleurs; + + +use gp\modeles\Platform; +use gp\modeles\Game; +use gp\modeles\Company; +use gp\modeles\Deck; + +class ControleurScript +{ + public function td1(){ + echo "script TD1"; + $tab=null; + $tab[] = $this->gameByName('Mario')->get(); + $tab[] = $this->CompanyByCountry('Japan')->get(); + $tab[] = $this->platformByBase('10000000')->get(); + $tab[] = Game::skip(21173)->take(442)->get(); + $data = Game::simplePaginate(500); + $s = "<p>--------------------------------------------------------<br>". + "Jeu contenant dans leur nom 'Mario'<br>". + "--------------------------------------------------------</p>"; + echo $s; + foreach ($tab[0] as $game){ + echo ("<p>{$game->name}</p>"); + } + $s= "<p>--------------------------------------------------------<br>". + "Compagnies installées au 'Japon'<br>". + "--------------------------------------------------------</p>"; + echo $s; + foreach ($tab[1] as $company){ + echo ("<p>{$company->name}</p>"); + } + $s = "<p>--------------------------------------------------------<br>". + "Plateformes dont la base installée est >= 10 000 000<br>". + "--------------------------------------------------------</p>"; + echo $s; + foreach ($tab[2] as $plat){ + echo ("<p>{$plat->name}</p>"); + } + $s = "<p>--------------------------------------------------------<br>". + "liste de 442 jeux à partir du 21173ème<br>". + "--------------------------------------------------------</p>"; + echo $s; + foreach ($tab[3] as $game){ + echo ("<p>{$game->name}</p>"); + } + $s = "<p>--------------------------------------------------------<br>". + "liste des jeux en paginant (taille des pages : 500)<br>". + "--------------------------------------------------------</p>"; + echo $s; + $res = ""; + foreach ($data as $t){ + $res = $res . "<p>$t->name</p>"; + } + $res = "<div class=\"container\"> + $res + </div>"; + echo $res; + } + + private function gameByName($name){ + return Game::where("name", "like", "%{$name}%"); + } + + private function companyByCountry($country){ + return Company::where("location_country", "like", "{$country}"); + } + + private function platformByBase($base){ + return Platform::where("install_base", ">=", "{$base}"); + } +} \ No newline at end of file diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php index 2c72175..fce8549 100644 --- a/vendor/composer/ClassLoader.php +++ b/vendor/composer/ClassLoader.php @@ -279,7 +279,7 @@ class ClassLoader */ public function setApcuPrefix($apcuPrefix) { - $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null; + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; } /** @@ -377,11 +377,11 @@ class ClassLoader $subPath = $class; while (false !== $lastPos = strrpos($subPath, '\\')) { $subPath = substr($subPath, 0, $lastPos); - $search = $subPath.'\\'; + $search = $subPath . '\\'; if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); foreach ($this->prefixDirsPsr4[$search] as $dir) { - $length = $this->prefixLengthsPsr4[$first][$search]; - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { + if (file_exists($file = $dir . $pathEnd)) { return $file; } } diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index b0ab100..6dea160 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -6,12 +6,14 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( - 'fridgie\\' => array($baseDir . '/src'), + 'gp\\' => array($baseDir . '/src'), 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'), + 'Symfony\\Contracts\\Translation\\' => array($vendorDir . '/symfony/translation-contracts'), 'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'), 'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'), 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), 'Illuminate\\Support\\' => array($vendorDir . '/illuminate/support'), + 'Illuminate\\Pagination\\' => array($vendorDir . '/illuminate/pagination'), 'Illuminate\\Database\\' => array($vendorDir . '/illuminate/database'), 'Illuminate\\Contracts\\' => array($vendorDir . '/illuminate/contracts'), 'Illuminate\\Container\\' => array($vendorDir . '/illuminate/container'), diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 1988477..b302af9 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -12,13 +12,14 @@ class ComposerStaticInit9dd92070b68bdceeba5acfcd17a6e4b5 ); public static $prefixLengthsPsr4 = array ( - 'f' => + 'g' => array ( - 'fridgie\\' => 8, + 'gp\\' => 3, ), 'S' => array ( 'Symfony\\Polyfill\\Mbstring\\' => 26, + 'Symfony\\Contracts\\Translation\\' => 30, 'Symfony\\Component\\Translation\\' => 30, ), 'P' => @@ -29,6 +30,7 @@ class ComposerStaticInit9dd92070b68bdceeba5acfcd17a6e4b5 'I' => array ( 'Illuminate\\Support\\' => 19, + 'Illuminate\\Pagination\\' => 22, 'Illuminate\\Database\\' => 20, 'Illuminate\\Contracts\\' => 21, 'Illuminate\\Container\\' => 21, @@ -40,7 +42,7 @@ class ComposerStaticInit9dd92070b68bdceeba5acfcd17a6e4b5 ); public static $prefixDirsPsr4 = array ( - 'fridgie\\' => + 'gp\\' => array ( 0 => __DIR__ . '/../..' . '/src', ), @@ -48,6 +50,10 @@ class ComposerStaticInit9dd92070b68bdceeba5acfcd17a6e4b5 array ( 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring', ), + 'Symfony\\Contracts\\Translation\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/translation-contracts', + ), 'Symfony\\Component\\Translation\\' => array ( 0 => __DIR__ . '/..' . '/symfony/translation', @@ -64,6 +70,10 @@ class ComposerStaticInit9dd92070b68bdceeba5acfcd17a6e4b5 array ( 0 => __DIR__ . '/..' . '/illuminate/support', ), + 'Illuminate\\Pagination\\' => + array ( + 0 => __DIR__ . '/..' . '/illuminate/pagination', + ), 'Illuminate\\Database\\' => array ( 0 => __DIR__ . '/..' . '/illuminate/database', diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 69355ed..fc262e7 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -1,37 +1,36 @@ [ { - "name": "kylekatarnls/update-helper", - "version": "1.2.0", - "version_normalized": "1.2.0.0", + "name": "doctrine/inflector", + "version": "1.3.1", + "version_normalized": "1.3.1.0", "source": { "type": "git", - "url": "https://github.com/kylekatarnls/update-helper.git", - "reference": "5786fa188e0361b9adf9e8199d7280d1b2db165e" + "url": "https://github.com/doctrine/inflector.git", + "reference": "ec3a55242203ffa6a4b27c58176da97ff0a7aec1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/kylekatarnls/update-helper/zipball/5786fa188e0361b9adf9e8199d7280d1b2db165e", - "reference": "5786fa188e0361b9adf9e8199d7280d1b2db165e", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/ec3a55242203ffa6a4b27c58176da97ff0a7aec1", + "reference": "ec3a55242203ffa6a4b27c58176da97ff0a7aec1", "shasum": "" }, "require": { - "composer-plugin-api": "^1.1.0 || ^2.0.0", - "php": ">=5.3.0" + "php": "^7.1" }, "require-dev": { - "codeclimate/php-test-reporter": "dev-master", - "composer/composer": "2.0.x-dev || ^2.0.0-dev", - "phpunit/phpunit": ">=4.8.35 <6.0" + "phpunit/phpunit": "^6.2" }, - "time": "2019-07-29T11:03:54+00:00", - "type": "composer-plugin", + "time": "2019-10-30T19:59:35+00:00", + "type": "library", "extra": { - "class": "UpdateHelper\\ComposerPlugin" + "branch-alias": { + "dev-master": "1.3.x-dev" + } }, "installation-source": "dist", "autoload": { - "psr-0": { - "UpdateHelper\\": "src/" + "psr-4": { + "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector" } }, "notification-url": "https://packagist.org/downloads/", @@ -40,41 +39,66 @@ ], "authors": [ { - "name": "Kyle", - "email": "kylekatarnls@gmail.com" + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" } ], - "description": "Update helper" + "description": "Common String Manipulations with regard to casing and singular/plural rules.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "inflection", + "pluralize", + "singularize", + "string" + ] }, { - "name": "psr/container", - "version": "1.0.0", - "version_normalized": "1.0.0.0", + "name": "illuminate/container", + "version": "v5.5.44", + "version_normalized": "5.5.44.0", "source": { "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + "url": "https://github.com/illuminate/container.git", + "reference": "7917f4c86ecf7f4d0efcfd83248ad3e301e08858" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "url": "https://api.github.com/repos/illuminate/container/zipball/7917f4c86ecf7f4d0efcfd83248ad3e301e08858", + "reference": "7917f4c86ecf7f4d0efcfd83248ad3e301e08858", "shasum": "" }, "require": { - "php": ">=5.3.0" + "illuminate/contracts": "5.5.*", + "php": ">=7.0", + "psr/container": "~1.0" }, - "time": "2017-02-14T16:28:37+00:00", + "time": "2018-01-19T17:58:33+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "5.5-dev" } }, "installation-source": "dist", "autoload": { "psr-4": { - "Psr\\Container\\": "src/" + "Illuminate\\Container\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -83,56 +107,45 @@ ], "authors": [ { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "name": "Taylor Otwell", + "email": "taylor@laravel.com" } ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" - ] + "description": "The Illuminate Container package.", + "homepage": "https://laravel.com" }, { - "name": "symfony/polyfill-mbstring", - "version": "v1.13.1", - "version_normalized": "1.13.1.0", + "name": "illuminate/contracts", + "version": "v5.5.44", + "version_normalized": "5.5.44.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f" + "url": "https://github.com/illuminate/contracts.git", + "reference": "b2a62b4a85485fca9cf5fa61a933ad64006ff528" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f", - "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f", + "url": "https://api.github.com/repos/illuminate/contracts/zipball/b2a62b4a85485fca9cf5fa61a933ad64006ff528", + "reference": "b2a62b4a85485fca9cf5fa61a933ad64006ff528", "shasum": "" }, "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" + "php": ">=7.0", + "psr/container": "~1.0", + "psr/simple-cache": "~1.0" }, - "time": "2019-11-27T14:18:11+00:00", + "time": "2018-03-20T15:34:35+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "5.5-dev" } }, "installation-source": "dist", "autoload": { "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] + "Illuminate\\Contracts\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -140,78 +153,54 @@ ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Taylor Otwell", + "email": "taylor@laravel.com" } ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ] + "description": "The Illuminate Contracts package.", + "homepage": "https://laravel.com" }, { - "name": "symfony/translation", - "version": "v3.4.36", - "version_normalized": "3.4.36.0", + "name": "illuminate/database", + "version": "v5.5.44", + "version_normalized": "5.5.44.0", "source": { "type": "git", - "url": "https://github.com/symfony/translation.git", - "reference": "0be25347c4a8695d9423fe897f4c774f46e97b51" + "url": "https://github.com/illuminate/database.git", + "reference": "f5403b3dd774eb89ff0ef5e633e57458c3dc537d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/0be25347c4a8695d9423fe897f4c774f46e97b51", - "reference": "0be25347c4a8695d9423fe897f4c774f46e97b51", + "url": "https://api.github.com/repos/illuminate/database/zipball/f5403b3dd774eb89ff0ef5e633e57458c3dc537d", + "reference": "f5403b3dd774eb89ff0ef5e633e57458c3dc537d", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/config": "<2.8", - "symfony/dependency-injection": "<3.4", - "symfony/yaml": "<3.4" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/finder": "~2.8|~3.0|~4.0", - "symfony/http-kernel": "~3.4|~4.0", - "symfony/intl": "^2.8.18|^3.2.5|~4.0", - "symfony/var-dumper": "~3.4|~4.0", - "symfony/yaml": "~3.4|~4.0" + "illuminate/container": "5.5.*", + "illuminate/contracts": "5.5.*", + "illuminate/support": "5.5.*", + "php": ">=7.0" }, "suggest": { - "psr/log-implementation": "To use logging capability in translator", - "symfony/config": "", - "symfony/yaml": "" + "doctrine/dbal": "Required to rename columns and drop SQLite columns (~2.5).", + "fzaninotto/faker": "Required to use the eloquent factory builder (~1.4).", + "illuminate/console": "Required to use the database commands (5.5.*).", + "illuminate/events": "Required to use the observers with Eloquent (5.5.*).", + "illuminate/filesystem": "Required to use the migrations (5.5.*).", + "illuminate/pagination": "Required to paginate the result set (5.5.*)." }, - "time": "2019-11-23T20:30:33+00:00", + "time": "2018-09-23T18:58:54+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "5.5-dev" } }, "installation-source": "dist", "autoload": { "psr-4": { - "Symfony\\Component\\Translation\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + "Illuminate\\Database\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -219,59 +208,50 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Taylor Otwell", + "email": "taylor@laravel.com" } ], - "description": "Symfony Translation Component", - "homepage": "https://symfony.com" + "description": "The Illuminate Database package.", + "homepage": "https://laravel.com", + "keywords": [ + "database", + "laravel", + "orm", + "sql" + ] }, { - "name": "nesbot/carbon", - "version": "1.39.1", - "version_normalized": "1.39.1.0", + "name": "illuminate/pagination", + "version": "v5.5.44", + "version_normalized": "5.5.44.0", "source": { "type": "git", - "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "4be0c005164249208ce1b5ca633cd57bdd42ff33" + "url": "https://github.com/illuminate/pagination.git", + "reference": "686b121987164d161fe3440f407014ad026bdbbc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/4be0c005164249208ce1b5ca633cd57bdd42ff33", - "reference": "4be0c005164249208ce1b5ca633cd57bdd42ff33", + "url": "https://api.github.com/repos/illuminate/pagination/zipball/686b121987164d161fe3440f407014ad026bdbbc", + "reference": "686b121987164d161fe3440f407014ad026bdbbc", "shasum": "" }, "require": { - "kylekatarnls/update-helper": "^1.1", - "php": ">=5.3.9", - "symfony/translation": "~2.6 || ~3.0 || ~4.0" - }, - "require-dev": { - "composer/composer": "^1.2", - "friendsofphp/php-cs-fixer": "~2", - "phpunit/phpunit": "^4.8.35 || ^5.7" + "illuminate/contracts": "5.5.*", + "illuminate/support": "5.5.*", + "php": ">=7.0" }, - "time": "2019-10-14T05:51:36+00:00", - "bin": [ - "bin/upgrade-carbon" - ], + "time": "2017-10-13T15:07:13+00:00", "type": "library", "extra": { - "update-helper": "Carbon\\Upgrade", - "laravel": { - "providers": [ - "Carbon\\Laravel\\ServiceProvider" - ] + "branch-alias": { + "dev-master": "5.5-dev" } }, "installation-source": "dist", "autoload": { "psr-4": { - "": "src/" + "Illuminate\\Pagination\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -280,49 +260,58 @@ ], "authors": [ { - "name": "Brian Nesbitt", - "email": "brian@nesbot.com", - "homepage": "http://nesbot.com" + "name": "Taylor Otwell", + "email": "taylor@laravel.com" } ], - "description": "A simple API extension for DateTime.", - "homepage": "http://carbon.nesbot.com", - "keywords": [ - "date", - "datetime", - "time" - ] + "description": "The Illuminate Pagination package.", + "homepage": "https://laravel.com" }, { - "name": "psr/simple-cache", - "version": "1.0.1", - "version_normalized": "1.0.1.0", + "name": "illuminate/support", + "version": "v5.5.44", + "version_normalized": "5.5.44.0", "source": { "type": "git", - "url": "https://github.com/php-fig/simple-cache.git", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" + "url": "https://github.com/illuminate/support.git", + "reference": "5c405512d75dcaf5d37791badce02d86ed8e4bc4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "url": "https://api.github.com/repos/illuminate/support/zipball/5c405512d75dcaf5d37791badce02d86ed8e4bc4", + "reference": "5c405512d75dcaf5d37791badce02d86ed8e4bc4", "shasum": "" }, "require": { - "php": ">=5.3.0" - }, - "time": "2017-10-23T01:57:42+00:00", - "type": "library", + "doctrine/inflector": "~1.1", + "ext-mbstring": "*", + "illuminate/contracts": "5.5.*", + "nesbot/carbon": "^1.24.1", + "php": ">=7.0" + }, + "replace": { + "tightenco/collect": "<5.5.33" + }, + "suggest": { + "illuminate/filesystem": "Required to use the composer class (5.5.*).", + "symfony/process": "Required to use the composer class (~3.3).", + "symfony/var-dumper": "Required to use the dd function (~3.3)." + }, + "time": "2018-08-10T19:40:01+00:00", + "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "5.5-dev" } }, "installation-source": "dist", "autoload": { "psr-4": { - "Psr\\SimpleCache\\": "src/" - } + "Illuminate\\Support\\": "" + }, + "files": [ + "helpers.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -330,50 +319,46 @@ ], "authors": [ { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "name": "Taylor Otwell", + "email": "taylor@laravel.com" } ], - "description": "Common interfaces for simple caching", - "keywords": [ - "cache", - "caching", - "psr", - "psr-16", - "simple-cache" - ] + "description": "The Illuminate Support package.", + "homepage": "https://laravel.com" }, { - "name": "illuminate/contracts", - "version": "v5.5.44", - "version_normalized": "5.5.44.0", + "name": "kylekatarnls/update-helper", + "version": "1.2.0", + "version_normalized": "1.2.0.0", "source": { "type": "git", - "url": "https://github.com/illuminate/contracts.git", - "reference": "b2a62b4a85485fca9cf5fa61a933ad64006ff528" + "url": "https://github.com/kylekatarnls/update-helper.git", + "reference": "5786fa188e0361b9adf9e8199d7280d1b2db165e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/contracts/zipball/b2a62b4a85485fca9cf5fa61a933ad64006ff528", - "reference": "b2a62b4a85485fca9cf5fa61a933ad64006ff528", + "url": "https://api.github.com/repos/kylekatarnls/update-helper/zipball/5786fa188e0361b9adf9e8199d7280d1b2db165e", + "reference": "5786fa188e0361b9adf9e8199d7280d1b2db165e", "shasum": "" }, "require": { - "php": ">=7.0", - "psr/container": "~1.0", - "psr/simple-cache": "~1.0" + "composer-plugin-api": "^1.1.0 || ^2.0.0", + "php": ">=5.3.0" }, - "time": "2018-03-20T15:34:35+00:00", - "type": "library", + "require-dev": { + "codeclimate/php-test-reporter": "dev-master", + "composer/composer": "2.0.x-dev || ^2.0.0-dev", + "phpunit/phpunit": ">=4.8.35 <6.0" + }, + "time": "2019-07-29T11:03:54+00:00", + "type": "composer-plugin", "extra": { - "branch-alias": { - "dev-master": "5.5-dev" - } + "class": "UpdateHelper\\ComposerPlugin" }, "installation-source": "dist", "autoload": { - "psr-4": { - "Illuminate\\Contracts\\": "" + "psr-0": { + "UpdateHelper\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -382,45 +367,54 @@ ], "authors": [ { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" + "name": "Kyle", + "email": "kylekatarnls@gmail.com" } ], - "description": "The Illuminate Contracts package.", - "homepage": "https://laravel.com" + "description": "Update helper" }, { - "name": "doctrine/inflector", - "version": "v1.2.0", - "version_normalized": "1.2.0.0", + "name": "nesbot/carbon", + "version": "1.39.1", + "version_normalized": "1.39.1.0", "source": { "type": "git", - "url": "https://github.com/doctrine/inflector.git", - "reference": "e11d84c6e018beedd929cff5220969a3c6d1d462" + "url": "https://github.com/briannesbitt/Carbon.git", + "reference": "4be0c005164249208ce1b5ca633cd57bdd42ff33" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/e11d84c6e018beedd929cff5220969a3c6d1d462", - "reference": "e11d84c6e018beedd929cff5220969a3c6d1d462", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/4be0c005164249208ce1b5ca633cd57bdd42ff33", + "reference": "4be0c005164249208ce1b5ca633cd57bdd42ff33", "shasum": "" }, "require": { - "php": "^7.0" + "kylekatarnls/update-helper": "^1.1", + "php": ">=5.3.9", + "symfony/translation": "~2.6 || ~3.0 || ~4.0" }, "require-dev": { - "phpunit/phpunit": "^6.2" + "composer/composer": "^1.2", + "friendsofphp/php-cs-fixer": "~2", + "phpunit/phpunit": "^4.8.35 || ^5.7" }, - "time": "2017-07-22T12:18:28+00:00", + "time": "2019-10-14T05:51:36+00:00", + "bin": [ + "bin/upgrade-carbon" + ], "type": "library", "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" + "update-helper": "Carbon\\Upgrade", + "laravel": { + "providers": [ + "Carbon\\Laravel\\ServiceProvider" + ] } }, "installation-source": "dist", "autoload": { "psr-4": { - "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector" + "": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -429,80 +423,49 @@ ], "authors": [ { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" + "name": "Brian Nesbitt", + "email": "brian@nesbot.com", + "homepage": "http://nesbot.com" } ], - "description": "Common String Manipulations with regard to casing and singular/plural rules.", - "homepage": "http://www.doctrine-project.org", + "description": "A simple API extension for DateTime.", + "homepage": "http://carbon.nesbot.com", "keywords": [ - "inflection", - "pluralize", - "singularize", - "string" + "date", + "datetime", + "time" ] }, { - "name": "illuminate/support", - "version": "v5.5.44", - "version_normalized": "5.5.44.0", + "name": "psr/container", + "version": "1.0.0", + "version_normalized": "1.0.0.0", "source": { "type": "git", - "url": "https://github.com/illuminate/support.git", - "reference": "5c405512d75dcaf5d37791badce02d86ed8e4bc4" + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/support/zipball/5c405512d75dcaf5d37791badce02d86ed8e4bc4", - "reference": "5c405512d75dcaf5d37791badce02d86ed8e4bc4", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", "shasum": "" }, "require": { - "doctrine/inflector": "~1.1", - "ext-mbstring": "*", - "illuminate/contracts": "5.5.*", - "nesbot/carbon": "^1.24.1", - "php": ">=7.0" - }, - "replace": { - "tightenco/collect": "<5.5.33" - }, - "suggest": { - "illuminate/filesystem": "Required to use the composer class (5.5.*).", - "symfony/process": "Required to use the composer class (~3.3).", - "symfony/var-dumper": "Required to use the dd function (~3.3)." + "php": ">=5.3.0" }, - "time": "2018-08-10T19:40:01+00:00", + "time": "2017-02-14T16:28:37+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "5.5-dev" + "dev-master": "1.0.x-dev" } }, "installation-source": "dist", "autoload": { "psr-4": { - "Illuminate\\Support\\": "" - }, - "files": [ - "helpers.php" - ] + "Psr\\Container\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -510,44 +473,49 @@ ], "authors": [ { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" } ], - "description": "The Illuminate Support package.", - "homepage": "https://laravel.com" + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ] }, { - "name": "illuminate/container", - "version": "v5.5.44", - "version_normalized": "5.5.44.0", + "name": "psr/simple-cache", + "version": "1.0.1", + "version_normalized": "1.0.1.0", "source": { "type": "git", - "url": "https://github.com/illuminate/container.git", - "reference": "7917f4c86ecf7f4d0efcfd83248ad3e301e08858" + "url": "https://github.com/php-fig/simple-cache.git", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/container/zipball/7917f4c86ecf7f4d0efcfd83248ad3e301e08858", - "reference": "7917f4c86ecf7f4d0efcfd83248ad3e301e08858", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", "shasum": "" }, "require": { - "illuminate/contracts": "5.5.*", - "php": ">=7.0", - "psr/container": "~1.0" + "php": ">=5.3.0" }, - "time": "2018-01-19T17:58:33+00:00", + "time": "2017-10-23T01:57:42+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "5.5-dev" + "dev-master": "1.0.x-dev" } }, "installation-source": "dist", "autoload": { "psr-4": { - "Illuminate\\Container\\": "" + "Psr\\SimpleCache\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -556,54 +524,104 @@ ], "authors": [ { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" } ], - "description": "The Illuminate Container package.", - "homepage": "https://laravel.com" + "description": "Common interfaces for simple caching", + "keywords": [ + "cache", + "caching", + "psr", + "psr-16", + "simple-cache" + ] }, { - "name": "illuminate/database", - "version": "v5.5.44", - "version_normalized": "5.5.44.0", + "name": "slim/slim", + "version": "2.6.3", + "version_normalized": "2.6.3.0", "source": { "type": "git", - "url": "https://github.com/illuminate/database.git", - "reference": "f5403b3dd774eb89ff0ef5e633e57458c3dc537d" + "url": "https://github.com/slimphp/Slim.git", + "reference": "9224ed81ac1c412881e8d762755e3d76ebf580c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/database/zipball/f5403b3dd774eb89ff0ef5e633e57458c3dc537d", - "reference": "f5403b3dd774eb89ff0ef5e633e57458c3dc537d", + "url": "https://api.github.com/repos/slimphp/Slim/zipball/9224ed81ac1c412881e8d762755e3d76ebf580c0", + "reference": "9224ed81ac1c412881e8d762755e3d76ebf580c0", "shasum": "" }, "require": { - "illuminate/container": "5.5.*", - "illuminate/contracts": "5.5.*", - "illuminate/support": "5.5.*", - "php": ">=7.0" + "php": ">=5.3.0" }, "suggest": { - "doctrine/dbal": "Required to rename columns and drop SQLite columns (~2.5).", - "fzaninotto/faker": "Required to use the eloquent factory builder (~1.4).", - "illuminate/console": "Required to use the database commands (5.5.*).", - "illuminate/events": "Required to use the observers with Eloquent (5.5.*).", - "illuminate/filesystem": "Required to use the migrations (5.5.*).", - "illuminate/pagination": "Required to paginate the result set (5.5.*)." + "ext-mcrypt": "Required for HTTP cookie encryption", + "phpseclib/mcrypt_compat": "Polyfil for mcrypt extension" }, - "time": "2018-09-23T18:58:54+00:00", + "time": "2017-01-07T12:21:41+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "Slim": "." + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Josh Lockhart", + "email": "info@joshlockhart.com", + "homepage": "http://www.joshlockhart.com/" + } + ], + "description": "Slim Framework, a PHP micro framework", + "homepage": "http://github.com/codeguy/Slim", + "keywords": [ + "microframework", + "rest", + "router" + ] + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.14.0", + "version_normalized": "1.14.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/34094cfa9abe1f0f14f48f490772db7a775559f2", + "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "time": "2020-01-13T11:15:53+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "5.5-dev" + "dev-master": "1.14-dev" } }, "installation-source": "dist", "autoload": { "psr-4": { - "Illuminate\\Database\\": "" - } + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -611,47 +629,134 @@ ], "authors": [ { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "The Illuminate Database package.", - "homepage": "https://laravel.com", + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", "keywords": [ - "database", - "laravel", - "orm", - "sql" + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" ] }, { - "name": "slim/slim", - "version": "2.6.3", - "version_normalized": "2.6.3.0", + "name": "symfony/translation", + "version": "v4.4.5", + "version_normalized": "4.4.5.0", "source": { "type": "git", - "url": "https://github.com/slimphp/Slim.git", - "reference": "9224ed81ac1c412881e8d762755e3d76ebf580c0" + "url": "https://github.com/symfony/translation.git", + "reference": "0a19a77fba20818a969ef03fdaf1602de0546353" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slimphp/Slim/zipball/9224ed81ac1c412881e8d762755e3d76ebf580c0", - "reference": "9224ed81ac1c412881e8d762755e3d76ebf580c0", + "url": "https://api.github.com/repos/symfony/translation/zipball/0a19a77fba20818a969ef03fdaf1602de0546353", + "reference": "0a19a77fba20818a969ef03fdaf1602de0546353", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": "^7.1.3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/translation-contracts": "^1.1.6|^2" + }, + "conflict": { + "symfony/config": "<3.4", + "symfony/dependency-injection": "<3.4", + "symfony/http-kernel": "<4.4", + "symfony/yaml": "<3.4" + }, + "provide": { + "symfony/translation-implementation": "1.0" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "^3.4|^4.0|^5.0", + "symfony/console": "^3.4|^4.0|^5.0", + "symfony/dependency-injection": "^3.4|^4.0|^5.0", + "symfony/finder": "~2.8|~3.0|~4.0|^5.0", + "symfony/http-kernel": "^4.4", + "symfony/intl": "^3.4|^4.0|^5.0", + "symfony/service-contracts": "^1.1.2|^2", + "symfony/yaml": "^3.4|^4.0|^5.0" }, "suggest": { - "ext-mcrypt": "Required for HTTP cookie encryption", - "phpseclib/mcrypt_compat": "Polyfil for mcrypt extension" + "psr/log-implementation": "To use logging capability in translator", + "symfony/config": "", + "symfony/yaml": "" }, - "time": "2017-01-07T12:21:41+00:00", + "time": "2020-02-04T09:32:40+00:00", "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.4-dev" + } + }, "installation-source": "dist", "autoload": { - "psr-0": { - "Slim": "." + "psr-4": { + "Symfony\\Component\\Translation\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Translation Component", + "homepage": "https://symfony.com" + }, + { + "name": "symfony/translation-contracts", + "version": "v2.0.1", + "version_normalized": "2.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/translation-contracts.git", + "reference": "8cc682ac458d75557203b2f2f14b0b92e1c744ed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/8cc682ac458d75557203b2f2f14b0b92e1c744ed", + "reference": "8cc682ac458d75557203b2f2f14b0b92e1c744ed", + "shasum": "" + }, + "require": { + "php": "^7.2.5" + }, + "suggest": { + "symfony/translation-implementation": "" + }, + "time": "2019-11-18T17:27:11+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Translation\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -660,17 +765,23 @@ ], "authors": [ { - "name": "Josh Lockhart", - "email": "info@joshlockhart.com", - "homepage": "http://www.joshlockhart.com/" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Slim Framework, a PHP micro framework", - "homepage": "http://github.com/codeguy/Slim", + "description": "Generic abstractions related to translation", + "homepage": "https://symfony.com", "keywords": [ - "microframework", - "rest", - "router" + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" ] } ] diff --git a/vendor/doctrine/inflector/composer.json b/vendor/doctrine/inflector/composer.json index e06b649..2189ff1 100644 --- a/vendor/doctrine/inflector/composer.json +++ b/vendor/doctrine/inflector/composer.json @@ -13,7 +13,7 @@ {"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"} ], "require": { - "php": "^7.0" + "php": "^7.1" }, "require-dev": { "phpunit/phpunit": "^6.2" @@ -22,11 +22,11 @@ "psr-4": { "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector" } }, "autoload-dev": { - "psr-4": { "Doctrine\\Tests\\Common\\Inflector\\": "tests/Doctrine/Common/Inflector" } + "psr-4": { "Doctrine\\Tests\\Common\\Inflector\\": "tests/Doctrine/Tests/Common/Inflector" } }, "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "1.3.x-dev" } } } diff --git a/vendor/doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php b/vendor/doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php index 3a951af..35b5c68 100644 --- a/vendor/doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php +++ b/vendor/doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php @@ -38,7 +38,7 @@ class Inflector /** * Plural inflector rules. * - * @var array + * @var string[][] */ private static $plural = array( 'rules' => array( @@ -53,6 +53,7 @@ class Inflector '/(?:([^f])fe|([lr])f)$/i' => '\1\2ves', '/sis$/i' => 'ses', '/([ti])um$/i' => '\1a', + '/(c)riterion$/i' => '\1riteria', '/(p)erson$/i' => '\1eople', '/(m)an$/i' => '\1en', '/(c)hild$/i' => '\1hildren', @@ -84,6 +85,7 @@ class Inflector 'beef' => 'beefs', 'brother' => 'brothers', 'cafe' => 'cafes', + 'canvas' => 'canvases', 'chateau' => 'chateaux', 'niveau' => 'niveaux', 'child' => 'children', @@ -98,8 +100,10 @@ class Inflector 'foot' => 'feet', 'fungus' => 'fungi', 'ganglion' => 'ganglions', + 'gas' => 'gases', 'genie' => 'genies', 'genus' => 'genera', + 'goose' => 'geese', 'graffito' => 'graffiti', 'hippopotamus' => 'hippopotami', 'hoof' => 'hoofs', @@ -138,6 +142,7 @@ class Inflector 'tornado' => 'tornadoes', 'trilby' => 'trilbys', 'turf' => 'turfs', + 'valve' => 'valves', 'volcano' => 'volcanoes', ) ); @@ -145,7 +150,7 @@ class Inflector /** * Singular inflector rules. * - * @var array + * @var string[][] */ private static $singular = array( 'rules' => array( @@ -174,9 +179,11 @@ class Inflector '/(hive)s$/i' => '\1', '/(drive)s$/i' => '\1', '/(dive)s$/i' => '\1', + '/(olive)s$/i' => '\1', '/([^fo])ves$/i' => '\1fe', '/(^analy)ses$/i' => '\1sis', '/(analy|diagno|^ba|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => '\1\2sis', + '/(c)riteria$/i' => '\1riterion', '/([ti])a$/i' => '\1um', '/(p)eople$/i' => '\1\2erson', '/(m)en$/i' => '\1an', @@ -196,21 +203,27 @@ class Inflector '.*pox', '.*sheep', '.*ss', + 'data', 'police', 'pants', 'clothes', ), 'irregular' => array( - 'caches' => 'cache', - 'criteria' => 'criterion', - 'curves' => 'curve', - 'emphases' => 'emphasis', - 'foes' => 'foe', - 'hoaxes' => 'hoax', - 'media' => 'medium', - 'neuroses' => 'neurosis', - 'waves' => 'wave', - 'oases' => 'oasis', + 'abuses' => 'abuse', + 'avalanches' => 'avalanche', + 'caches' => 'cache', + 'criteria' => 'criterion', + 'curves' => 'curve', + 'emphases' => 'emphasis', + 'foes' => 'foe', + 'geese' => 'goose', + 'graves' => 'grave', + 'hoaxes' => 'hoax', + 'media' => 'medium', + 'neuroses' => 'neurosis', + 'waves' => 'wave', + 'oases' => 'oasis', + 'valves' => 'valve', ) ); @@ -220,18 +233,18 @@ class Inflector * @var array */ private static $uninflected = array( - 'Amoyese', 'bison', 'Borghese', 'bream', 'breeches', 'britches', 'buffalo', 'cantus', - 'carp', 'chassis', 'clippers', 'cod', 'coitus', 'Congoese', 'contretemps', 'corps', - 'debris', 'diabetes', 'djinn', 'eland', 'elk', 'equipment', 'Faroese', 'flounder', - 'Foochowese', 'Furniture', 'gallows', 'Genevese', 'Genoese', 'Gilbertese', 'graffiti', - 'headquarters', 'herpes', 'hijinks', 'Hottentotese', 'information', 'innings', - 'jackanapes', 'Kiplingese', 'Kongoese', 'Lucchese', 'Luggage', 'mackerel', 'Maltese', '.*?media', - 'mews', 'moose', 'mumps', 'Nankingese', 'news', 'nexus', 'Niasese', - 'Pekingese', 'Piedmontese', 'pincers', 'Pistoiese', 'pliers', 'Portuguese', - 'proceedings', 'rabies', 'rice', 'rhinoceros', 'salmon', 'Sarawakese', 'scissors', - 'sea[- ]bass', 'series', 'Shavese', 'shears', 'siemens', 'species', 'staff', 'swine', - 'testes', 'trousers', 'trout', 'tuna', 'Vermontese', 'Wenchowese', 'whiting', - 'wildebeest', 'Yengeese' + '.*?media', 'Amoyese', 'audio', 'bison', 'Borghese', 'bream', 'breeches', + 'britches', 'buffalo', 'cantus', 'carp', 'chassis', 'clippers', 'cod', 'coitus', 'compensation', 'Congoese', + 'contretemps', 'coreopsis', 'corps', 'data', 'debris', 'deer', 'diabetes', 'djinn', 'education', 'eland', + 'elk', 'emoji', 'equipment', 'evidence', 'Faroese', 'feedback', 'fish', 'flounder', 'Foochowese', + 'Furniture', 'furniture', 'gallows', 'Genevese', 'Genoese', 'Gilbertese', 'gold', + 'headquarters', 'herpes', 'hijinks', 'Hottentotese', 'information', 'innings', 'jackanapes', 'jedi', + 'Kiplingese', 'knowledge', 'Kongoese', 'love', 'Lucchese', 'Luggage', 'mackerel', 'Maltese', 'metadata', + 'mews', 'moose', 'mumps', 'Nankingese', 'news', 'nexus', 'Niasese', 'nutrition', 'offspring', + 'Pekingese', 'Piedmontese', 'pincers', 'Pistoiese', 'plankton', 'pliers', 'pokemon', 'police', 'Portuguese', + 'proceedings', 'rabies', 'rain', 'rhinoceros', 'rice', 'salmon', 'Sarawakese', 'scissors', 'sea[- ]bass', + 'series', 'Shavese', 'shears', 'sheep', 'siemens', 'species', 'staff', 'swine', 'traffic', + 'trousers', 'trout', 'tuna', 'us', 'Vermontese', 'Wenchowese', 'wheat', 'whiting', 'wildebeest', 'Yengeese' ); /** @@ -250,36 +263,24 @@ class Inflector /** * Converts a word into the format for a Doctrine table name. Converts 'ModelName' to 'model_name'. - * - * @param string $word The word to tableize. - * - * @return string The tableized word. */ - public static function tableize($word) + public static function tableize(string $word) : string { return strtolower(preg_replace('~(?<=\\w)([A-Z])~', '_$1', $word)); } /** * Converts a word into the format for a Doctrine class name. Converts 'table_name' to 'TableName'. - * - * @param string $word The word to classify. - * - * @return string The classified word. */ - public static function classify($word) + public static function classify(string $word) : string { - return str_replace(' ', '', ucwords(strtr($word, '_-', ' '))); + return str_replace([' ', '_', '-'], '', ucwords($word, ' _-')); } /** * Camelizes a word. This uses the classify() method and turns the first character to lowercase. - * - * @param string $word The word to camelize. - * - * @return string The camelized word. */ - public static function camelize($word) + public static function camelize(string $word) : string { return lcfirst(self::classify($word)); } @@ -288,7 +289,7 @@ class Inflector * Uppercases words with configurable delimeters between words. * * Takes a string and capitalizes all of the words, like PHP's built-in - * ucwords function. This extends that behavior, however, by allowing the + * ucwords function. This extends that behavior, however, by allowing the * word delimeters to be configured, rather than only separating on * whitespace. * @@ -309,24 +310,16 @@ class Inflector * * @return string The string with all delimeter-separated words capitalized. */ - public static function ucwords($string, $delimiters = " \n\t\r\0\x0B-") + public static function ucwords(string $string, string $delimiters = " \n\t\r\0\x0B-") : string { - return preg_replace_callback( - '/[^' . preg_quote($delimiters, '/') . ']+/', - function($matches) { - return ucfirst($matches[0]); - }, - $string - ); + return ucwords($string, $delimiters); } /** * Clears Inflectors inflected value caches, and resets the inflection * rules to the initial values. - * - * @return void */ - public static function reset() + public static function reset() : void { if (empty(self::$initialState)) { self::$initialState = get_class_vars('Inflector'); @@ -335,7 +328,7 @@ class Inflector } foreach (self::$initialState as $key => $val) { - if ($key != 'initialState') { + if ($key !== 'initialState') { self::${$key} = $val; } } @@ -355,14 +348,14 @@ class Inflector * )); * }}} * - * @param string $type The type of inflection, either 'plural' or 'singular' - * @param array $rules An array of rules to be added. - * @param boolean $reset If true, will unset default inflections for all - * new rules that are being defined in $rules. + * @param string $type The type of inflection, either 'plural' or 'singular' + * @param array|iterable $rules An array of rules to be added. + * @param boolean $reset If true, will unset default inflections for all + * new rules that are being defined in $rules. * * @return void */ - public static function rules($type, $rules, $reset = false) + public static function rules(string $type, iterable $rules, bool $reset = false) : void { foreach ($rules as $rule => $pattern) { if ( ! is_array($pattern)) { @@ -400,7 +393,7 @@ class Inflector * * @return string The word in plural form. */ - public static function pluralize($word) + public static function pluralize(string $word) : string { if (isset(self::$cache['pluralize'][$word])) { return self::$cache['pluralize'][$word]; @@ -420,7 +413,7 @@ class Inflector } if (preg_match('/(.*)\\b(' . self::$plural['cacheIrregular'] . ')$/i', $word, $regs)) { - self::$cache['pluralize'][$word] = $regs[1] . substr($word, 0, 1) . substr(self::$plural['merged']['irregular'][strtolower($regs[2])], 1); + self::$cache['pluralize'][$word] = $regs[1] . $word[0] . substr(self::$plural['merged']['irregular'][strtolower($regs[2])], 1); return self::$cache['pluralize'][$word]; } @@ -447,7 +440,7 @@ class Inflector * * @return string The word in singular form. */ - public static function singularize($word) + public static function singularize(string $word) : string { if (isset(self::$cache['singularize'][$word])) { return self::$cache['singularize'][$word]; @@ -468,12 +461,12 @@ class Inflector } if (!isset(self::$singular['cacheUninflected']) || !isset(self::$singular['cacheIrregular'])) { - self::$singular['cacheUninflected'] = '(?:' . join('|', self::$singular['merged']['uninflected']) . ')'; - self::$singular['cacheIrregular'] = '(?:' . join('|', array_keys(self::$singular['merged']['irregular'])) . ')'; + self::$singular['cacheUninflected'] = '(?:' . implode('|', self::$singular['merged']['uninflected']) . ')'; + self::$singular['cacheIrregular'] = '(?:' . implode('|', array_keys(self::$singular['merged']['irregular'])) . ')'; } if (preg_match('/(.*)\\b(' . self::$singular['cacheIrregular'] . ')$/i', $word, $regs)) { - self::$cache['singularize'][$word] = $regs[1] . substr($word, 0, 1) . substr(self::$singular['merged']['irregular'][strtolower($regs[2])], 1); + self::$cache['singularize'][$word] = $regs[1] . $word[0] . substr(self::$singular['merged']['irregular'][strtolower($regs[2])], 1); return self::$cache['singularize'][$word]; } diff --git a/vendor/symfony/polyfill-mbstring/Mbstring.php b/vendor/symfony/polyfill-mbstring/Mbstring.php index bf882ba..15503bc 100644 --- a/vendor/symfony/polyfill-mbstring/Mbstring.php +++ b/vendor/symfony/polyfill-mbstring/Mbstring.php @@ -545,7 +545,14 @@ final class Mbstring } if ('UTF-8' === $encoding = self::getEncoding($encoding)) { - return preg_split("/(.{{$split_length}})/u", $string, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); + $rx = '/('; + while (65535 < $split_length) { + $rx .= '.{65535}'; + $split_length -= 65535; + } + $rx .= '.{'.$split_length.'})/us'; + + return preg_split($rx, $string, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); } $result = array(); diff --git a/vendor/symfony/polyfill-mbstring/composer.json b/vendor/symfony/polyfill-mbstring/composer.json index c968074..1a8bec5 100644 --- a/vendor/symfony/polyfill-mbstring/composer.json +++ b/vendor/symfony/polyfill-mbstring/composer.json @@ -28,7 +28,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.14-dev" } } } diff --git a/vendor/symfony/translation/.gitignore b/vendor/symfony/translation/.gitignore deleted file mode 100644 index c49a5d8..0000000 --- a/vendor/symfony/translation/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -vendor/ -composer.lock -phpunit.xml diff --git a/vendor/symfony/translation/CHANGELOG.md b/vendor/symfony/translation/CHANGELOG.md index 105a67e..9784532 100644 --- a/vendor/symfony/translation/CHANGELOG.md +++ b/vendor/symfony/translation/CHANGELOG.md @@ -1,6 +1,45 @@ CHANGELOG ========= +4.4.0 +----- + + * deprecated support for using `null` as the locale in `Translator` + * deprecated accepting STDIN implicitly when using the `lint:xliff` command, use `lint:xliff -` (append a dash) instead to make it explicit. + * Marked the `TranslationDataCollector` class as `@final`. + +4.3.0 +----- + + * Improved Xliff 1.2 loader to load the original file's metadata + * Added `TranslatorPathsPass` + +4.2.0 +----- + + * Started using ICU parent locales as fallback locales. + * allow using the ICU message format using domains with the "+intl-icu" suffix + * deprecated `Translator::transChoice()` in favor of using `Translator::trans()` with a `%count%` parameter + * deprecated `TranslatorInterface` in favor of `Symfony\Contracts\Translation\TranslatorInterface` + * deprecated `MessageSelector`, `Interval` and `PluralizationRules`; use `IdentityTranslator` instead + * Added `IntlFormatter` and `IntlFormatterInterface` + * added support for multiple files and directories in `XliffLintCommand` + * Marked `Translator::getFallbackLocales()` and `TranslationDataCollector::getFallbackLocales()` as internal + +4.1.0 +----- + + * The `FileDumper::setBackup()` method is deprecated. + * The `TranslationWriter::disableBackup()` method is deprecated. + * The `XliffFileDumper` will write "name" on the "unit" node when dumping XLIFF 2.0. + +4.0.0 +----- + + * removed the backup feature of the `FileDumper` class + * removed `TranslationWriter::writeTranslations()` method + * removed support for passing `MessageSelector` instances to the constructor of the `Translator` class + 3.4.0 ----- diff --git a/vendor/symfony/translation/Catalogue/MergeOperation.php b/vendor/symfony/translation/Catalogue/MergeOperation.php index 4e1e3ce..d2f4abd 100644 --- a/vendor/symfony/translation/Catalogue/MergeOperation.php +++ b/vendor/symfony/translation/Catalogue/MergeOperation.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Translation\Catalogue; +use Symfony\Component\Translation\MessageCatalogueInterface; + /** * Merge operation between two catalogues as follows: * all = source ∪ target = {x: x ∈ source ∨ x ∈ target} @@ -32,10 +34,11 @@ class MergeOperation extends AbstractOperation 'new' => [], 'obsolete' => [], ]; + $intlDomain = $domain.MessageCatalogueInterface::INTL_DOMAIN_SUFFIX; foreach ($this->source->all($domain) as $id => $message) { $this->messages[$domain]['all'][$id] = $message; - $this->result->add([$id => $message], $domain); + $this->result->add([$id => $message], $this->source->defines($id, $intlDomain) ? $intlDomain : $domain); if (null !== $keyMetadata = $this->source->getMetadata($id, $domain)) { $this->result->setMetadata($id, $keyMetadata, $domain); } @@ -45,7 +48,7 @@ class MergeOperation extends AbstractOperation if (!$this->source->has($id, $domain)) { $this->messages[$domain]['all'][$id] = $message; $this->messages[$domain]['new'][$id] = $message; - $this->result->add([$id => $message], $domain); + $this->result->add([$id => $message], $this->target->defines($id, $intlDomain) ? $intlDomain : $domain); if (null !== $keyMetadata = $this->target->getMetadata($id, $domain)) { $this->result->setMetadata($id, $keyMetadata, $domain); } diff --git a/vendor/symfony/translation/Catalogue/TargetOperation.php b/vendor/symfony/translation/Catalogue/TargetOperation.php index 35eff71..22aa9a3 100644 --- a/vendor/symfony/translation/Catalogue/TargetOperation.php +++ b/vendor/symfony/translation/Catalogue/TargetOperation.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Translation\Catalogue; +use Symfony\Component\Translation\MessageCatalogueInterface; + /** * Target operation between two catalogues: * intersection = source ∩ target = {x: x ∈ source ∧ x ∈ target} @@ -33,6 +35,7 @@ class TargetOperation extends AbstractOperation 'new' => [], 'obsolete' => [], ]; + $intlDomain = $domain.MessageCatalogueInterface::INTL_DOMAIN_SUFFIX; // For 'all' messages, the code can't be simplified as ``$this->messages[$domain]['all'] = $target->all($domain);``, // because doing so will drop messages like {x: x ∈ source ∧ x ∉ target.all ∧ x ∈ target.fallback} @@ -46,7 +49,7 @@ class TargetOperation extends AbstractOperation foreach ($this->source->all($domain) as $id => $message) { if ($this->target->has($id, $domain)) { $this->messages[$domain]['all'][$id] = $message; - $this->result->add([$id => $message], $domain); + $this->result->add([$id => $message], $this->target->defines($id, $intlDomain) ? $intlDomain : $domain); if (null !== $keyMetadata = $this->source->getMetadata($id, $domain)) { $this->result->setMetadata($id, $keyMetadata, $domain); } @@ -59,7 +62,7 @@ class TargetOperation extends AbstractOperation if (!$this->source->has($id, $domain)) { $this->messages[$domain]['all'][$id] = $message; $this->messages[$domain]['new'][$id] = $message; - $this->result->add([$id => $message], $domain); + $this->result->add([$id => $message], $this->target->defines($id, $intlDomain) ? $intlDomain : $domain); if (null !== $keyMetadata = $this->target->getMetadata($id, $domain)) { $this->result->setMetadata($id, $keyMetadata, $domain); } diff --git a/vendor/symfony/translation/Command/XliffLintCommand.php b/vendor/symfony/translation/Command/XliffLintCommand.php index 922e026..3f8fe73 100644 --- a/vendor/symfony/translation/Command/XliffLintCommand.php +++ b/vendor/symfony/translation/Command/XliffLintCommand.php @@ -13,10 +13,13 @@ namespace Symfony\Component\Translation\Command; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Exception\RuntimeException; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; +use Symfony\Component\Translation\Exception\InvalidArgumentException; +use Symfony\Component\Translation\Util\XliffUtils; /** * Validates XLIFF files syntax and outputs encountered errors. @@ -33,13 +36,15 @@ class XliffLintCommand extends Command private $displayCorrectFiles; private $directoryIteratorProvider; private $isReadableProvider; + private $requireStrictFileNames; - public function __construct($name = null, $directoryIteratorProvider = null, $isReadableProvider = null) + public function __construct(string $name = null, callable $directoryIteratorProvider = null, callable $isReadableProvider = null, bool $requireStrictFileNames = true) { parent::__construct($name); $this->directoryIteratorProvider = $directoryIteratorProvider; $this->isReadableProvider = $isReadableProvider; + $this->requireStrictFileNames = $requireStrictFileNames; } /** @@ -49,7 +54,7 @@ class XliffLintCommand extends Command { $this ->setDescription('Lints a XLIFF file and outputs encountered errors') - ->addArgument('filename', null, 'A file or a directory or STDIN') + ->addArgument('filename', InputArgument::IS_ARRAY, 'A file, a directory or "-" for reading from STDIN') ->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format', 'txt') ->setHelp(<<<EOF The <info>%command.name%</info> command lints a XLIFF file and outputs to STDOUT @@ -57,7 +62,7 @@ the first encountered syntax error. You can validates XLIFF contents passed from STDIN: - <info>cat filename | php %command.full_name%</info> + <info>cat filename | php %command.full_name% -</info> You can also validate the syntax of a file: @@ -76,57 +81,82 @@ EOF protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); - $filename = $input->getArgument('filename'); + $filenames = (array) $input->getArgument('filename'); $this->format = $input->getOption('format'); $this->displayCorrectFiles = $output->isVerbose(); - if (!$filename) { - if (!$stdin = $this->getStdin()) { + if (['-'] === $filenames) { + return $this->display($io, [$this->validate(file_get_contents('php://stdin'))]); + } + + // @deprecated to be removed in 5.0 + if (!$filenames) { + if (0 !== ftell(STDIN)) { throw new RuntimeException('Please provide a filename or pipe file content to STDIN.'); } - return $this->display($io, [$this->validate($stdin)]); - } + @trigger_error('Piping content from STDIN to the "lint:xliff" command without passing the dash symbol "-" as argument is deprecated since Symfony 4.4.', E_USER_DEPRECATED); - if (!$this->isReadable($filename)) { - throw new RuntimeException(sprintf('File or directory "%s" is not readable.', $filename)); + return $this->display($io, [$this->validate(file_get_contents('php://stdin'))]); } $filesInfo = []; - foreach ($this->getFiles($filename) as $file) { - $filesInfo[] = $this->validate(file_get_contents($file), $file); + foreach ($filenames as $filename) { + if (!$this->isReadable($filename)) { + throw new RuntimeException(sprintf('File or directory "%s" is not readable.', $filename)); + } + + foreach ($this->getFiles($filename) as $file) { + $filesInfo[] = $this->validate(file_get_contents($file), $file); + } } return $this->display($io, $filesInfo); } - private function validate($content, $file = null) + private function validate(string $content, string $file = null): array { + $errors = []; + // Avoid: Warning DOMDocument::loadXML(): Empty string supplied as input if ('' === trim($content)) { return ['file' => $file, 'valid' => true]; } - libxml_use_internal_errors(true); + $internal = libxml_use_internal_errors(true); $document = new \DOMDocument(); $document->loadXML($content); - if ($document->schemaValidate(__DIR__.'/../Resources/schemas/xliff-core-1.2-strict.xsd')) { - return ['file' => $file, 'valid' => true]; + + if (null !== $targetLanguage = $this->getTargetLanguageFromFile($document)) { + $normalizedLocale = preg_quote(str_replace('-', '_', $targetLanguage), '/'); + // strict file names require translation files to be named '____.locale.xlf' + // otherwise, both '____.locale.xlf' and 'locale.____.xlf' are allowed + // 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|xliff)/', $normalizedLocale) : sprintf('/^(?:.*\.(?i:%s)|(?i:%s)\..*)\.(?:xlf|xliff)/', $normalizedLocale, $normalizedLocale); + + if (0 === preg_match($expectedFilenamePattern, basename($file))) { + $errors[] = [ + 'line' => -1, + 'column' => -1, + 'message' => sprintf('There is a mismatch between the language included in the file name ("%s") and the "%s" value used in the "target-language" attribute of the file.', basename($file), $targetLanguage), + ]; + } } - $errorMessages = array_map(function ($error) { - return [ - 'line' => $error->line, - 'column' => $error->column, - 'message' => trim($error->message), + foreach (XliffUtils::validateSchema($document) as $xmlError) { + $errors[] = [ + 'line' => $xmlError['line'], + 'column' => $xmlError['column'], + 'message' => $xmlError['message'], ]; - }, libxml_get_errors()); + } libxml_clear_errors(); - libxml_use_internal_errors(false); + libxml_use_internal_errors($internal); - return ['file' => $file, 'valid' => false, 'messages' => $errorMessages]; + return ['file' => $file, 'valid' => 0 === \count($errors), 'messages' => $errors]; } private function display(SymfonyStyle $io, array $files) @@ -184,7 +214,7 @@ EOF return min($errors, 1); } - private function getFiles($fileOrDirectory) + private function getFiles(string $fileOrDirectory) { if (is_file($fileOrDirectory)) { yield new \SplFileInfo($fileOrDirectory); @@ -201,24 +231,7 @@ EOF } } - /** - * @return string|null - */ - private function getStdin() - { - if (0 !== ftell(STDIN)) { - return null; - } - - $inputs = ''; - while (!feof(STDIN)) { - $inputs .= fread(STDIN, 1024); - } - - return $inputs; - } - - private function getDirectoryIterator($directory) + private function getDirectoryIterator(string $directory) { $default = function ($directory) { return new \RecursiveIteratorIterator( @@ -228,22 +241,33 @@ EOF }; if (null !== $this->directoryIteratorProvider) { - return \call_user_func($this->directoryIteratorProvider, $directory, $default); + return ($this->directoryIteratorProvider)($directory, $default); } return $default($directory); } - private function isReadable($fileOrDirectory) + private function isReadable(string $fileOrDirectory) { $default = function ($fileOrDirectory) { return is_readable($fileOrDirectory); }; if (null !== $this->isReadableProvider) { - return \call_user_func($this->isReadableProvider, $fileOrDirectory, $default); + return ($this->isReadableProvider)($fileOrDirectory, $default); } return $default($fileOrDirectory); } + + private function getTargetLanguageFromFile(\DOMDocument $xliffContents): ?string + { + foreach ($xliffContents->getElementsByTagName('file')[0]->attributes ?? [] as $attribute) { + if ('target-language' === $attribute->nodeName) { + return $attribute->nodeValue; + } + } + + return null; + } } diff --git a/vendor/symfony/translation/DataCollector/TranslationDataCollector.php b/vendor/symfony/translation/DataCollector/TranslationDataCollector.php index fc71346..9b6da11 100644 --- a/vendor/symfony/translation/DataCollector/TranslationDataCollector.php +++ b/vendor/symfony/translation/DataCollector/TranslationDataCollector.php @@ -16,9 +16,12 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\DataCollector\DataCollector; use Symfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface; use Symfony\Component\Translation\DataCollectorTranslator; +use Symfony\Component\VarDumper\Cloner\Data; /** * @author Abdellatif Ait boudad <a.aitboudad@gmail.com> + * + * @final since Symfony 4.4 */ class TranslationDataCollector extends DataCollector implements LateDataCollectorInterface { @@ -36,20 +39,21 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto { $messages = $this->sanitizeCollectedMessages($this->translator->getCollectedMessages()); - $this->data = $this->computeCount($messages); + $this->data += $this->computeCount($messages); $this->data['messages'] = $messages; - $this->data['locale'] = $this->translator->getLocale(); - $this->data['fallback_locales'] = $this->translator->getFallbackLocales(); - $this->data = $this->cloneVar($this->data); } /** * {@inheritdoc} + * + * @param \Throwable|null $exception */ - public function collect(Request $request, Response $response, \Exception $exception = null) + public function collect(Request $request, Response $response/*, \Throwable $exception = null*/) { + $this->data['locale'] = $this->translator->getLocale(); + $this->data['fallback_locales'] = $this->translator->getFallbackLocales(); } /** @@ -97,6 +101,9 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto return !empty($this->data['locale']) ? $this->data['locale'] : null; } + /** + * @internal since Symfony 4.2 + */ public function getFallbackLocales() { return (isset($this->data['fallback_locales']) && \count($this->data['fallback_locales']) > 0) ? $this->data['fallback_locales'] : []; @@ -110,7 +117,7 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto return 'translation'; } - private function sanitizeCollectedMessages($messages) + private function sanitizeCollectedMessages(array $messages) { $result = []; foreach ($messages as $key => $message) { @@ -135,7 +142,7 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto return $result; } - private function computeCount($messages) + private function computeCount(array $messages) { $count = [ DataCollectorTranslator::MESSAGE_DEFINED => 0, @@ -150,7 +157,7 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto return $count; } - private function sanitizeString($string, $length = 80) + private function sanitizeString(string $string, int $length = 80) { $string = trim(preg_replace('/\s+/', ' ', $string)); diff --git a/vendor/symfony/translation/DataCollectorTranslator.php b/vendor/symfony/translation/DataCollectorTranslator.php index e70e5f5..1c672b7 100644 --- a/vendor/symfony/translation/DataCollectorTranslator.php +++ b/vendor/symfony/translation/DataCollectorTranslator.php @@ -13,11 +13,14 @@ namespace Symfony\Component\Translation; use Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface; use Symfony\Component\Translation\Exception\InvalidArgumentException; +use Symfony\Component\Translation\TranslatorInterface as LegacyTranslatorInterface; +use Symfony\Contracts\Translation\LocaleAwareInterface; +use Symfony\Contracts\Translation\TranslatorInterface; /** * @author Abdellatif Ait boudad <a.aitboudad@gmail.com> */ -class DataCollectorTranslator implements TranslatorInterface, TranslatorBagInterface, WarmableInterface +class DataCollectorTranslator implements LegacyTranslatorInterface, TranslatorInterface, TranslatorBagInterface, WarmableInterface { const MESSAGE_DEFINED = 0; const MESSAGE_MISSING = 1; @@ -33,10 +36,13 @@ class DataCollectorTranslator implements TranslatorInterface, TranslatorBagInter /** * @param TranslatorInterface $translator The translator must implement TranslatorBagInterface */ - public function __construct(TranslatorInterface $translator) + public function __construct($translator) { - if (!$translator instanceof TranslatorBagInterface) { - throw new InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface and TranslatorBagInterface.', \get_class($translator))); + if (!$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) { + throw new \TypeError(sprintf('Argument 1 passed to %s() must be an instance of %s, %s given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator))); + } + if (!$translator instanceof TranslatorBagInterface || !$translator instanceof LocaleAwareInterface) { + throw new InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface, TranslatorBagInterface and LocaleAwareInterface.', \get_class($translator))); } $this->translator = $translator; @@ -55,11 +61,18 @@ class DataCollectorTranslator implements TranslatorInterface, TranslatorBagInter /** * {@inheritdoc} + * + * @deprecated since Symfony 4.2, use the trans() method instead with a %count% parameter */ public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null) { - $trans = $this->translator->transChoice($id, $number, $parameters, $domain, $locale); - $this->collectMessage($locale, $domain, $id, $trans, $parameters, $number); + if ($this->translator instanceof TranslatorInterface) { + $trans = $this->translator->trans($id, ['%count%' => $number] + $parameters, $domain, $locale); + } else { + $trans = $this->translator->transChoice($id, $number, $parameters, $domain, $locale); + } + + $this->collectMessage($locale, $domain, $id, $trans, ['%count%' => $number] + $parameters); return $trans; } @@ -117,7 +130,7 @@ class DataCollectorTranslator implements TranslatorInterface, TranslatorBagInter */ public function __call($method, $args) { - return \call_user_func_array([$this->translator, $method], $args); + return $this->translator->{$method}(...$args); } /** @@ -128,15 +141,7 @@ class DataCollectorTranslator implements TranslatorInterface, TranslatorBagInter return $this->messages; } - /** - * @param string|null $locale - * @param string|null $domain - * @param string $id - * @param string $translation - * @param array|null $parameters - * @param int|null $number - */ - private function collectMessage($locale, $domain, $id, $translation, $parameters = [], $number = null) + private function collectMessage(?string $locale, ?string $domain, ?string $id, string $translation, ?array $parameters = []) { if (null === $domain) { $domain = 'messages'; @@ -170,8 +175,8 @@ class DataCollectorTranslator implements TranslatorInterface, TranslatorBagInter 'id' => $id, 'translation' => $translation, 'parameters' => $parameters, - 'transChoiceNumber' => $number, 'state' => $state, + 'transChoiceNumber' => isset($parameters['%count%']) && is_numeric($parameters['%count%']) ? $parameters['%count%'] : null, ]; } } diff --git a/vendor/symfony/translation/DependencyInjection/TranslationDumperPass.php b/vendor/symfony/translation/DependencyInjection/TranslationDumperPass.php index 4656d66..930f36d 100644 --- a/vendor/symfony/translation/DependencyInjection/TranslationDumperPass.php +++ b/vendor/symfony/translation/DependencyInjection/TranslationDumperPass.php @@ -23,7 +23,7 @@ class TranslationDumperPass implements CompilerPassInterface private $writerServiceId; private $dumperTag; - public function __construct($writerServiceId = 'translation.writer', $dumperTag = 'translation.dumper') + public function __construct(string $writerServiceId = 'translation.writer', string $dumperTag = 'translation.dumper') { $this->writerServiceId = $writerServiceId; $this->dumperTag = $dumperTag; diff --git a/vendor/symfony/translation/DependencyInjection/TranslationExtractorPass.php b/vendor/symfony/translation/DependencyInjection/TranslationExtractorPass.php index bb4c5dc..d08b2ba 100644 --- a/vendor/symfony/translation/DependencyInjection/TranslationExtractorPass.php +++ b/vendor/symfony/translation/DependencyInjection/TranslationExtractorPass.php @@ -24,7 +24,7 @@ class TranslationExtractorPass implements CompilerPassInterface private $extractorServiceId; private $extractorTag; - public function __construct($extractorServiceId = 'translation.extractor', $extractorTag = 'translation.extractor') + public function __construct(string $extractorServiceId = 'translation.extractor', string $extractorTag = 'translation.extractor') { $this->extractorServiceId = $extractorServiceId; $this->extractorTag = $extractorTag; diff --git a/vendor/symfony/translation/DependencyInjection/TranslatorPass.php b/vendor/symfony/translation/DependencyInjection/TranslatorPass.php index 373a556..ed4a840 100644 --- a/vendor/symfony/translation/DependencyInjection/TranslatorPass.php +++ b/vendor/symfony/translation/DependencyInjection/TranslatorPass.php @@ -24,12 +24,8 @@ class TranslatorPass implements CompilerPassInterface private $debugCommandServiceId; private $updateCommandServiceId; - public function __construct($translatorServiceId = 'translator.default', $readerServiceId = 'translation.loader', $loaderTag = 'translation.loader', $debugCommandServiceId = 'console.command.translation_debug', $updateCommandServiceId = 'console.command.translation_update') + public function __construct(string $translatorServiceId = 'translator.default', string $readerServiceId = 'translation.reader', string $loaderTag = 'translation.loader', string $debugCommandServiceId = 'console.command.translation_debug', string $updateCommandServiceId = 'console.command.translation_update') { - if ('translation.loader' === $readerServiceId && 2 > \func_num_args()) { - @trigger_error(sprintf('The default value for $readerServiceId in "%s()" will change in 4.0 to "translation.reader".', __METHOD__), E_USER_DEPRECATED); - } - $this->translatorServiceId = $translatorServiceId; $this->readerServiceId = $readerServiceId; $this->loaderTag = $loaderTag; @@ -62,18 +58,6 @@ class TranslatorPass implements CompilerPassInterface } } - // Duplicated code to support "translation.reader", to be removed in 4.0 - if ('translation.reader' !== $this->readerServiceId) { - if ($container->hasDefinition('translation.reader')) { - $definition = $container->getDefinition('translation.reader'); - foreach ($loaders as $id => $formats) { - foreach ($formats as $format) { - $definition->addMethodCall('addLoader', [$format, $loaderRefs[$id]]); - } - } - } - } - $container ->findDefinition($this->translatorServiceId) ->replaceArgument(0, ServiceLocatorTagPass::register($container, $loaderRefs)) @@ -84,12 +68,22 @@ class TranslatorPass implements CompilerPassInterface return; } + $paths = array_keys($container->getDefinition('twig.template_iterator')->getArgument(2)); if ($container->hasDefinition($this->debugCommandServiceId)) { - $container->getDefinition($this->debugCommandServiceId)->replaceArgument(4, $container->getParameter('twig.default_path')); - } + $definition = $container->getDefinition($this->debugCommandServiceId); + $definition->replaceArgument(4, $container->getParameter('twig.default_path')); + if (\count($definition->getArguments()) > 6) { + $definition->replaceArgument(6, $paths); + } + } if ($container->hasDefinition($this->updateCommandServiceId)) { - $container->getDefinition($this->updateCommandServiceId)->replaceArgument(5, $container->getParameter('twig.default_path')); + $definition = $container->getDefinition($this->updateCommandServiceId); + $definition->replaceArgument(5, $container->getParameter('twig.default_path')); + + if (\count($definition->getArguments()) > 7) { + $definition->replaceArgument(7, $paths); + } } } } diff --git a/vendor/symfony/translation/Dumper/DumperInterface.php b/vendor/symfony/translation/Dumper/DumperInterface.php index 9965e80..445b701 100644 --- a/vendor/symfony/translation/Dumper/DumperInterface.php +++ b/vendor/symfony/translation/Dumper/DumperInterface.php @@ -24,8 +24,7 @@ interface DumperInterface /** * Dumps the message catalogue. * - * @param MessageCatalogue $messages The message catalogue - * @param array $options Options that are used by the dumper + * @param array $options Options that are used by the dumper */ public function dump(MessageCatalogue $messages, $options = []); } diff --git a/vendor/symfony/translation/Dumper/FileDumper.php b/vendor/symfony/translation/Dumper/FileDumper.php index 62a6caa..2009c53 100644 --- a/vendor/symfony/translation/Dumper/FileDumper.php +++ b/vendor/symfony/translation/Dumper/FileDumper.php @@ -17,7 +17,6 @@ use Symfony\Component\Translation\MessageCatalogue; /** * FileDumper is an implementation of DumperInterface that dump a message catalogue to file(s). - * Performs backup of already existing files. * * Options: * - path (mandatory): the directory where the files should be saved @@ -33,13 +32,6 @@ abstract class FileDumper implements DumperInterface */ protected $relativePathTemplate = '%domain%.%locale%.%extension%'; - /** - * Make file backup before the dump. - * - * @var bool - */ - private $backup = true; - /** * Sets the template for the relative paths to files. * @@ -54,10 +46,16 @@ abstract class FileDumper implements DumperInterface * Sets backup flag. * * @param bool $backup + * + * @deprecated since Symfony 4.1 */ public function setBackup($backup) { - $this->backup = $backup; + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1.', __METHOD__), E_USER_DEPRECATED); + + if (false !== $backup) { + throw new \LogicException('The backup feature is no longer supported.'); + } } /** @@ -71,20 +69,33 @@ abstract class FileDumper implements DumperInterface // save a file for each domain foreach ($messages->getDomains() as $domain) { - // backup $fullpath = $options['path'].'/'.$this->getRelativePath($domain, $messages->getLocale()); - if (file_exists($fullpath)) { - if ($this->backup) { - @trigger_error('Creating a backup while dumping a message catalogue is deprecated since Symfony 3.1 and will be removed in 4.0. Use TranslationWriter::disableBackup() to disable the backup.', E_USER_DEPRECATED); - copy($fullpath, $fullpath.'~'); - } - } else { + if (!file_exists($fullpath)) { $directory = \dirname($fullpath); if (!file_exists($directory) && !@mkdir($directory, 0777, true)) { throw new RuntimeException(sprintf('Unable to create directory "%s".', $directory)); } } - // save file + + $intlDomain = $domain.MessageCatalogue::INTL_DOMAIN_SUFFIX; + $intlMessages = $messages->all($intlDomain); + + if ($intlMessages) { + $intlPath = $options['path'].'/'.$this->getRelativePath($intlDomain, $messages->getLocale()); + file_put_contents($intlPath, $this->formatCatalogue($messages, $intlDomain, $options)); + + $messages->replace([], $intlDomain); + + try { + if ($messages->all($domain)) { + file_put_contents($fullpath, $this->formatCatalogue($messages, $domain, $options)); + } + continue; + } finally { + $messages->replace($intlMessages, $intlDomain); + } + } + file_put_contents($fullpath, $this->formatCatalogue($messages, $domain, $options)); } } @@ -107,13 +118,8 @@ abstract class FileDumper implements DumperInterface /** * Gets the relative file path using the template. - * - * @param string $domain The domain - * @param string $locale The locale - * - * @return string The relative file path */ - private function getRelativePath($domain, $locale) + private function getRelativePath(string $domain, string $locale): string { return strtr($this->relativePathTemplate, [ '%domain%' => $domain, diff --git a/vendor/symfony/translation/Dumper/IcuResFileDumper.php b/vendor/symfony/translation/Dumper/IcuResFileDumper.php index 9047a3b..829e0d0 100644 --- a/vendor/symfony/translation/Dumper/IcuResFileDumper.php +++ b/vendor/symfony/translation/Dumper/IcuResFileDumper.php @@ -82,14 +82,14 @@ class IcuResFileDumper extends FileDumper return $header.$root.$data; } - private function writePadding($data) + private function writePadding(string $data): ?string { $padding = \strlen($data) % 4; return $padding ? str_repeat("\xAA", 4 - $padding) : null; } - private function getPosition($data) + private function getPosition(string $data) { return (\strlen($data) + 28) / 4; } diff --git a/vendor/symfony/translation/Dumper/JsonFileDumper.php b/vendor/symfony/translation/Dumper/JsonFileDumper.php index 3ee446d..2af8231 100644 --- a/vendor/symfony/translation/Dumper/JsonFileDumper.php +++ b/vendor/symfony/translation/Dumper/JsonFileDumper.php @@ -25,11 +25,7 @@ class JsonFileDumper extends FileDumper */ public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) { - if (isset($options['json_encoding'])) { - $flags = $options['json_encoding']; - } else { - $flags = \defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0; - } + $flags = $options['json_encoding'] ?? JSON_PRETTY_PRINT; return json_encode($messages->all($domain), $flags); } diff --git a/vendor/symfony/translation/Dumper/MoFileDumper.php b/vendor/symfony/translation/Dumper/MoFileDumper.php index 27be16d..5a96dac 100644 --- a/vendor/symfony/translation/Dumper/MoFileDumper.php +++ b/vendor/symfony/translation/Dumper/MoFileDumper.php @@ -75,7 +75,7 @@ class MoFileDumper extends FileDumper return 'mo'; } - private function writeLong($str) + private function writeLong($str): string { return pack('V*', $str); } diff --git a/vendor/symfony/translation/Dumper/PoFileDumper.php b/vendor/symfony/translation/Dumper/PoFileDumper.php index 0f7e6fa..2cc9e88 100644 --- a/vendor/symfony/translation/Dumper/PoFileDumper.php +++ b/vendor/symfony/translation/Dumper/PoFileDumper.php @@ -39,13 +39,78 @@ class PoFileDumper extends FileDumper } else { $newLine = true; } - $output .= sprintf('msgid "%s"'."\n", $this->escape($source)); - $output .= sprintf('msgstr "%s"'."\n", $this->escape($target)); + $metadata = $messages->getMetadata($source, $domain); + + if (isset($metadata['comments'])) { + $output .= $this->formatComments($metadata['comments']); + } + if (isset($metadata['flags'])) { + $output .= $this->formatComments(implode(',', (array) $metadata['flags']), ','); + } + if (isset($metadata['sources'])) { + $output .= $this->formatComments(implode(' ', (array) $metadata['sources']), ':'); + } + + $sourceRules = $this->getStandardRules($source); + $targetRules = $this->getStandardRules($target); + if (2 == \count($sourceRules) && $targetRules !== []) { + $output .= sprintf('msgid "%s"'."\n", $this->escape($sourceRules[0])); + $output .= sprintf('msgid_plural "%s"'."\n", $this->escape($sourceRules[1])); + foreach ($targetRules as $i => $targetRule) { + $output .= sprintf('msgstr[%d] "%s"'."\n", $i, $this->escape($targetRule)); + } + } else { + $output .= sprintf('msgid "%s"'."\n", $this->escape($source)); + $output .= sprintf('msgstr "%s"'."\n", $this->escape($target)); + } } return $output; } + private function getStandardRules(string $id) + { + // Partly copied from TranslatorTrait::trans. + $parts = []; + if (preg_match('/^\|++$/', $id)) { + $parts = explode('|', $id); + } elseif (preg_match_all('/(?:\|\||[^\|])++/', $id, $matches)) { + $parts = $matches[0]; + } + + $intervalRegexp = <<<'EOF' +/^(?P<interval> + ({\s* + (\-?\d+(\.\d+)?[\s*,\s*\-?\d+(\.\d+)?]*) + \s*}) + + | + + (?P<left_delimiter>[\[\]]) + \s* + (?P<left>-Inf|\-?\d+(\.\d+)?) + \s*,\s* + (?P<right>\+?Inf|\-?\d+(\.\d+)?) + \s* + (?P<right_delimiter>[\[\]]) +)\s*(?P<message>.*?)$/xs +EOF; + + $standardRules = []; + foreach ($parts as $part) { + $part = trim(str_replace('||', '|', $part)); + + if (preg_match($intervalRegexp, $part)) { + // Explicit rule is not a standard rule. + return []; + } else { + $standardRules[] = $part; + } + } + + return $standardRules; + } + /** * {@inheritdoc} */ @@ -54,8 +119,19 @@ class PoFileDumper extends FileDumper return 'po'; } - private function escape($str) + private function escape(string $str): string { return addcslashes($str, "\0..\37\42\134"); } + + private function formatComments($comments, string $prefix = ''): ?string + { + $output = null; + + foreach ((array) $comments as $comment) { + $output .= sprintf('#%s %s'."\n", $prefix, $comment); + } + + return $output; + } } diff --git a/vendor/symfony/translation/Dumper/QtFileDumper.php b/vendor/symfony/translation/Dumper/QtFileDumper.php index ec93f92..79a64b2 100644 --- a/vendor/symfony/translation/Dumper/QtFileDumper.php +++ b/vendor/symfony/translation/Dumper/QtFileDumper.php @@ -33,6 +33,17 @@ class QtFileDumper extends FileDumper foreach ($messages->all($domain) as $source => $target) { $message = $context->appendChild($dom->createElement('message')); + $metadata = $messages->getMetadata($source, $domain); + if (isset($metadata['sources'])) { + foreach ((array) $metadata['sources'] as $location) { + $loc = explode(':', $location, 2); + $location = $message->appendChild($dom->createElement('location')); + $location->setAttribute('filename', $loc[0]); + if (isset($loc[1])) { + $location->setAttribute('line', $loc[1]); + } + } + } $message->appendChild($dom->createElement('source', $source)); $message->appendChild($dom->createElement('translation', $target)); } diff --git a/vendor/symfony/translation/Dumper/XliffFileDumper.php b/vendor/symfony/translation/Dumper/XliffFileDumper.php index f933be8..dd9d788 100644 --- a/vendor/symfony/translation/Dumper/XliffFileDumper.php +++ b/vendor/symfony/translation/Dumper/XliffFileDumper.php @@ -55,7 +55,7 @@ class XliffFileDumper extends FileDumper return 'xlf'; } - private function dumpXliff1($defaultLocale, MessageCatalogue $messages, $domain, array $options = []) + private function dumpXliff1(string $defaultLocale, MessageCatalogue $messages, ?string $domain, array $options = []) { $toolInfo = ['tool-id' => 'symfony', 'tool-name' => 'Symfony']; if (\array_key_exists('tool_info', $options)) { @@ -129,7 +129,7 @@ class XliffFileDumper extends FileDumper return $dom->saveXML(); } - private function dumpXliff2($defaultLocale, MessageCatalogue $messages, $domain) + private function dumpXliff2(string $defaultLocale, MessageCatalogue $messages, ?string $domain) { $dom = new \DOMDocument('1.0', 'utf-8'); $dom->formatOutput = true; @@ -141,11 +141,20 @@ class XliffFileDumper extends FileDumper $xliff->setAttribute('trgLang', str_replace('_', '-', $messages->getLocale())); $xliffFile = $xliff->appendChild($dom->createElement('file')); - $xliffFile->setAttribute('id', $domain.'.'.$messages->getLocale()); + if (MessageCatalogue::INTL_DOMAIN_SUFFIX === substr($domain, -($suffixLength = \strlen(MessageCatalogue::INTL_DOMAIN_SUFFIX)))) { + $xliffFile->setAttribute('id', substr($domain, 0, -$suffixLength).'.'.$messages->getLocale()); + } else { + $xliffFile->setAttribute('id', $domain.'.'.$messages->getLocale()); + } foreach ($messages->all($domain) as $source => $target) { $translation = $dom->createElement('unit'); $translation->setAttribute('id', strtr(substr(base64_encode(hash('sha256', $source, true)), 0, 7), '/+', '._')); + $name = $source; + if (\strlen($source) > 80) { + $name = substr(md5($source), -7); + } + $translation->setAttribute('name', $name); $metadata = $messages->getMetadata($source, $domain); // Add notes section @@ -187,13 +196,7 @@ class XliffFileDumper extends FileDumper return $dom->saveXML(); } - /** - * @param string $key - * @param array|null $metadata - * - * @return bool - */ - private function hasMetadataArrayInfo($key, $metadata = null) + private function hasMetadataArrayInfo(string $key, array $metadata = null): bool { return null !== $metadata && \array_key_exists($key, $metadata) && ($metadata[$key] instanceof \Traversable || \is_array($metadata[$key])); } diff --git a/vendor/symfony/translation/Dumper/YamlFileDumper.php b/vendor/symfony/translation/Dumper/YamlFileDumper.php index f7e1bcb..d6e4af8 100644 --- a/vendor/symfony/translation/Dumper/YamlFileDumper.php +++ b/vendor/symfony/translation/Dumper/YamlFileDumper.php @@ -25,7 +25,7 @@ class YamlFileDumper extends FileDumper { private $extension; - public function __construct(/**string */$extension = 'yml') + public function __construct(string $extension = 'yml') { $this->extension = $extension; } diff --git a/vendor/symfony/translation/Exception/ExceptionInterface.php b/vendor/symfony/translation/Exception/ExceptionInterface.php index c85fb93..8f9c54e 100644 --- a/vendor/symfony/translation/Exception/ExceptionInterface.php +++ b/vendor/symfony/translation/Exception/ExceptionInterface.php @@ -16,6 +16,6 @@ namespace Symfony\Component\Translation\Exception; * * @author Fabien Potencier <fabien@symfony.com> */ -interface ExceptionInterface +interface ExceptionInterface extends \Throwable { } diff --git a/vendor/symfony/translation/Extractor/AbstractFileExtractor.php b/vendor/symfony/translation/Extractor/AbstractFileExtractor.php index 2da1fff..618df73 100644 --- a/vendor/symfony/translation/Extractor/AbstractFileExtractor.php +++ b/vendor/symfony/translation/Extractor/AbstractFileExtractor.php @@ -27,7 +27,7 @@ abstract class AbstractFileExtractor */ protected function extractFiles($resource) { - if (\is_array($resource) || $resource instanceof \Traversable) { + if (is_iterable($resource)) { $files = []; foreach ($resource as $file) { if ($this->canBeExtracted($file)) { @@ -43,14 +43,9 @@ abstract class AbstractFileExtractor return $files; } - /** - * @param string $file - * - * @return \SplFileInfo - */ - private function toSplFileInfo($file) + private function toSplFileInfo(string $file): \SplFileInfo { - return ($file instanceof \SplFileInfo) ? $file : new \SplFileInfo($file); + return new \SplFileInfo($file); } /** diff --git a/vendor/symfony/translation/Extractor/ChainExtractor.php b/vendor/symfony/translation/Extractor/ChainExtractor.php index 69ee2df..2683f5d 100644 --- a/vendor/symfony/translation/Extractor/ChainExtractor.php +++ b/vendor/symfony/translation/Extractor/ChainExtractor.php @@ -30,8 +30,7 @@ class ChainExtractor implements ExtractorInterface /** * Adds a loader to the translation extractor. * - * @param string $format The format of the loader - * @param ExtractorInterface $extractor The loader + * @param string $format The format of the loader */ public function addExtractor($format, ExtractorInterface $extractor) { diff --git a/vendor/symfony/translation/Extractor/ExtractorInterface.php b/vendor/symfony/translation/Extractor/ExtractorInterface.php index b4534fa..91de201 100644 --- a/vendor/symfony/translation/Extractor/ExtractorInterface.php +++ b/vendor/symfony/translation/Extractor/ExtractorInterface.php @@ -24,8 +24,7 @@ interface ExtractorInterface /** * Extracts translation messages from files, a file or a directory to the catalogue. * - * @param string|array $resource Files, a file or a directory - * @param MessageCatalogue $catalogue The catalogue + * @param string|array $resource Files, a file or a directory */ public function extract($resource, MessageCatalogue $catalogue); diff --git a/vendor/symfony/translation/Extractor/PhpExtractor.php b/vendor/symfony/translation/Extractor/PhpExtractor.php index ec2445d..5237bf6 100644 --- a/vendor/symfony/translation/Extractor/PhpExtractor.php +++ b/vendor/symfony/translation/Extractor/PhpExtractor.php @@ -81,12 +81,9 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface { $files = $this->extractFiles($resource); foreach ($files as $file) { - $this->parseTokens(token_get_all(file_get_contents($file)), $catalog); + $this->parseTokens(token_get_all(file_get_contents($file)), $catalog, $file); - if (\PHP_VERSION_ID >= 70000) { - // PHP 7 memory manager will not release after token_get_all(), see https://bugs.php.net/70098 - gc_mem_caches(); - } + gc_mem_caches(); } } @@ -198,10 +195,16 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface /** * Extracts trans message from PHP tokens. * - * @param array $tokens + * @param array $tokens + * @param string $filename */ - protected function parseTokens($tokens, MessageCatalogue $catalog) + protected function parseTokens($tokens, MessageCatalogue $catalog/*, string $filename*/) { + if (\func_num_args() < 3 && __CLASS__ !== static::class && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) { + @trigger_error(sprintf('The "%s()" method will have a new "string $filename" argument in version 5.0, not defining it is deprecated since Symfony 4.3.', __METHOD__), E_USER_DEPRECATED); + } + $filename = 2 < \func_num_args() ? func_get_arg(2) : ''; + $tokenIterator = new \ArrayIterator($tokens); for ($key = 0; $key < $tokenIterator->count(); ++$key) { @@ -238,6 +241,10 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface if ($message) { $catalog->set($message, $this->prefix.$message, $domain); + $metadata = $catalog->getMetadata($message, $domain) ?? []; + $normalizedFilename = preg_replace('{[\\\\/]+}', '/', $filename); + $metadata['sources'][] = $normalizedFilename.':'.$tokens[$key][2]; + $catalog->setMetadata($message, $metadata, $domain); break; } } diff --git a/vendor/symfony/translation/Extractor/PhpStringTokenParser.php b/vendor/symfony/translation/Extractor/PhpStringTokenParser.php index 8a8ccb1..4531e91 100644 --- a/vendor/symfony/translation/Extractor/PhpStringTokenParser.php +++ b/vendor/symfony/translation/Extractor/PhpStringTokenParser.php @@ -106,7 +106,7 @@ class PhpStringTokenParser ); } - private static function parseCallback($matches) + private static function parseCallback(array $matches): string { $str = $matches[1]; diff --git a/vendor/symfony/translation/Formatter/ChoiceMessageFormatterInterface.php b/vendor/symfony/translation/Formatter/ChoiceMessageFormatterInterface.php index 027b2eb..621dbb2 100644 --- a/vendor/symfony/translation/Formatter/ChoiceMessageFormatterInterface.php +++ b/vendor/symfony/translation/Formatter/ChoiceMessageFormatterInterface.php @@ -13,6 +13,8 @@ namespace Symfony\Component\Translation\Formatter; /** * @author Abdellatif Ait boudad <a.aitboudad@gmail.com> + * + * @deprecated since Symfony 4.2, use MessageFormatterInterface::format() with a %count% parameter instead */ interface ChoiceMessageFormatterInterface { diff --git a/vendor/symfony/translation/Formatter/MessageFormatter.php b/vendor/symfony/translation/Formatter/MessageFormatter.php index f7204c3..030d7a5 100644 --- a/vendor/symfony/translation/Formatter/MessageFormatter.php +++ b/vendor/symfony/translation/Formatter/MessageFormatter.php @@ -11,21 +11,32 @@ namespace Symfony\Component\Translation\Formatter; +use Symfony\Component\Translation\IdentityTranslator; use Symfony\Component\Translation\MessageSelector; +use Symfony\Component\Translation\TranslatorInterface as LegacyTranslatorInterface; +use Symfony\Contracts\Translation\TranslatorInterface; /** * @author Abdellatif Ait boudad <a.aitboudad@gmail.com> */ -class MessageFormatter implements MessageFormatterInterface, ChoiceMessageFormatterInterface +class MessageFormatter implements MessageFormatterInterface, IntlFormatterInterface, ChoiceMessageFormatterInterface { - private $selector; + private $translator; + private $intlFormatter; /** - * @param MessageSelector|null $selector The message selector for pluralization + * @param TranslatorInterface|null $translator An identity translator to use as selector for pluralization */ - public function __construct(MessageSelector $selector = null) + public function __construct($translator = null, IntlFormatterInterface $intlFormatter = null) { - $this->selector = $selector ?: new MessageSelector(); + if ($translator instanceof MessageSelector) { + $translator = new IdentityTranslator($translator); + } elseif (null !== $translator && !$translator instanceof TranslatorInterface && !$translator instanceof LegacyTranslatorInterface) { + throw new \TypeError(sprintf('Argument 1 passed to %s() must be an instance of %s, %s given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator))); + } + + $this->translator = $translator ?? new IdentityTranslator(); + $this->intlFormatter = $intlFormatter ?? new IntlFormatter(); } /** @@ -33,16 +44,36 @@ class MessageFormatter implements MessageFormatterInterface, ChoiceMessageFormat */ public function format($message, $locale, array $parameters = []) { + if ($this->translator instanceof TranslatorInterface) { + return $this->translator->trans($message, $parameters, null, $locale); + } + return strtr($message, $parameters); } /** * {@inheritdoc} */ + public function formatIntl(string $message, string $locale, array $parameters = []): string + { + return $this->intlFormatter->formatIntl($message, $locale, $parameters); + } + + /** + * {@inheritdoc} + * + * @deprecated since Symfony 4.2, use format() with a %count% parameter instead + */ public function choiceFormat($message, $number, $locale, array $parameters = []) { - $parameters = array_merge(['%count%' => $number], $parameters); + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the format() one instead with a %%count%% parameter.', __METHOD__), E_USER_DEPRECATED); + + $parameters = ['%count%' => $number] + $parameters; + + if ($this->translator instanceof TranslatorInterface) { + return $this->format($message, $locale, $parameters); + } - return $this->format($this->selector->choose($message, (int) $number, $locale), $locale, $parameters); + return $this->format($this->translator->transChoice($message, $number, [], null, $locale), $locale, $parameters); } } diff --git a/vendor/symfony/translation/IdentityTranslator.php b/vendor/symfony/translation/IdentityTranslator.php index 2d90509..87b40bf 100644 --- a/vendor/symfony/translation/IdentityTranslator.php +++ b/vendor/symfony/translation/IdentityTranslator.php @@ -11,53 +11,67 @@ namespace Symfony\Component\Translation; +use Symfony\Component\Translation\TranslatorInterface as LegacyTranslatorInterface; +use Symfony\Contracts\Translation\TranslatorInterface; +use Symfony\Contracts\Translation\TranslatorTrait; + /** * IdentityTranslator does not translate anything. * * @author Fabien Potencier <fabien@symfony.com> */ -class IdentityTranslator implements TranslatorInterface +class IdentityTranslator implements LegacyTranslatorInterface, TranslatorInterface { + use TranslatorTrait { + trans as private doTrans; + setLocale as private doSetLocale; + } + private $selector; - private $locale; - /** - * @param MessageSelector|null $selector The message selector for pluralization - */ public function __construct(MessageSelector $selector = null) { - $this->selector = $selector ?: new MessageSelector(); + $this->selector = $selector; + + if (__CLASS__ !== static::class) { + @trigger_error(sprintf('Calling "%s()" is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED); + } } /** * {@inheritdoc} */ - public function setLocale($locale) + public function trans($id, array $parameters = [], $domain = null, $locale = null) { - $this->locale = $locale; + return $this->doTrans($id, $parameters, $domain, $locale); } /** * {@inheritdoc} */ - public function getLocale() + public function setLocale($locale) { - return $this->locale ?: \Locale::getDefault(); + $this->doSetLocale($locale); } /** * {@inheritdoc} + * + * @deprecated since Symfony 4.2, use the trans() method instead with a %count% parameter */ - public function trans($id, array $parameters = [], $domain = null, $locale = null) + public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null) { - return strtr((string) $id, $parameters); + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the trans() one instead with a "%%count%%" parameter.', __METHOD__), E_USER_DEPRECATED); + + if ($this->selector) { + return strtr($this->selector->choose((string) $id, $number, $locale ?: $this->getLocale()), $parameters); + } + + return $this->trans($id, ['%count%' => $number] + $parameters, $domain, $locale); } - /** - * {@inheritdoc} - */ - public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null) + private function getPluralizationRule(int $number, string $locale): int { - return strtr($this->selector->choose((string) $id, (int) $number, $locale ?: $this->getLocale()), $parameters); + return PluralizationRules::get($number, $locale, false); } } diff --git a/vendor/symfony/translation/Interval.php b/vendor/symfony/translation/Interval.php index 9e2cae6..1adc43f 100644 --- a/vendor/symfony/translation/Interval.php +++ b/vendor/symfony/translation/Interval.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Translation; +@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.2, use IdentityTranslator instead.', Interval::class), E_USER_DEPRECATED); + use Symfony\Component\Translation\Exception\InvalidArgumentException; /** @@ -32,6 +34,7 @@ use Symfony\Component\Translation\Exception\InvalidArgumentException; * @author Fabien Potencier <fabien@symfony.com> * * @see http://en.wikipedia.org/wiki/Interval_%28mathematics%29#The_ISO_notation + * @deprecated since Symfony 4.2, use IdentityTranslator instead */ class Interval { @@ -96,7 +99,7 @@ class Interval EOF; } - private static function convertNumber($number) + private static function convertNumber(string $number): float { if ('-Inf' === $number) { return log(0); diff --git a/vendor/symfony/translation/LICENSE b/vendor/symfony/translation/LICENSE index a677f43..9e936ec 100644 --- a/vendor/symfony/translation/LICENSE +++ b/vendor/symfony/translation/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2019 Fabien Potencier +Copyright (c) 2004-2020 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/symfony/translation/Loader/ArrayLoader.php b/vendor/symfony/translation/Loader/ArrayLoader.php index 0a6f9f0..2e9a428 100644 --- a/vendor/symfony/translation/Loader/ArrayLoader.php +++ b/vendor/symfony/translation/Loader/ArrayLoader.php @@ -25,7 +25,7 @@ class ArrayLoader implements LoaderInterface */ public function load($resource, $locale, $domain = 'messages') { - $this->flatten($resource); + $resource = $this->flatten($resource); $catalogue = new MessageCatalogue($locale); $catalogue->add($resource, $domain); @@ -39,28 +39,20 @@ class ArrayLoader implements LoaderInterface * 'key' => ['key2' => ['key3' => 'value']] * Becomes: * 'key.key2.key3' => 'value' - * - * This function takes an array by reference and will modify it - * - * @param array &$messages The array that will be flattened - * @param array $subnode Current subnode being parsed, used internally for recursive calls - * @param string $path Current path being parsed, used internally for recursive calls */ - private function flatten(array &$messages, array $subnode = null, $path = null) + private function flatten(array $messages): array { - if (null === $subnode) { - $subnode = &$messages; - } - foreach ($subnode as $key => $value) { + $result = []; + foreach ($messages as $key => $value) { if (\is_array($value)) { - $nodePath = $path ? $path.'.'.$key : $key; - $this->flatten($messages, $value, $nodePath); - if (null === $path) { - unset($messages[$key]); + foreach ($this->flatten($value) as $k => $v) { + $result[$key.'.'.$k] = $v; } - } elseif (null !== $path) { - $messages[$path.'.'.$key] = $value; + } else { + $result[$key] = $value; } } + + return $result; } } diff --git a/vendor/symfony/translation/Loader/IcuDatFileLoader.php b/vendor/symfony/translation/Loader/IcuDatFileLoader.php index 83b5043..7bbf4c2 100644 --- a/vendor/symfony/translation/Loader/IcuDatFileLoader.php +++ b/vendor/symfony/translation/Loader/IcuDatFileLoader.php @@ -39,7 +39,6 @@ class IcuDatFileLoader extends IcuResFileLoader try { $rb = new \ResourceBundle($locale, $resource); } catch (\Exception $e) { - // HHVM compatibility: constructor throws on invalid resource $rb = null; } diff --git a/vendor/symfony/translation/Loader/IcuResFileLoader.php b/vendor/symfony/translation/Loader/IcuResFileLoader.php index b59c021..005f260 100644 --- a/vendor/symfony/translation/Loader/IcuResFileLoader.php +++ b/vendor/symfony/translation/Loader/IcuResFileLoader.php @@ -39,7 +39,6 @@ class IcuResFileLoader implements LoaderInterface try { $rb = new \ResourceBundle($locale, $resource); } catch (\Exception $e) { - // HHVM compatibility: constructor throws on invalid resource $rb = null; } diff --git a/vendor/symfony/translation/Loader/JsonFileLoader.php b/vendor/symfony/translation/Loader/JsonFileLoader.php index 5267212..e3e7c75 100644 --- a/vendor/symfony/translation/Loader/JsonFileLoader.php +++ b/vendor/symfony/translation/Loader/JsonFileLoader.php @@ -39,12 +39,8 @@ class JsonFileLoader extends FileLoader /** * Translates JSON_ERROR_* constant into meaningful message. - * - * @param int $errorCode Error code returned by json_last_error() call - * - * @return string Message string */ - private function getJSONErrorMessage($errorCode) + private function getJSONErrorMessage(int $errorCode): string { switch ($errorCode) { case JSON_ERROR_DEPTH: diff --git a/vendor/symfony/translation/Loader/MoFileLoader.php b/vendor/symfony/translation/Loader/MoFileLoader.php index 4b249df..d344c6e 100644 --- a/vendor/symfony/translation/Loader/MoFileLoader.php +++ b/vendor/symfony/translation/Loader/MoFileLoader.php @@ -129,11 +129,8 @@ class MoFileLoader extends FileLoader * Reads an unsigned long from stream respecting endianness. * * @param resource $stream - * @param bool $isBigEndian - * - * @return int */ - private function readLong($stream, $isBigEndian) + private function readLong($stream, bool $isBigEndian): int { $result = unpack($isBigEndian ? 'N1' : 'V1', fread($stream, 4)); $result = current($result); diff --git a/vendor/symfony/translation/Loader/PhpFileLoader.php b/vendor/symfony/translation/Loader/PhpFileLoader.php index a0050e8..0991c3d 100644 --- a/vendor/symfony/translation/Loader/PhpFileLoader.php +++ b/vendor/symfony/translation/Loader/PhpFileLoader.php @@ -18,11 +18,25 @@ namespace Symfony\Component\Translation\Loader; */ class PhpFileLoader extends FileLoader { + private static $cache = []; + /** * {@inheritdoc} */ protected function loadResource($resource) { - return require $resource; + if ([] === self::$cache && \function_exists('opcache_invalidate') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN) && (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) || filter_var(ini_get('opcache.enable_cli'), FILTER_VALIDATE_BOOLEAN))) { + self::$cache = null; + } + + if (null === self::$cache) { + return require $resource; + } + + if (isset(self::$cache[$resource])) { + return self::$cache[$resource]; + } + + return self::$cache[$resource] = require $resource; } } diff --git a/vendor/symfony/translation/Loader/XliffFileLoader.php b/vendor/symfony/translation/Loader/XliffFileLoader.php index 9d7a83a..15a6ee5 100644 --- a/vendor/symfony/translation/Loader/XliffFileLoader.php +++ b/vendor/symfony/translation/Loader/XliffFileLoader.php @@ -13,10 +13,10 @@ namespace Symfony\Component\Translation\Loader; use Symfony\Component\Config\Resource\FileResource; use Symfony\Component\Config\Util\XmlUtils; -use Symfony\Component\Translation\Exception\InvalidArgumentException; use Symfony\Component\Translation\Exception\InvalidResourceException; use Symfony\Component\Translation\Exception\NotFoundResourceException; use Symfony\Component\Translation\MessageCatalogue; +use Symfony\Component\Translation\Util\XliffUtils; /** * XliffFileLoader loads translations from XLIFF files. @@ -48,7 +48,7 @@ class XliffFileLoader implements LoaderInterface return $catalogue; } - private function extract($resource, MessageCatalogue $catalogue, $domain) + private function extract($resource, MessageCatalogue $catalogue, string $domain) { try { $dom = XmlUtils::loadFile($resource); @@ -56,8 +56,10 @@ class XliffFileLoader implements LoaderInterface throw new InvalidResourceException(sprintf('Unable to load "%s": %s', $resource, $e->getMessage()), $e->getCode(), $e); } - $xliffVersion = $this->getVersionNumber($dom); - $this->validateSchema($xliffVersion, $dom, $this->getSchema($xliffVersion)); + $xliffVersion = XliffUtils::getVersionNumber($dom); + if ($errors = XliffUtils::validateSchema($dom)) { + throw new InvalidResourceException(sprintf('Invalid resource provided: "%s"; Errors: %s', $resource, XliffUtils::getErrorsAsString($errors))); + } if ('1.2' === $xliffVersion) { $this->extractXliff1($dom, $catalogue, $domain); @@ -70,55 +72,61 @@ class XliffFileLoader implements LoaderInterface /** * Extract messages and metadata from DOMDocument into a MessageCatalogue. - * - * @param \DOMDocument $dom Source to extract messages and metadata - * @param MessageCatalogue $catalogue Catalogue where we'll collect messages and metadata - * @param string $domain The domain */ - private function extractXliff1(\DOMDocument $dom, MessageCatalogue $catalogue, $domain) + private function extractXliff1(\DOMDocument $dom, MessageCatalogue $catalogue, string $domain) { $xml = simplexml_import_dom($dom); $encoding = strtoupper($dom->encoding); - $xml->registerXPathNamespace('xliff', 'urn:oasis:names:tc:xliff:document:1.2'); - foreach ($xml->xpath('//xliff:trans-unit') as $translation) { - $attributes = $translation->attributes(); + $namespace = 'urn:oasis:names:tc:xliff:document:1.2'; + $xml->registerXPathNamespace('xliff', $namespace); - if (!(isset($attributes['resname']) || isset($translation->source))) { - continue; - } + foreach ($xml->xpath('//xliff:file') as $file) { + $fileAttributes = $file->attributes(); - $source = isset($attributes['resname']) && $attributes['resname'] ? $attributes['resname'] : $translation->source; - // If the xlf file has another encoding specified, try to convert it because - // simple_xml will always return utf-8 encoded values - $target = $this->utf8ToCharset((string) (isset($translation->target) ? $translation->target : $translation->source), $encoding); + $file->registerXPathNamespace('xliff', $namespace); - $catalogue->set((string) $source, $target, $domain); + foreach ($file->xpath('.//xliff:trans-unit') as $translation) { + $attributes = $translation->attributes(); - $metadata = []; - if ($notes = $this->parseNotesMetadata($translation->note, $encoding)) { - $metadata['notes'] = $notes; - } + if (!(isset($attributes['resname']) || isset($translation->source))) { + continue; + } + + $source = isset($attributes['resname']) && $attributes['resname'] ? $attributes['resname'] : $translation->source; + // If the xlf file has another encoding specified, try to convert it because + // simple_xml will always return utf-8 encoded values + $target = $this->utf8ToCharset((string) ($translation->target ?? $translation->source), $encoding); + + $catalogue->set((string) $source, $target, $domain); - if (isset($translation->target) && $translation->target->attributes()) { - $metadata['target-attributes'] = []; - foreach ($translation->target->attributes() as $key => $value) { - $metadata['target-attributes'][$key] = (string) $value; + $metadata = [ + 'source' => (string) $translation->source, + 'file' => [ + 'original' => (string) $fileAttributes['original'], + ], + ]; + if ($notes = $this->parseNotesMetadata($translation->note, $encoding)) { + $metadata['notes'] = $notes; } - } - if (isset($attributes['id'])) { - $metadata['id'] = (string) $attributes['id']; - } + if (isset($translation->target) && $translation->target->attributes()) { + $metadata['target-attributes'] = []; + foreach ($translation->target->attributes() as $key => $value) { + $metadata['target-attributes'][$key] = (string) $value; + } + } + + if (isset($attributes['id'])) { + $metadata['id'] = (string) $attributes['id']; + } - $catalogue->setMetadata((string) $source, $metadata, $domain); + $catalogue->setMetadata((string) $source, $metadata, $domain); + } } } - /** - * @param string $domain - */ - private function extractXliff2(\DOMDocument $dom, MessageCatalogue $catalogue, $domain) + private function extractXliff2(\DOMDocument $dom, MessageCatalogue $catalogue, string $domain) { $xml = simplexml_import_dom($dom); $encoding = strtoupper($dom->encoding); @@ -162,13 +170,8 @@ class XliffFileLoader implements LoaderInterface /** * Convert a UTF8 string to the specified encoding. - * - * @param string $content String to decode - * @param string $encoding Target encoding - * - * @return string */ - private function utf8ToCharset($content, $encoding = null) + private function utf8ToCharset(string $content, string $encoding = null): string { if ('UTF-8' !== $encoding && !empty($encoding)) { return mb_convert_encoding($content, $encoding, 'UTF-8'); @@ -177,143 +180,7 @@ class XliffFileLoader implements LoaderInterface return $content; } - /** - * Validates and parses the given file into a DOMDocument. - * - * @param string $file - * @param string $schema source of the schema - * - * @throws InvalidResourceException - */ - private function validateSchema($file, \DOMDocument $dom, $schema) - { - $internalErrors = libxml_use_internal_errors(true); - - $disableEntities = libxml_disable_entity_loader(false); - - if (!@$dom->schemaValidateSource($schema)) { - libxml_disable_entity_loader($disableEntities); - - throw new InvalidResourceException(sprintf('Invalid resource provided: "%s"; Errors: %s', $file, implode("\n", $this->getXmlErrors($internalErrors)))); - } - - libxml_disable_entity_loader($disableEntities); - - $dom->normalizeDocument(); - - libxml_clear_errors(); - libxml_use_internal_errors($internalErrors); - } - - private function getSchema($xliffVersion) - { - if ('1.2' === $xliffVersion) { - $schemaSource = file_get_contents(__DIR__.'/schema/dic/xliff-core/xliff-core-1.2-strict.xsd'); - $xmlUri = 'http://www.w3.org/2001/xml.xsd'; - } elseif ('2.0' === $xliffVersion) { - $schemaSource = file_get_contents(__DIR__.'/schema/dic/xliff-core/xliff-core-2.0.xsd'); - $xmlUri = 'informativeCopiesOf3rdPartySchemas/w3c/xml.xsd'; - } else { - throw new InvalidArgumentException(sprintf('No support implemented for loading XLIFF version "%s".', $xliffVersion)); - } - - return $this->fixXmlLocation($schemaSource, $xmlUri); - } - - /** - * Internally changes the URI of a dependent xsd to be loaded locally. - * - * @param string $schemaSource Current content of schema file - * @param string $xmlUri External URI of XML to convert to local - * - * @return string - */ - private function fixXmlLocation($schemaSource, $xmlUri) - { - $newPath = str_replace('\\', '/', __DIR__).'/schema/dic/xliff-core/xml.xsd'; - $parts = explode('/', $newPath); - $locationstart = 'file:///'; - if (0 === stripos($newPath, 'phar://')) { - $tmpfile = tempnam(sys_get_temp_dir(), 'symfony'); - if ($tmpfile) { - copy($newPath, $tmpfile); - $parts = explode('/', str_replace('\\', '/', $tmpfile)); - } else { - array_shift($parts); - $locationstart = 'phar:///'; - } - } - - $drive = '\\' === \DIRECTORY_SEPARATOR ? array_shift($parts).'/' : ''; - $newPath = $locationstart.$drive.implode('/', array_map('rawurlencode', $parts)); - - return str_replace($xmlUri, $newPath, $schemaSource); - } - - /** - * Returns the XML errors of the internal XML parser. - * - * @param bool $internalErrors - * - * @return array An array of errors - */ - private function getXmlErrors($internalErrors) - { - $errors = []; - foreach (libxml_get_errors() as $error) { - $errors[] = sprintf('[%s %s] %s (in %s - line %d, column %d)', - LIBXML_ERR_WARNING == $error->level ? 'WARNING' : 'ERROR', - $error->code, - trim($error->message), - $error->file ?: 'n/a', - $error->line, - $error->column - ); - } - - libxml_clear_errors(); - libxml_use_internal_errors($internalErrors); - - return $errors; - } - - /** - * Gets xliff file version based on the root "version" attribute. - * Defaults to 1.2 for backwards compatibility. - * - * @throws InvalidArgumentException - * - * @return string - */ - private function getVersionNumber(\DOMDocument $dom) - { - /** @var \DOMNode $xliff */ - foreach ($dom->getElementsByTagName('xliff') as $xliff) { - $version = $xliff->attributes->getNamedItem('version'); - if ($version) { - return $version->nodeValue; - } - - $namespace = $xliff->attributes->getNamedItem('xmlns'); - if ($namespace) { - if (0 !== substr_compare('urn:oasis:names:tc:xliff:document:', $namespace->nodeValue, 0, 34)) { - throw new InvalidArgumentException(sprintf('Not a valid XLIFF namespace "%s"', $namespace)); - } - - return substr($namespace, 34); - } - } - - // Falls back to v1.2 - return '1.2'; - } - - /** - * @param string|null $encoding - * - * @return array - */ - private function parseNotesMetadata(\SimpleXMLElement $noteElement = null, $encoding = null) + private function parseNotesMetadata(\SimpleXMLElement $noteElement = null, string $encoding = null): array { $notes = []; diff --git a/vendor/symfony/translation/Loader/YamlFileLoader.php b/vendor/symfony/translation/Loader/YamlFileLoader.php index 8d9aa6f..438d7d7 100644 --- a/vendor/symfony/translation/Loader/YamlFileLoader.php +++ b/vendor/symfony/translation/Loader/YamlFileLoader.php @@ -15,6 +15,7 @@ use Symfony\Component\Translation\Exception\InvalidResourceException; use Symfony\Component\Translation\Exception\LogicException; use Symfony\Component\Yaml\Exception\ParseException; use Symfony\Component\Yaml\Parser as YamlParser; +use Symfony\Component\Yaml\Yaml; /** * YamlFileLoader loads translations from Yaml files. @@ -38,18 +39,10 @@ class YamlFileLoader extends FileLoader $this->yamlParser = new YamlParser(); } - $prevErrorHandler = set_error_handler(function ($level, $message, $script, $line) use ($resource, &$prevErrorHandler) { - $message = E_USER_DEPRECATED === $level ? preg_replace('/ on line \d+/', ' in "'.$resource.'"$0', $message) : $message; - - return $prevErrorHandler ? $prevErrorHandler($level, $message, $script, $line) : false; - }); - try { - $messages = $this->yamlParser->parseFile($resource); + $messages = $this->yamlParser->parseFile($resource, Yaml::PARSE_CONSTANT); } catch (ParseException $e) { throw new InvalidResourceException(sprintf('Error parsing YAML, invalid file "%s"', $resource), 0, $e); - } finally { - restore_error_handler(); } if (null !== $messages && !\is_array($messages)) { diff --git a/vendor/symfony/translation/Loader/schema/dic/xliff-core/xliff-core-1.2-strict.xsd b/vendor/symfony/translation/Loader/schema/dic/xliff-core/xliff-core-1.2-strict.xsd deleted file mode 100644 index 3ce2a8e..0000000 --- a/vendor/symfony/translation/Loader/schema/dic/xliff-core/xliff-core-1.2-strict.xsd +++ /dev/null @@ -1,2223 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- - -May-19-2004: -- Changed the <choice> for ElemType_header, moving minOccurs="0" maxOccurs="unbounded" from its elements -to <choice> itself. -- Added <choice> for ElemType_trans-unit to allow "any order" for <context-group>, <count-group>, <prop-group>, <note>, and -<alt-trans>. - -Oct-2005 -- updated version info to 1.2 -- equiv-trans attribute to <trans-unit> element -- merged-trans attribute for <group> element -- Add the <seg-source> element as optional in the <trans-unit> and <alt-trans> content models, at the same level as <source> -- Create a new value "seg" for the mtype attribute of the <mrk> element -- Add mid as an optional attribute for the <alt-trans> element - -Nov-14-2005 -- Changed name attribute for <context-group> from required to optional -- Added extension point at <xliff> - -Jan-9-2006 -- Added alttranstype type attribute to <alt-trans>, and values - -Jan-10-2006 -- Corrected error with overwritten purposeValueList -- Corrected name="AttrType_Version", attribute should have been "name" - ---> -<xsd:schema xmlns:xlf="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="urn:oasis:names:tc:xliff:document:1.2" xml:lang="en"> - <!-- Import for xml:lang and xml:space --> - <xsd:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/> - <!-- Attributes Lists --> - <xsd:simpleType name="XTend"> - <xsd:restriction base="xsd:string"> - <xsd:pattern value="x-[^\s]+"/> - </xsd:restriction> - </xsd:simpleType> - <xsd:simpleType name="context-typeValueList"> - <xsd:annotation> - <xsd:documentation>Values for the attribute 'context-type'.</xsd:documentation> - </xsd:annotation> - <xsd:restriction base="xsd:string"> - <xsd:enumeration value="database"> - <xsd:annotation> - <xsd:documentation>Indicates a database content.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="element"> - <xsd:annotation> - <xsd:documentation>Indicates the content of an element within an XML document.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="elementtitle"> - <xsd:annotation> - <xsd:documentation>Indicates the name of an element within an XML document.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="linenumber"> - <xsd:annotation> - <xsd:documentation>Indicates the line number from the sourcefile (see context-type="sourcefile") where the <source> is found.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="numparams"> - <xsd:annotation> - <xsd:documentation>Indicates a the number of parameters contained within the <source>.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="paramnotes"> - <xsd:annotation> - <xsd:documentation>Indicates notes pertaining to the parameters in the <source>.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="record"> - <xsd:annotation> - <xsd:documentation>Indicates the content of a record within a database.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="recordtitle"> - <xsd:annotation> - <xsd:documentation>Indicates the name of a record within a database.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="sourcefile"> - <xsd:annotation> - <xsd:documentation>Indicates the original source file in the case that multiple files are merged to form the original file from which the XLIFF file is created. This differs from the original <file> attribute in that this sourcefile is one of many that make up that file.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - </xsd:restriction> - </xsd:simpleType> - <xsd:simpleType name="count-typeValueList"> - <xsd:annotation> - <xsd:documentation>Values for the attribute 'count-type'.</xsd:documentation> - </xsd:annotation> - <xsd:restriction base="xsd:NMTOKEN"> - <xsd:enumeration value="num-usages"> - <xsd:annotation> - <xsd:documentation>Indicates the count units are items that are used X times in a certain context; example: this is a reusable text unit which is used 42 times in other texts.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="repetition"> - <xsd:annotation> - <xsd:documentation>Indicates the count units are translation units existing already in the same document.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="total"> - <xsd:annotation> - <xsd:documentation>Indicates a total count.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - </xsd:restriction> - </xsd:simpleType> - <xsd:simpleType name="InlineDelimitersValueList"> - <xsd:annotation> - <xsd:documentation>Values for the attribute 'ctype' when used other elements than <ph> or <x>.</xsd:documentation> - </xsd:annotation> - <xsd:restriction base="xsd:NMTOKEN"> - <xsd:enumeration value="bold"> - <xsd:annotation> - <xsd:documentation>Indicates a run of bolded text.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="italic"> - <xsd:annotation> - <xsd:documentation>Indicates a run of text in italics.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="underlined"> - <xsd:annotation> - <xsd:documentation>Indicates a run of underlined text.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="link"> - <xsd:annotation> - <xsd:documentation>Indicates a run of hyper-text.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - </xsd:restriction> - </xsd:simpleType> - <xsd:simpleType name="InlinePlaceholdersValueList"> - <xsd:annotation> - <xsd:documentation>Values for the attribute 'ctype' when used with <ph> or <x>.</xsd:documentation> - </xsd:annotation> - <xsd:restriction base="xsd:NMTOKEN"> - <xsd:enumeration value="image"> - <xsd:annotation> - <xsd:documentation>Indicates a inline image.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="pb"> - <xsd:annotation> - <xsd:documentation>Indicates a page break.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="lb"> - <xsd:annotation> - <xsd:documentation>Indicates a line break.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - </xsd:restriction> - </xsd:simpleType> - <xsd:simpleType name="mime-typeValueList"> - <xsd:restriction base="xsd:string"> - <xsd:pattern value="(text|multipart|message|application|image|audio|video|model)(/.+)*"/> - </xsd:restriction> - </xsd:simpleType> - <xsd:simpleType name="datatypeValueList"> - <xsd:annotation> - <xsd:documentation>Values for the attribute 'datatype'.</xsd:documentation> - </xsd:annotation> - <xsd:restriction base="xsd:NMTOKEN"> - <xsd:enumeration value="asp"> - <xsd:annotation> - <xsd:documentation>Indicates Active Server Page data.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="c"> - <xsd:annotation> - <xsd:documentation>Indicates C source file data.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="cdf"> - <xsd:annotation> - <xsd:documentation>Indicates Channel Definition Format (CDF) data.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="cfm"> - <xsd:annotation> - <xsd:documentation>Indicates ColdFusion data.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="cpp"> - <xsd:annotation> - <xsd:documentation>Indicates C++ source file data.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="csharp"> - <xsd:annotation> - <xsd:documentation>Indicates C-Sharp data.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="cstring"> - <xsd:annotation> - <xsd:documentation>Indicates strings from C, ASM, and driver files data.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="csv"> - <xsd:annotation> - <xsd:documentation>Indicates comma-separated values data.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="database"> - <xsd:annotation> - <xsd:documentation>Indicates database data.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="documentfooter"> - <xsd:annotation> - <xsd:documentation>Indicates portions of document that follows data and contains metadata.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="documentheader"> - <xsd:annotation> - <xsd:documentation>Indicates portions of document that precedes data and contains metadata.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="filedialog"> - <xsd:annotation> - <xsd:documentation>Indicates data from standard UI file operations dialogs (e.g., Open, Save, Save As, Export, Import).</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="form"> - <xsd:annotation> - <xsd:documentation>Indicates standard user input screen data.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="html"> - <xsd:annotation> - <xsd:documentation>Indicates HyperText Markup Language (HTML) data - document instance.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="htmlbody"> - <xsd:annotation> - <xsd:documentation>Indicates content within an HTML document’s <body> element.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="ini"> - <xsd:annotation> - <xsd:documentation>Indicates Windows INI file data.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="interleaf"> - <xsd:annotation> - <xsd:documentation>Indicates Interleaf data.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="javaclass"> - <xsd:annotation> - <xsd:documentation>Indicates Java source file data (extension '.java').</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="javapropertyresourcebundle"> - <xsd:annotation> - <xsd:documentation>Indicates Java property resource bundle data.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="javalistresourcebundle"> - <xsd:annotation> - <xsd:documentation>Indicates Java list resource bundle data.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="javascript"> - <xsd:annotation> - <xsd:documentation>Indicates JavaScript source file data.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="jscript"> - <xsd:annotation> - <xsd:documentation>Indicates JScript source file data.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="layout"> - <xsd:annotation> - <xsd:documentation>Indicates information relating to formatting.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="lisp"> - <xsd:annotation> - <xsd:documentation>Indicates LISP source file data.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="margin"> - <xsd:annotation> - <xsd:documentation>Indicates information relating to margin formats.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="menufile"> - <xsd:annotation> - <xsd:documentation>Indicates a file containing menu.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="messagefile"> - <xsd:annotation> - <xsd:documentation>Indicates numerically identified string table.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="mif"> - <xsd:annotation> - <xsd:documentation>Indicates Maker Interchange Format (MIF) data.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="mimetype"> - <xsd:annotation> - <xsd:documentation>Indicates that the datatype attribute value is a MIME Type value and is defined in the mime-type attribute.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="mo"> - <xsd:annotation> - <xsd:documentation>Indicates GNU Machine Object data.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="msglib"> - <xsd:annotation> - <xsd:documentation>Indicates Message Librarian strings created by Novell's Message Librarian Tool.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="pagefooter"> - <xsd:annotation> - <xsd:documentation>Indicates information to be displayed at the bottom of each page of a document.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="pageheader"> - <xsd:annotation> - <xsd:documentation>Indicates information to be displayed at the top of each page of a document.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="parameters"> - <xsd:annotation> - <xsd:documentation>Indicates a list of property values (e.g., settings within INI files or preferences dialog).</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="pascal"> - <xsd:annotation> - <xsd:documentation>Indicates Pascal source file data.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="php"> - <xsd:annotation> - <xsd:documentation>Indicates Hypertext Preprocessor data.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="plaintext"> - <xsd:annotation> - <xsd:documentation>Indicates plain text file (no formatting other than, possibly, wrapping).</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="po"> - <xsd:annotation> - <xsd:documentation>Indicates GNU Portable Object file.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="report"> - <xsd:annotation> - <xsd:documentation>Indicates dynamically generated user defined document. e.g. Oracle Report, Crystal Report, etc.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="resources"> - <xsd:annotation> - <xsd:documentation>Indicates Windows .NET binary resources.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="resx"> - <xsd:annotation> - <xsd:documentation>Indicates Windows .NET Resources.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="rtf"> - <xsd:annotation> - <xsd:documentation>Indicates Rich Text Format (RTF) data.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="sgml"> - <xsd:annotation> - <xsd:documentation>Indicates Standard Generalized Markup Language (SGML) data - document instance.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="sgmldtd"> - <xsd:annotation> - <xsd:documentation>Indicates Standard Generalized Markup Language (SGML) data - Document Type Definition (DTD).</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="svg"> - <xsd:annotation> - <xsd:documentation>Indicates Scalable Vector Graphic (SVG) data.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="vbscript"> - <xsd:annotation> - <xsd:documentation>Indicates VisualBasic Script source file.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="warning"> - <xsd:annotation> - <xsd:documentation>Indicates warning message.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="winres"> - <xsd:annotation> - <xsd:documentation>Indicates Windows (Win32) resources (i.e. resources extracted from an RC script, a message file, or a compiled file).</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="xhtml"> - <xsd:annotation> - <xsd:documentation>Indicates Extensible HyperText Markup Language (XHTML) data - document instance.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="xml"> - <xsd:annotation> - <xsd:documentation>Indicates Extensible Markup Language (XML) data - document instance.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="xmldtd"> - <xsd:annotation> - <xsd:documentation>Indicates Extensible Markup Language (XML) data - Document Type Definition (DTD).</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="xsl"> - <xsd:annotation> - <xsd:documentation>Indicates Extensible Stylesheet Language (XSL) data.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="xul"> - <xsd:annotation> - <xsd:documentation>Indicates XUL elements.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - </xsd:restriction> - </xsd:simpleType> - <xsd:simpleType name="mtypeValueList"> - <xsd:annotation> - <xsd:documentation>Values for the attribute 'mtype'.</xsd:documentation> - </xsd:annotation> - <xsd:restriction base="xsd:NMTOKEN"> - <xsd:enumeration value="abbrev"> - <xsd:annotation> - <xsd:documentation>Indicates the marked text is an abbreviation.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="abbreviated-form"> - <xsd:annotation> - <xsd:documentation>ISO-12620 2.1.8: A term resulting from the omission of any part of the full term while designating the same concept.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="abbreviation"> - <xsd:annotation> - <xsd:documentation>ISO-12620 2.1.8.1: An abbreviated form of a simple term resulting from the omission of some of its letters (e.g. 'adj.' for 'adjective').</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="acronym"> - <xsd:annotation> - <xsd:documentation>ISO-12620 2.1.8.4: An abbreviated form of a term made up of letters from the full form of a multiword term strung together into a sequence pronounced only syllabically (e.g. 'radar' for 'radio detecting and ranging').</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="appellation"> - <xsd:annotation> - <xsd:documentation>ISO-12620: A proper-name term, such as the name of an agency or other proper entity.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="collocation"> - <xsd:annotation> - <xsd:documentation>ISO-12620 2.1.18.1: A recurrent word combination characterized by cohesion in that the components of the collocation must co-occur within an utterance or series of utterances, even though they do not necessarily have to maintain immediate proximity to one another.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="common-name"> - <xsd:annotation> - <xsd:documentation>ISO-12620 2.1.5: A synonym for an international scientific term that is used in general discourse in a given language.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="datetime"> - <xsd:annotation> - <xsd:documentation>Indicates the marked text is a date and/or time.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="equation"> - <xsd:annotation> - <xsd:documentation>ISO-12620 2.1.15: An expression used to represent a concept based on a statement that two mathematical expressions are, for instance, equal as identified by the equal sign (=), or assigned to one another by a similar sign.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="expanded-form"> - <xsd:annotation> - <xsd:documentation>ISO-12620 2.1.7: The complete representation of a term for which there is an abbreviated form.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="formula"> - <xsd:annotation> - <xsd:documentation>ISO-12620 2.1.14: Figures, symbols or the like used to express a concept briefly, such as a mathematical or chemical formula.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="head-term"> - <xsd:annotation> - <xsd:documentation>ISO-12620 2.1.1: The concept designation that has been chosen to head a terminological record.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="initialism"> - <xsd:annotation> - <xsd:documentation>ISO-12620 2.1.8.3: An abbreviated form of a term consisting of some of the initial letters of the words making up a multiword term or the term elements making up a compound term when these letters are pronounced individually (e.g. 'BSE' for 'bovine spongiform encephalopathy').</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="international-scientific-term"> - <xsd:annotation> - <xsd:documentation>ISO-12620 2.1.4: A term that is part of an international scientific nomenclature as adopted by an appropriate scientific body.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="internationalism"> - <xsd:annotation> - <xsd:documentation>ISO-12620 2.1.6: A term that has the same or nearly identical orthographic or phonemic form in many languages.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="logical-expression"> - <xsd:annotation> - <xsd:documentation>ISO-12620 2.1.16: An expression used to represent a concept based on mathematical or logical relations, such as statements of inequality, set relationships, Boolean operations, and the like.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="materials-management-unit"> - <xsd:annotation> - <xsd:documentation>ISO-12620 2.1.17: A unit to track object.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="name"> - <xsd:annotation> - <xsd:documentation>Indicates the marked text is a name.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="near-synonym"> - <xsd:annotation> - <xsd:documentation>ISO-12620 2.1.3: A term that represents the same or a very similar concept as another term in the same language, but for which interchangeability is limited to some contexts and inapplicable in others.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="part-number"> - <xsd:annotation> - <xsd:documentation>ISO-12620 2.1.17.2: A unique alphanumeric designation assigned to an object in a manufacturing system.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="phrase"> - <xsd:annotation> - <xsd:documentation>Indicates the marked text is a phrase.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="phraseological-unit"> - <xsd:annotation> - <xsd:documentation>ISO-12620 2.1.18: Any group of two or more words that form a unit, the meaning of which frequently cannot be deduced based on the combined sense of the words making up the phrase.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="protected"> - <xsd:annotation> - <xsd:documentation>Indicates the marked text should not be translated.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="romanized-form"> - <xsd:annotation> - <xsd:documentation>ISO-12620 2.1.12: A form of a term resulting from an operation whereby non-Latin writing systems are converted to the Latin alphabet.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="seg"> - <xsd:annotation> - <xsd:documentation>Indicates that the marked text represents a segment.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="set-phrase"> - <xsd:annotation> - <xsd:documentation>ISO-12620 2.1.18.2: A fixed, lexicalized phrase.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="short-form"> - <xsd:annotation> - <xsd:documentation>ISO-12620 2.1.8.2: A variant of a multiword term that includes fewer words than the full form of the term (e.g. 'Group of Twenty-four' for 'Intergovernmental Group of Twenty-four on International Monetary Affairs').</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="sku"> - <xsd:annotation> - <xsd:documentation>ISO-12620 2.1.17.1: Stock keeping unit, an inventory item identified by a unique alphanumeric designation assigned to an object in an inventory control system.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="standard-text"> - <xsd:annotation> - <xsd:documentation>ISO-12620 2.1.19: A fixed chunk of recurring text.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="symbol"> - <xsd:annotation> - <xsd:documentation>ISO-12620 2.1.13: A designation of a concept by letters, numerals, pictograms or any combination thereof.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="synonym"> - <xsd:annotation> - <xsd:documentation>ISO-12620 2.1.2: Any term that represents the same or a very similar concept as the main entry term in a term entry.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="synonymous-phrase"> - <xsd:annotation> - <xsd:documentation>ISO-12620 2.1.18.3: Phraseological unit in a language that expresses the same semantic content as another phrase in that same language.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="term"> - <xsd:annotation> - <xsd:documentation>Indicates the marked text is a term.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="transcribed-form"> - <xsd:annotation> - <xsd:documentation>ISO-12620 2.1.11: A form of a term resulting from an operation whereby the characters of one writing system are represented by characters from another writing system, taking into account the pronunciation of the characters converted.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="transliterated-form"> - <xsd:annotation> - <xsd:documentation>ISO-12620 2.1.10: A form of a term resulting from an operation whereby the characters of an alphabetic writing system are represented by characters from another alphabetic writing system.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="truncated-term"> - <xsd:annotation> - <xsd:documentation>ISO-12620 2.1.8.5: An abbreviated form of a term resulting from the omission of one or more term elements or syllables (e.g. 'flu' for 'influenza').</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="variant"> - <xsd:annotation> - <xsd:documentation>ISO-12620 2.1.9: One of the alternate forms of a term.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - </xsd:restriction> - </xsd:simpleType> - <xsd:simpleType name="restypeValueList"> - <xsd:annotation> - <xsd:documentation>Values for the attribute 'restype'.</xsd:documentation> - </xsd:annotation> - <xsd:restriction base="xsd:NMTOKEN"> - <xsd:enumeration value="auto3state"> - <xsd:annotation> - <xsd:documentation>Indicates a Windows RC AUTO3STATE control.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="autocheckbox"> - <xsd:annotation> - <xsd:documentation>Indicates a Windows RC AUTOCHECKBOX control.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="autoradiobutton"> - <xsd:annotation> - <xsd:documentation>Indicates a Windows RC AUTORADIOBUTTON control.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="bedit"> - <xsd:annotation> - <xsd:documentation>Indicates a Windows RC BEDIT control.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="bitmap"> - <xsd:annotation> - <xsd:documentation>Indicates a bitmap, for example a BITMAP resource in Windows.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="button"> - <xsd:annotation> - <xsd:documentation>Indicates a button object, for example a BUTTON control Windows.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="caption"> - <xsd:annotation> - <xsd:documentation>Indicates a caption, such as the caption of a dialog box.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="cell"> - <xsd:annotation> - <xsd:documentation>Indicates the cell in a table, for example the content of the <td> element in HTML.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="checkbox"> - <xsd:annotation> - <xsd:documentation>Indicates check box object, for example a CHECKBOX control in Windows.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="checkboxmenuitem"> - <xsd:annotation> - <xsd:documentation>Indicates a menu item with an associated checkbox.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="checkedlistbox"> - <xsd:annotation> - <xsd:documentation>Indicates a list box, but with a check-box for each item.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="colorchooser"> - <xsd:annotation> - <xsd:documentation>Indicates a color selection dialog.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="combobox"> - <xsd:annotation> - <xsd:documentation>Indicates a combination of edit box and listbox object, for example a COMBOBOX control in Windows.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="comboboxexitem"> - <xsd:annotation> - <xsd:documentation>Indicates an initialization entry of an extended combobox DLGINIT resource block. (code 0x1234).</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="comboboxitem"> - <xsd:annotation> - <xsd:documentation>Indicates an initialization entry of a combobox DLGINIT resource block (code 0x0403).</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="component"> - <xsd:annotation> - <xsd:documentation>Indicates a UI base class element that cannot be represented by any other element.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="contextmenu"> - <xsd:annotation> - <xsd:documentation>Indicates a context menu.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="ctext"> - <xsd:annotation> - <xsd:documentation>Indicates a Windows RC CTEXT control.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="cursor"> - <xsd:annotation> - <xsd:documentation>Indicates a cursor, for example a CURSOR resource in Windows.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="datetimepicker"> - <xsd:annotation> - <xsd:documentation>Indicates a date/time picker.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="defpushbutton"> - <xsd:annotation> - <xsd:documentation>Indicates a Windows RC DEFPUSHBUTTON control.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="dialog"> - <xsd:annotation> - <xsd:documentation>Indicates a dialog box.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="dlginit"> - <xsd:annotation> - <xsd:documentation>Indicates a Windows RC DLGINIT resource block.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="edit"> - <xsd:annotation> - <xsd:documentation>Indicates an edit box object, for example an EDIT control in Windows.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="file"> - <xsd:annotation> - <xsd:documentation>Indicates a filename.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="filechooser"> - <xsd:annotation> - <xsd:documentation>Indicates a file dialog.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="fn"> - <xsd:annotation> - <xsd:documentation>Indicates a footnote.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="font"> - <xsd:annotation> - <xsd:documentation>Indicates a font name.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="footer"> - <xsd:annotation> - <xsd:documentation>Indicates a footer.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="frame"> - <xsd:annotation> - <xsd:documentation>Indicates a frame object.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="grid"> - <xsd:annotation> - <xsd:documentation>Indicates a XUL grid element.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="groupbox"> - <xsd:annotation> - <xsd:documentation>Indicates a groupbox object, for example a GROUPBOX control in Windows.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="header"> - <xsd:annotation> - <xsd:documentation>Indicates a header item.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="heading"> - <xsd:annotation> - <xsd:documentation>Indicates a heading, such has the content of <h1>, <h2>, etc. in HTML.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="hedit"> - <xsd:annotation> - <xsd:documentation>Indicates a Windows RC HEDIT control.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="hscrollbar"> - <xsd:annotation> - <xsd:documentation>Indicates a horizontal scrollbar.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="icon"> - <xsd:annotation> - <xsd:documentation>Indicates an icon, for example an ICON resource in Windows.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="iedit"> - <xsd:annotation> - <xsd:documentation>Indicates a Windows RC IEDIT control.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="keywords"> - <xsd:annotation> - <xsd:documentation>Indicates keyword list, such as the content of the Keywords meta-data in HTML, or a K footnote in WinHelp RTF.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="label"> - <xsd:annotation> - <xsd:documentation>Indicates a label object.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="linklabel"> - <xsd:annotation> - <xsd:documentation>Indicates a label that is also a HTML link (not necessarily a URL).</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="list"> - <xsd:annotation> - <xsd:documentation>Indicates a list (a group of list-items, for example an <ol> or <ul> element in HTML).</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="listbox"> - <xsd:annotation> - <xsd:documentation>Indicates a listbox object, for example an LISTBOX control in Windows.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="listitem"> - <xsd:annotation> - <xsd:documentation>Indicates an list item (an entry in a list).</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="ltext"> - <xsd:annotation> - <xsd:documentation>Indicates a Windows RC LTEXT control.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="menu"> - <xsd:annotation> - <xsd:documentation>Indicates a menu (a group of menu-items).</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="menubar"> - <xsd:annotation> - <xsd:documentation>Indicates a toolbar containing one or more tope level menus.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="menuitem"> - <xsd:annotation> - <xsd:documentation>Indicates a menu item (an entry in a menu).</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="menuseparator"> - <xsd:annotation> - <xsd:documentation>Indicates a XUL menuseparator element.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="message"> - <xsd:annotation> - <xsd:documentation>Indicates a message, for example an entry in a MESSAGETABLE resource in Windows.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="monthcalendar"> - <xsd:annotation> - <xsd:documentation>Indicates a calendar control.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="numericupdown"> - <xsd:annotation> - <xsd:documentation>Indicates an edit box beside a spin control.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="panel"> - <xsd:annotation> - <xsd:documentation>Indicates a catch all for rectangular areas.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="popupmenu"> - <xsd:annotation> - <xsd:documentation>Indicates a standalone menu not necessarily associated with a menubar.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="pushbox"> - <xsd:annotation> - <xsd:documentation>Indicates a pushbox object, for example a PUSHBOX control in Windows.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="pushbutton"> - <xsd:annotation> - <xsd:documentation>Indicates a Windows RC PUSHBUTTON control.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="radio"> - <xsd:annotation> - <xsd:documentation>Indicates a radio button object.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="radiobuttonmenuitem"> - <xsd:annotation> - <xsd:documentation>Indicates a menuitem with associated radio button.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="rcdata"> - <xsd:annotation> - <xsd:documentation>Indicates raw data resources for an application.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="row"> - <xsd:annotation> - <xsd:documentation>Indicates a row in a table.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="rtext"> - <xsd:annotation> - <xsd:documentation>Indicates a Windows RC RTEXT control.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="scrollpane"> - <xsd:annotation> - <xsd:documentation>Indicates a user navigable container used to show a portion of a document.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="separator"> - <xsd:annotation> - <xsd:documentation>Indicates a generic divider object (e.g. menu group separator).</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="shortcut"> - <xsd:annotation> - <xsd:documentation>Windows accelerators, shortcuts in resource or property files.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="spinner"> - <xsd:annotation> - <xsd:documentation>Indicates a UI control to indicate process activity but not progress.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="splitter"> - <xsd:annotation> - <xsd:documentation>Indicates a splitter bar.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="state3"> - <xsd:annotation> - <xsd:documentation>Indicates a Windows RC STATE3 control.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="statusbar"> - <xsd:annotation> - <xsd:documentation>Indicates a window for providing feedback to the users, like 'read-only', etc.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="string"> - <xsd:annotation> - <xsd:documentation>Indicates a string, for example an entry in a STRINGTABLE resource in Windows.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="tabcontrol"> - <xsd:annotation> - <xsd:documentation>Indicates a layers of controls with a tab to select layers.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="table"> - <xsd:annotation> - <xsd:documentation>Indicates a display and edits regular two-dimensional tables of cells.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="textbox"> - <xsd:annotation> - <xsd:documentation>Indicates a XUL textbox element.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="togglebutton"> - <xsd:annotation> - <xsd:documentation>Indicates a UI button that can be toggled to on or off state.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="toolbar"> - <xsd:annotation> - <xsd:documentation>Indicates an array of controls, usually buttons.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="tooltip"> - <xsd:annotation> - <xsd:documentation>Indicates a pop up tool tip text.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="trackbar"> - <xsd:annotation> - <xsd:documentation>Indicates a bar with a pointer indicating a position within a certain range.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="tree"> - <xsd:annotation> - <xsd:documentation>Indicates a control that displays a set of hierarchical data.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="uri"> - <xsd:annotation> - <xsd:documentation>Indicates a URI (URN or URL).</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="userbutton"> - <xsd:annotation> - <xsd:documentation>Indicates a Windows RC USERBUTTON control.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="usercontrol"> - <xsd:annotation> - <xsd:documentation>Indicates a user-defined control like CONTROL control in Windows.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="var"> - <xsd:annotation> - <xsd:documentation>Indicates the text of a variable.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="versioninfo"> - <xsd:annotation> - <xsd:documentation>Indicates version information about a resource like VERSIONINFO in Windows.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="vscrollbar"> - <xsd:annotation> - <xsd:documentation>Indicates a vertical scrollbar.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="window"> - <xsd:annotation> - <xsd:documentation>Indicates a graphical window.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - </xsd:restriction> - </xsd:simpleType> - <xsd:simpleType name="size-unitValueList"> - <xsd:annotation> - <xsd:documentation>Values for the attribute 'size-unit'.</xsd:documentation> - </xsd:annotation> - <xsd:restriction base="xsd:NMTOKEN"> - <xsd:enumeration value="byte"> - <xsd:annotation> - <xsd:documentation>Indicates a size in 8-bit bytes.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="char"> - <xsd:annotation> - <xsd:documentation>Indicates a size in Unicode characters.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="col"> - <xsd:annotation> - <xsd:documentation>Indicates a size in columns. Used for HTML text area.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="cm"> - <xsd:annotation> - <xsd:documentation>Indicates a size in centimeters.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="dlgunit"> - <xsd:annotation> - <xsd:documentation>Indicates a size in dialog units, as defined in Windows resources.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="em"> - <xsd:annotation> - <xsd:documentation>Indicates a size in 'font-size' units (as defined in CSS).</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="ex"> - <xsd:annotation> - <xsd:documentation>Indicates a size in 'x-height' units (as defined in CSS).</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="glyph"> - <xsd:annotation> - <xsd:documentation>Indicates a size in glyphs. A glyph is considered to be one or more combined Unicode characters that represent a single displayable text character. Sometimes referred to as a 'grapheme cluster'</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="in"> - <xsd:annotation> - <xsd:documentation>Indicates a size in inches.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="mm"> - <xsd:annotation> - <xsd:documentation>Indicates a size in millimeters.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="percent"> - <xsd:annotation> - <xsd:documentation>Indicates a size in percentage.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="pixel"> - <xsd:annotation> - <xsd:documentation>Indicates a size in pixels.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="point"> - <xsd:annotation> - <xsd:documentation>Indicates a size in point.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="row"> - <xsd:annotation> - <xsd:documentation>Indicates a size in rows. Used for HTML text area.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - </xsd:restriction> - </xsd:simpleType> - <xsd:simpleType name="stateValueList"> - <xsd:annotation> - <xsd:documentation>Values for the attribute 'state'.</xsd:documentation> - </xsd:annotation> - <xsd:restriction base="xsd:NMTOKEN"> - <xsd:enumeration value="final"> - <xsd:annotation> - <xsd:documentation>Indicates the terminating state.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="needs-adaptation"> - <xsd:annotation> - <xsd:documentation>Indicates only non-textual information needs adaptation.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="needs-l10n"> - <xsd:annotation> - <xsd:documentation>Indicates both text and non-textual information needs adaptation.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="needs-review-adaptation"> - <xsd:annotation> - <xsd:documentation>Indicates only non-textual information needs review.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="needs-review-l10n"> - <xsd:annotation> - <xsd:documentation>Indicates both text and non-textual information needs review.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="needs-review-translation"> - <xsd:annotation> - <xsd:documentation>Indicates that only the text of the item needs to be reviewed.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="needs-translation"> - <xsd:annotation> - <xsd:documentation>Indicates that the item needs to be translated.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="new"> - <xsd:annotation> - <xsd:documentation>Indicates that the item is new. For example, translation units that were not in a previous version of the document.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="signed-off"> - <xsd:annotation> - <xsd:documentation>Indicates that changes are reviewed and approved.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="translated"> - <xsd:annotation> - <xsd:documentation>Indicates that the item has been translated.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - </xsd:restriction> - </xsd:simpleType> - <xsd:simpleType name="state-qualifierValueList"> - <xsd:annotation> - <xsd:documentation>Values for the attribute 'state-qualifier'.</xsd:documentation> - </xsd:annotation> - <xsd:restriction base="xsd:NMTOKEN"> - <xsd:enumeration value="exact-match"> - <xsd:annotation> - <xsd:documentation>Indicates an exact match. An exact match occurs when a source text of a segment is exactly the same as the source text of a segment that was translated previously.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="fuzzy-match"> - <xsd:annotation> - <xsd:documentation>Indicates a fuzzy match. A fuzzy match occurs when a source text of a segment is very similar to the source text of a segment that was translated previously (e.g. when the difference is casing, a few changed words, white-space discripancy, etc.).</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="id-match"> - <xsd:annotation> - <xsd:documentation>Indicates a match based on matching IDs (in addition to matching text).</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="leveraged-glossary"> - <xsd:annotation> - <xsd:documentation>Indicates a translation derived from a glossary.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="leveraged-inherited"> - <xsd:annotation> - <xsd:documentation>Indicates a translation derived from existing translation.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="leveraged-mt"> - <xsd:annotation> - <xsd:documentation>Indicates a translation derived from machine translation.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="leveraged-repository"> - <xsd:annotation> - <xsd:documentation>Indicates a translation derived from a translation repository.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="leveraged-tm"> - <xsd:annotation> - <xsd:documentation>Indicates a translation derived from a translation memory.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="mt-suggestion"> - <xsd:annotation> - <xsd:documentation>Indicates the translation is suggested by machine translation.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="rejected-grammar"> - <xsd:annotation> - <xsd:documentation>Indicates that the item has been rejected because of incorrect grammar.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="rejected-inaccurate"> - <xsd:annotation> - <xsd:documentation>Indicates that the item has been rejected because it is incorrect.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="rejected-length"> - <xsd:annotation> - <xsd:documentation>Indicates that the item has been rejected because it is too long or too short.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="rejected-spelling"> - <xsd:annotation> - <xsd:documentation>Indicates that the item has been rejected because of incorrect spelling.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="tm-suggestion"> - <xsd:annotation> - <xsd:documentation>Indicates the translation is suggested by translation memory.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - </xsd:restriction> - </xsd:simpleType> - <xsd:simpleType name="unitValueList"> - <xsd:annotation> - <xsd:documentation>Values for the attribute 'unit'.</xsd:documentation> - </xsd:annotation> - <xsd:restriction base="xsd:NMTOKEN"> - <xsd:enumeration value="word"> - <xsd:annotation> - <xsd:documentation>Refers to words.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="page"> - <xsd:annotation> - <xsd:documentation>Refers to pages.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="trans-unit"> - <xsd:annotation> - <xsd:documentation>Refers to <trans-unit> elements.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="bin-unit"> - <xsd:annotation> - <xsd:documentation>Refers to <bin-unit> elements.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="glyph"> - <xsd:annotation> - <xsd:documentation>Refers to glyphs.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="item"> - <xsd:annotation> - <xsd:documentation>Refers to <trans-unit> and/or <bin-unit> elements.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="instance"> - <xsd:annotation> - <xsd:documentation>Refers to the occurrences of instances defined by the count-type value.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="character"> - <xsd:annotation> - <xsd:documentation>Refers to characters.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="line"> - <xsd:annotation> - <xsd:documentation>Refers to lines.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="sentence"> - <xsd:annotation> - <xsd:documentation>Refers to sentences.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="paragraph"> - <xsd:annotation> - <xsd:documentation>Refers to paragraphs.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="segment"> - <xsd:annotation> - <xsd:documentation>Refers to segments.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="placeable"> - <xsd:annotation> - <xsd:documentation>Refers to placeables (inline elements).</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - </xsd:restriction> - </xsd:simpleType> - <xsd:simpleType name="priorityValueList"> - <xsd:annotation> - <xsd:documentation>Values for the attribute 'priority'.</xsd:documentation> - </xsd:annotation> - <xsd:restriction base="xsd:positiveInteger"> - <xsd:enumeration value="1"> - <xsd:annotation> - <xsd:documentation>Highest priority.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="2"> - <xsd:annotation> - <xsd:documentation>High priority.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="3"> - <xsd:annotation> - <xsd:documentation>High priority, but not as important as 2.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="4"> - <xsd:annotation> - <xsd:documentation>High priority, but not as important as 3.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="5"> - <xsd:annotation> - <xsd:documentation>Medium priority, but more important than 6.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="6"> - <xsd:annotation> - <xsd:documentation>Medium priority, but less important than 5.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="7"> - <xsd:annotation> - <xsd:documentation>Low priority, but more important than 8.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="8"> - <xsd:annotation> - <xsd:documentation>Low priority, but more important than 9.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="9"> - <xsd:annotation> - <xsd:documentation>Low priority.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="10"> - <xsd:annotation> - <xsd:documentation>Lowest priority.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - </xsd:restriction> - </xsd:simpleType> - <xsd:simpleType name="reformatValueYesNo"> - <xsd:restriction base="xsd:string"> - <xsd:enumeration value="yes"> - <xsd:annotation> - <xsd:documentation>This value indicates that all properties can be reformatted. This value must be used alone.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="no"> - <xsd:annotation> - <xsd:documentation>This value indicates that no properties should be reformatted. This value must be used alone.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - </xsd:restriction> - </xsd:simpleType> - <xsd:simpleType name="reformatValueList"> - <xsd:list> - <xsd:simpleType> - <xsd:union memberTypes="xlf:XTend"> - <xsd:simpleType> - <xsd:restriction base="xsd:string"> - <xsd:enumeration value="coord"> - <xsd:annotation> - <xsd:documentation>This value indicates that all information in the coord attribute can be modified.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="coord-x"> - <xsd:annotation> - <xsd:documentation>This value indicates that the x information in the coord attribute can be modified.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="coord-y"> - <xsd:annotation> - <xsd:documentation>This value indicates that the y information in the coord attribute can be modified.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="coord-cx"> - <xsd:annotation> - <xsd:documentation>This value indicates that the cx information in the coord attribute can be modified.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="coord-cy"> - <xsd:annotation> - <xsd:documentation>This value indicates that the cy information in the coord attribute can be modified.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="font"> - <xsd:annotation> - <xsd:documentation>This value indicates that all the information in the font attribute can be modified.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="font-name"> - <xsd:annotation> - <xsd:documentation>This value indicates that the name information in the font attribute can be modified.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="font-size"> - <xsd:annotation> - <xsd:documentation>This value indicates that the size information in the font attribute can be modified.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="font-weight"> - <xsd:annotation> - <xsd:documentation>This value indicates that the weight information in the font attribute can be modified.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="css-style"> - <xsd:annotation> - <xsd:documentation>This value indicates that the information in the css-style attribute can be modified.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="style"> - <xsd:annotation> - <xsd:documentation>This value indicates that the information in the style attribute can be modified.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="ex-style"> - <xsd:annotation> - <xsd:documentation>This value indicates that the information in the exstyle attribute can be modified.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - </xsd:restriction> - </xsd:simpleType> - </xsd:union> - </xsd:simpleType> - </xsd:list> - </xsd:simpleType> - <xsd:simpleType name="purposeValueList"> - <xsd:restriction base="xsd:string"> - <xsd:enumeration value="information"> - <xsd:annotation> - <xsd:documentation>Indicates that the context is informational in nature, specifying for example, how a term should be translated. Thus, should be displayed to anyone editing the XLIFF document.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="location"> - <xsd:annotation> - <xsd:documentation>Indicates that the context-group is used to specify where the term was found in the translatable source. Thus, it is not displayed.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="match"> - <xsd:annotation> - <xsd:documentation>Indicates that the context information should be used during translation memory lookups. Thus, it is not displayed.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - </xsd:restriction> - </xsd:simpleType> - <xsd:simpleType name="alttranstypeValueList"> - <xsd:restriction base="xsd:string"> - <xsd:enumeration value="proposal"> - <xsd:annotation> - <xsd:documentation>Represents a translation proposal from a translation memory or other resource.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="previous-version"> - <xsd:annotation> - <xsd:documentation>Represents a previous version of the target element.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="rejected"> - <xsd:annotation> - <xsd:documentation>Represents a rejected version of the target element.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="reference"> - <xsd:annotation> - <xsd:documentation>Represents a translation to be used for reference purposes only, for example from a related product or a different language.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - <xsd:enumeration value="accepted"> - <xsd:annotation> - <xsd:documentation>Represents a proposed translation that was used for the translation of the trans-unit, possibly modified.</xsd:documentation> - </xsd:annotation> - </xsd:enumeration> - </xsd:restriction> - </xsd:simpleType> - <!-- Other Types --> - <xsd:complexType name="ElemType_ExternalReference"> - <xsd:choice> - <xsd:element ref="xlf:internal-file"/> - <xsd:element ref="xlf:external-file"/> - </xsd:choice> - </xsd:complexType> - <xsd:simpleType name="AttrType_purpose"> - <xsd:list> - <xsd:simpleType> - <xsd:union memberTypes="xlf:purposeValueList xlf:XTend"/> - </xsd:simpleType> - </xsd:list> - </xsd:simpleType> - <xsd:simpleType name="AttrType_datatype"> - <xsd:union memberTypes="xlf:datatypeValueList xlf:XTend"/> - </xsd:simpleType> - <xsd:simpleType name="AttrType_restype"> - <xsd:union memberTypes="xlf:restypeValueList xlf:XTend"/> - </xsd:simpleType> - <xsd:simpleType name="AttrType_alttranstype"> - <xsd:union memberTypes="xlf:alttranstypeValueList xlf:XTend"/> - </xsd:simpleType> - <xsd:simpleType name="AttrType_context-type"> - <xsd:union memberTypes="xlf:context-typeValueList xlf:XTend"/> - </xsd:simpleType> - <xsd:simpleType name="AttrType_state"> - <xsd:union memberTypes="xlf:stateValueList xlf:XTend"/> - </xsd:simpleType> - <xsd:simpleType name="AttrType_state-qualifier"> - <xsd:union memberTypes="xlf:state-qualifierValueList xlf:XTend"/> - </xsd:simpleType> - <xsd:simpleType name="AttrType_count-type"> - <xsd:union memberTypes="xlf:restypeValueList xlf:count-typeValueList xlf:datatypeValueList xlf:stateValueList xlf:state-qualifierValueList xlf:XTend"/> - </xsd:simpleType> - <xsd:simpleType name="AttrType_InlineDelimiters"> - <xsd:union memberTypes="xlf:InlineDelimitersValueList xlf:XTend"/> - </xsd:simpleType> - <xsd:simpleType name="AttrType_InlinePlaceholders"> - <xsd:union memberTypes="xlf:InlinePlaceholdersValueList xlf:XTend"/> - </xsd:simpleType> - <xsd:simpleType name="AttrType_size-unit"> - <xsd:union memberTypes="xlf:size-unitValueList xlf:XTend"/> - </xsd:simpleType> - <xsd:simpleType name="AttrType_mtype"> - <xsd:union memberTypes="xlf:mtypeValueList xlf:XTend"/> - </xsd:simpleType> - <xsd:simpleType name="AttrType_unit"> - <xsd:union memberTypes="xlf:unitValueList xlf:XTend"/> - </xsd:simpleType> - <xsd:simpleType name="AttrType_priority"> - <xsd:union memberTypes="xlf:priorityValueList"/> - </xsd:simpleType> - <xsd:simpleType name="AttrType_reformat"> - <xsd:union memberTypes="xlf:reformatValueYesNo xlf:reformatValueList"/> - </xsd:simpleType> - <xsd:simpleType name="AttrType_YesNo"> - <xsd:restriction base="xsd:NMTOKEN"> - <xsd:enumeration value="yes"/> - <xsd:enumeration value="no"/> - </xsd:restriction> - </xsd:simpleType> - <xsd:simpleType name="AttrType_Position"> - <xsd:restriction base="xsd:NMTOKEN"> - <xsd:enumeration value="open"/> - <xsd:enumeration value="close"/> - </xsd:restriction> - </xsd:simpleType> - <xsd:simpleType name="AttrType_assoc"> - <xsd:restriction base="xsd:NMTOKEN"> - <xsd:enumeration value="preceding"/> - <xsd:enumeration value="following"/> - <xsd:enumeration value="both"/> - </xsd:restriction> - </xsd:simpleType> - <xsd:simpleType name="AttrType_annotates"> - <xsd:restriction base="xsd:NMTOKEN"> - <xsd:enumeration value="source"/> - <xsd:enumeration value="target"/> - <xsd:enumeration value="general"/> - </xsd:restriction> - </xsd:simpleType> - <xsd:simpleType name="AttrType_Coordinates"> - <xsd:annotation> - <xsd:documentation>Values for the attribute 'coord'.</xsd:documentation> - </xsd:annotation> - <xsd:restriction base="xsd:string"> - <xsd:pattern value="(-?\d+|#);(-?\d+|#);(-?\d+|#);(-?\d+|#)"/> - </xsd:restriction> - </xsd:simpleType> - <xsd:simpleType name="AttrType_Version"> - <xsd:annotation> - <xsd:documentation>Version values: 1.0 and 1.1 are allowed for backward compatibility.</xsd:documentation> - </xsd:annotation> - <xsd:restriction base="xsd:string"> - <xsd:enumeration value="1.2"/> - <xsd:enumeration value="1.1"/> - <xsd:enumeration value="1.0"/> - </xsd:restriction> - </xsd:simpleType> - <!-- Groups --> - <xsd:group name="ElemGroup_TextContent"> - <xsd:choice> - <xsd:element ref="xlf:g"/> - <xsd:element ref="xlf:bpt"/> - <xsd:element ref="xlf:ept"/> - <xsd:element ref="xlf:ph"/> - <xsd:element ref="xlf:it"/> - <xsd:element ref="xlf:mrk"/> - <xsd:element ref="xlf:x"/> - <xsd:element ref="xlf:bx"/> - <xsd:element ref="xlf:ex"/> - </xsd:choice> - </xsd:group> - <xsd:attributeGroup name="AttrGroup_TextContent"> - <xsd:attribute name="id" type="xsd:string" use="required"/> - <xsd:attribute name="xid" type="xsd:string" use="optional"/> - <xsd:attribute name="equiv-text" type="xsd:string" use="optional"/> - <xsd:anyAttribute namespace="##other" processContents="strict"/> - </xsd:attributeGroup> - <!-- XLIFF Structure --> - <xsd:element name="xliff"> - <xsd:complexType> - <xsd:sequence maxOccurs="unbounded"> - <xsd:any maxOccurs="unbounded" minOccurs="0" namespace="##other" processContents="strict"/> - <xsd:element ref="xlf:file"/> - </xsd:sequence> - <xsd:attribute name="version" type="xlf:AttrType_Version" use="required"/> - <xsd:attribute ref="xml:lang" use="optional"/> - <xsd:anyAttribute namespace="##other" processContents="strict"/> - </xsd:complexType> - </xsd:element> - <xsd:element name="file"> - <xsd:complexType> - <xsd:sequence> - <xsd:element minOccurs="0" ref="xlf:header"/> - <xsd:element ref="xlf:body"/> - </xsd:sequence> - <xsd:attribute name="original" type="xsd:string" use="required"/> - <xsd:attribute name="source-language" type="xsd:language" use="required"/> - <xsd:attribute name="datatype" type="xlf:AttrType_datatype" use="required"/> - <xsd:attribute name="tool-id" type="xsd:string" use="optional"/> - <xsd:attribute name="date" type="xsd:dateTime" use="optional"/> - <xsd:attribute ref="xml:space" use="optional"/> - <xsd:attribute name="category" type="xsd:string" use="optional"/> - <xsd:attribute name="target-language" type="xsd:language" use="optional"/> - <xsd:attribute name="product-name" type="xsd:string" use="optional"/> - <xsd:attribute name="product-version" type="xsd:string" use="optional"/> - <xsd:attribute name="build-num" type="xsd:string" use="optional"/> - <xsd:anyAttribute namespace="##other" processContents="strict"/> - </xsd:complexType> - <xsd:unique name="U_group_id"> - <xsd:selector xpath=".//xlf:group"/> - <xsd:field xpath="@id"/> - </xsd:unique> - <xsd:key name="K_unit_id"> - <xsd:selector xpath=".//xlf:trans-unit|.//xlf:bin-unit"/> - <xsd:field xpath="@id"/> - </xsd:key> - <xsd:keyref name="KR_unit_id" refer="xlf:K_unit_id"> - <xsd:selector xpath=".//bpt|.//ept|.//it|.//ph|.//g|.//x|.//bx|.//ex|.//sub"/> - <xsd:field xpath="@xid"/> - </xsd:keyref> - <xsd:key name="K_tool-id"> - <xsd:selector xpath="xlf:header/xlf:tool"/> - <xsd:field xpath="@tool-id"/> - </xsd:key> - <xsd:keyref name="KR_file_tool-id" refer="xlf:K_tool-id"> - <xsd:selector xpath="."/> - <xsd:field xpath="@tool-id"/> - </xsd:keyref> - <xsd:keyref name="KR_phase_tool-id" refer="xlf:K_tool-id"> - <xsd:selector xpath="xlf:header/xlf:phase-group/xlf:phase"/> - <xsd:field xpath="@tool-id"/> - </xsd:keyref> - <xsd:keyref name="KR_alt-trans_tool-id" refer="xlf:K_tool-id"> - <xsd:selector xpath=".//xlf:trans-unit/xlf:alt-trans"/> - <xsd:field xpath="@tool-id"/> - </xsd:keyref> - <xsd:key name="K_count-group_name"> - <xsd:selector xpath=".//xlf:count-group"/> - <xsd:field xpath="@name"/> - </xsd:key> - <xsd:unique name="U_context-group_name"> - <xsd:selector xpath=".//xlf:context-group"/> - <xsd:field xpath="@name"/> - </xsd:unique> - <xsd:key name="K_phase-name"> - <xsd:selector xpath="xlf:header/xlf:phase-group/xlf:phase"/> - <xsd:field xpath="@phase-name"/> - </xsd:key> - <xsd:keyref name="KR_phase-name" refer="xlf:K_phase-name"> - <xsd:selector xpath=".//xlf:count|.//xlf:trans-unit|.//xlf:target|.//bin-unit|.//bin-target"/> - <xsd:field xpath="@phase-name"/> - </xsd:keyref> - <xsd:unique name="U_uid"> - <xsd:selector xpath=".//xlf:external-file"/> - <xsd:field xpath="@uid"/> - </xsd:unique> - </xsd:element> - <xsd:element name="header"> - <xsd:complexType> - <xsd:sequence> - <xsd:element minOccurs="0" name="skl" type="xlf:ElemType_ExternalReference"/> - <xsd:element minOccurs="0" ref="xlf:phase-group"/> - <xsd:choice maxOccurs="unbounded" minOccurs="0"> - <xsd:element name="glossary" type="xlf:ElemType_ExternalReference"/> - <xsd:element name="reference" type="xlf:ElemType_ExternalReference"/> - <xsd:element ref="xlf:count-group"/> - <xsd:element ref="xlf:note"/> - <xsd:element ref="xlf:tool"/> - </xsd:choice> - <xsd:any maxOccurs="unbounded" minOccurs="0" namespace="##other" processContents="strict"/> - </xsd:sequence> - </xsd:complexType> - </xsd:element> - <xsd:element name="internal-file"> - <xsd:complexType> - <xsd:simpleContent> - <xsd:extension base="xsd:string"> - <xsd:attribute name="form" type="xsd:string"/> - <xsd:attribute name="crc" type="xsd:NMTOKEN"/> - </xsd:extension> - </xsd:simpleContent> - </xsd:complexType> - </xsd:element> - <xsd:element name="external-file"> - <xsd:complexType> - <xsd:attribute name="href" type="xsd:string" use="required"/> - <xsd:attribute name="crc" type="xsd:NMTOKEN"/> - <xsd:attribute name="uid" type="xsd:NMTOKEN"/> - </xsd:complexType> - </xsd:element> - <xsd:element name="note"> - <xsd:complexType> - <xsd:simpleContent> - <xsd:extension base="xsd:string"> - <xsd:attribute ref="xml:lang" use="optional"/> - <xsd:attribute default="1" name="priority" type="xlf:AttrType_priority" use="optional"/> - <xsd:attribute name="from" type="xsd:string" use="optional"/> - <xsd:attribute default="general" name="annotates" type="xlf:AttrType_annotates" use="optional"/> - </xsd:extension> - </xsd:simpleContent> - </xsd:complexType> - </xsd:element> - <xsd:element name="phase-group"> - <xsd:complexType> - <xsd:sequence maxOccurs="unbounded"> - <xsd:element ref="xlf:phase"/> - </xsd:sequence> - </xsd:complexType> - </xsd:element> - <xsd:element name="phase"> - <xsd:complexType> - <xsd:sequence maxOccurs="unbounded" minOccurs="0"> - <xsd:element ref="xlf:note"/> - </xsd:sequence> - <xsd:attribute name="phase-name" type="xsd:string" use="required"/> - <xsd:attribute name="process-name" type="xsd:string" use="required"/> - <xsd:attribute name="company-name" type="xsd:string" use="optional"/> - <xsd:attribute name="tool-id" type="xsd:string" use="optional"/> - <xsd:attribute name="date" type="xsd:dateTime" use="optional"/> - <xsd:attribute name="job-id" type="xsd:string" use="optional"/> - <xsd:attribute name="contact-name" type="xsd:string" use="optional"/> - <xsd:attribute name="contact-email" type="xsd:string" use="optional"/> - <xsd:attribute name="contact-phone" type="xsd:string" use="optional"/> - </xsd:complexType> - </xsd:element> - <xsd:element name="count-group"> - <xsd:complexType> - <xsd:sequence maxOccurs="unbounded" minOccurs="0"> - <xsd:element ref="xlf:count"/> - </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" use="required"/> - </xsd:complexType> - </xsd:element> - <xsd:element name="count"> - <xsd:complexType> - <xsd:simpleContent> - <xsd:extension base="xsd:string"> - <xsd:attribute name="count-type" type="xlf:AttrType_count-type" use="optional"/> - <xsd:attribute name="phase-name" type="xsd:string" use="optional"/> - <xsd:attribute default="word" name="unit" type="xlf:AttrType_unit" use="optional"/> - </xsd:extension> - </xsd:simpleContent> - </xsd:complexType> - </xsd:element> - <xsd:element name="context-group"> - <xsd:complexType> - <xsd:sequence maxOccurs="unbounded"> - <xsd:element ref="xlf:context"/> - </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" use="optional"/> - <xsd:attribute name="crc" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute name="purpose" type="xlf:AttrType_purpose" use="optional"/> - </xsd:complexType> - </xsd:element> - <xsd:element name="context"> - <xsd:complexType> - <xsd:simpleContent> - <xsd:extension base="xsd:string"> - <xsd:attribute name="context-type" type="xlf:AttrType_context-type" use="required"/> - <xsd:attribute default="no" name="match-mandatory" type="xlf:AttrType_YesNo" use="optional"/> - <xsd:attribute name="crc" type="xsd:NMTOKEN" use="optional"/> - </xsd:extension> - </xsd:simpleContent> - </xsd:complexType> - </xsd:element> - <xsd:element name="tool"> - <xsd:complexType mixed="true"> - <xsd:sequence> - <xsd:any namespace="##any" processContents="strict" minOccurs="0" maxOccurs="unbounded"/> - </xsd:sequence> - <xsd:attribute name="tool-id" type="xsd:string" use="required"/> - <xsd:attribute name="tool-name" type="xsd:string" use="required"/> - <xsd:attribute name="tool-version" type="xsd:string" use="optional"/> - <xsd:attribute name="tool-company" type="xsd:string" use="optional"/> - <xsd:anyAttribute namespace="##other" processContents="strict"/> - </xsd:complexType> - </xsd:element> - <xsd:element name="body"> - <xsd:complexType> - <xsd:choice maxOccurs="unbounded" minOccurs="0"> - <xsd:element maxOccurs="unbounded" minOccurs="0" ref="xlf:group"/> - <xsd:element maxOccurs="unbounded" minOccurs="0" ref="xlf:trans-unit"/> - <xsd:element maxOccurs="unbounded" minOccurs="0" ref="xlf:bin-unit"/> - </xsd:choice> - </xsd:complexType> - </xsd:element> - <xsd:element name="group"> - <xsd:complexType> - <xsd:sequence> - <xsd:sequence> - <xsd:element maxOccurs="unbounded" minOccurs="0" ref="xlf:context-group"/> - <xsd:element maxOccurs="unbounded" minOccurs="0" ref="xlf:count-group"/> - <xsd:element maxOccurs="unbounded" minOccurs="0" ref="xlf:note"/> - <xsd:any maxOccurs="unbounded" minOccurs="0" namespace="##other" processContents="strict"/> - </xsd:sequence> - <xsd:choice maxOccurs="unbounded"> - <xsd:element maxOccurs="unbounded" minOccurs="0" ref="xlf:group"/> - <xsd:element maxOccurs="unbounded" minOccurs="0" ref="xlf:trans-unit"/> - <xsd:element maxOccurs="unbounded" minOccurs="0" ref="xlf:bin-unit"/> - </xsd:choice> - </xsd:sequence> - <xsd:attribute name="id" type="xsd:string" use="optional"/> - <xsd:attribute name="datatype" type="xlf:AttrType_datatype" use="optional"/> - <xsd:attribute default="default" ref="xml:space" use="optional"/> - <xsd:attribute name="restype" type="xlf:AttrType_restype" use="optional"/> - <xsd:attribute name="resname" type="xsd:string" use="optional"/> - <xsd:attribute name="extradata" type="xsd:string" use="optional"/> - <xsd:attribute name="extype" type="xsd:string" use="optional"/> - <xsd:attribute name="help-id" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute name="menu" type="xsd:string" use="optional"/> - <xsd:attribute name="menu-option" type="xsd:string" use="optional"/> - <xsd:attribute name="menu-name" type="xsd:string" use="optional"/> - <xsd:attribute name="coord" type="xlf:AttrType_Coordinates" use="optional"/> - <xsd:attribute name="font" type="xsd:string" use="optional"/> - <xsd:attribute name="css-style" type="xsd:string" use="optional"/> - <xsd:attribute name="style" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute name="exstyle" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute default="yes" name="translate" type="xlf:AttrType_YesNo" use="optional"/> - <xsd:attribute default="yes" name="reformat" type="xlf:AttrType_reformat" use="optional"/> - <xsd:attribute default="pixel" name="size-unit" type="xlf:AttrType_size-unit" use="optional"/> - <xsd:attribute name="maxwidth" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute name="minwidth" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute name="maxheight" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute name="minheight" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute name="maxbytes" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute name="minbytes" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute name="charclass" type="xsd:string" use="optional"/> - <xsd:attribute default="no" name="merged-trans" type="xlf:AttrType_YesNo" use="optional"/> - <xsd:anyAttribute namespace="##other" processContents="strict"/> - </xsd:complexType> - </xsd:element> - <xsd:element name="trans-unit"> - <xsd:complexType> - <xsd:sequence> - <xsd:element ref="xlf:source"/> - <xsd:element minOccurs="0" ref="xlf:seg-source"/> - <xsd:element minOccurs="0" ref="xlf:target"/> - <xsd:choice maxOccurs="unbounded" minOccurs="0"> - <xsd:element ref="xlf:context-group"/> - <xsd:element ref="xlf:count-group"/> - <xsd:element ref="xlf:note"/> - <xsd:element ref="xlf:alt-trans"/> - </xsd:choice> - <xsd:any maxOccurs="unbounded" minOccurs="0" namespace="##other" processContents="strict"/> - </xsd:sequence> - <xsd:attribute name="id" type="xsd:string" use="required"/> - <xsd:attribute name="approved" type="xlf:AttrType_YesNo" use="optional"/> - <xsd:attribute default="yes" name="translate" type="xlf:AttrType_YesNo" use="optional"/> - <xsd:attribute default="yes" name="reformat" type="xlf:AttrType_reformat" use="optional"/> - <xsd:attribute default="default" ref="xml:space" use="optional"/> - <xsd:attribute name="datatype" type="xlf:AttrType_datatype" use="optional"/> - <xsd:attribute name="phase-name" type="xsd:string" use="optional"/> - <xsd:attribute name="restype" type="xlf:AttrType_restype" use="optional"/> - <xsd:attribute name="resname" type="xsd:string" use="optional"/> - <xsd:attribute name="extradata" type="xsd:string" use="optional"/> - <xsd:attribute name="extype" type="xsd:string" use="optional"/> - <xsd:attribute name="help-id" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute name="menu" type="xsd:string" use="optional"/> - <xsd:attribute name="menu-option" type="xsd:string" use="optional"/> - <xsd:attribute name="menu-name" type="xsd:string" use="optional"/> - <xsd:attribute name="coord" type="xlf:AttrType_Coordinates" use="optional"/> - <xsd:attribute name="font" type="xsd:string" use="optional"/> - <xsd:attribute name="css-style" type="xsd:string" use="optional"/> - <xsd:attribute name="style" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute name="exstyle" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute default="pixel" name="size-unit" type="xlf:AttrType_size-unit" use="optional"/> - <xsd:attribute name="maxwidth" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute name="minwidth" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute name="maxheight" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute name="minheight" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute name="maxbytes" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute name="minbytes" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute name="charclass" type="xsd:string" use="optional"/> - <xsd:attribute default="yes" name="merged-trans" type="xlf:AttrType_YesNo" use="optional"/> - <xsd:anyAttribute namespace="##other" processContents="strict"/> - </xsd:complexType> - <xsd:unique name="U_tu_segsrc_mid"> - <xsd:selector xpath="./xlf:seg-source/xlf:mrk"/> - <xsd:field xpath="@mid"/> - </xsd:unique> - <xsd:keyref name="KR_tu_segsrc_mid" refer="xlf:U_tu_segsrc_mid"> - <xsd:selector xpath="./xlf:target/xlf:mrk|./xlf:alt-trans"/> - <xsd:field xpath="@mid"/> - </xsd:keyref> - </xsd:element> - <xsd:element name="source"> - <xsd:complexType mixed="true"> - <xsd:group maxOccurs="unbounded" minOccurs="0" ref="xlf:ElemGroup_TextContent"/> - <xsd:attribute ref="xml:lang" use="optional"/> - <xsd:anyAttribute namespace="##other" processContents="strict"/> - </xsd:complexType> - <xsd:unique name="U_source_bpt_rid"> - <xsd:selector xpath=".//xlf:bpt"/> - <xsd:field xpath="@rid"/> - </xsd:unique> - <xsd:keyref name="KR_source_ept_rid" refer="xlf:U_source_bpt_rid"> - <xsd:selector xpath=".//xlf:ept"/> - <xsd:field xpath="@rid"/> - </xsd:keyref> - <xsd:unique name="U_source_bx_rid"> - <xsd:selector xpath=".//xlf:bx"/> - <xsd:field xpath="@rid"/> - </xsd:unique> - <xsd:keyref name="KR_source_ex_rid" refer="xlf:U_source_bx_rid"> - <xsd:selector xpath=".//xlf:ex"/> - <xsd:field xpath="@rid"/> - </xsd:keyref> - </xsd:element> - <xsd:element name="seg-source"> - <xsd:complexType mixed="true"> - <xsd:group maxOccurs="unbounded" minOccurs="0" ref="xlf:ElemGroup_TextContent"/> - <xsd:attribute ref="xml:lang" use="optional"/> - <xsd:anyAttribute namespace="##other" processContents="strict"/> - </xsd:complexType> - <xsd:unique name="U_segsrc_bpt_rid"> - <xsd:selector xpath=".//xlf:bpt"/> - <xsd:field xpath="@rid"/> - </xsd:unique> - <xsd:keyref name="KR_segsrc_ept_rid" refer="xlf:U_segsrc_bpt_rid"> - <xsd:selector xpath=".//xlf:ept"/> - <xsd:field xpath="@rid"/> - </xsd:keyref> - <xsd:unique name="U_segsrc_bx_rid"> - <xsd:selector xpath=".//xlf:bx"/> - <xsd:field xpath="@rid"/> - </xsd:unique> - <xsd:keyref name="KR_segsrc_ex_rid" refer="xlf:U_segsrc_bx_rid"> - <xsd:selector xpath=".//xlf:ex"/> - <xsd:field xpath="@rid"/> - </xsd:keyref> - </xsd:element> - <xsd:element name="target"> - <xsd:complexType mixed="true"> - <xsd:group maxOccurs="unbounded" minOccurs="0" ref="xlf:ElemGroup_TextContent"/> - <xsd:attribute name="state" type="xlf:AttrType_state" use="optional"/> - <xsd:attribute name="state-qualifier" type="xlf:AttrType_state-qualifier" use="optional"/> - <xsd:attribute name="phase-name" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute ref="xml:lang" use="optional"/> - <xsd:attribute name="resname" type="xsd:string" use="optional"/> - <xsd:attribute name="coord" type="xlf:AttrType_Coordinates" use="optional"/> - <xsd:attribute name="font" type="xsd:string" use="optional"/> - <xsd:attribute name="css-style" type="xsd:string" use="optional"/> - <xsd:attribute name="style" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute name="exstyle" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute default="yes" name="equiv-trans" type="xlf:AttrType_YesNo" use="optional"/> - <xsd:anyAttribute namespace="##other" processContents="strict"/> - </xsd:complexType> - <xsd:unique name="U_target_bpt_rid"> - <xsd:selector xpath=".//xlf:bpt"/> - <xsd:field xpath="@rid"/> - </xsd:unique> - <xsd:keyref name="KR_target_ept_rid" refer="xlf:U_target_bpt_rid"> - <xsd:selector xpath=".//xlf:ept"/> - <xsd:field xpath="@rid"/> - </xsd:keyref> - <xsd:unique name="U_target_bx_rid"> - <xsd:selector xpath=".//xlf:bx"/> - <xsd:field xpath="@rid"/> - </xsd:unique> - <xsd:keyref name="KR_target_ex_rid" refer="xlf:U_target_bx_rid"> - <xsd:selector xpath=".//xlf:ex"/> - <xsd:field xpath="@rid"/> - </xsd:keyref> - </xsd:element> - <xsd:element name="alt-trans"> - <xsd:complexType> - <xsd:sequence> - <xsd:element minOccurs="0" ref="xlf:source"/> - <xsd:element minOccurs="0" ref="xlf:seg-source"/> - <xsd:element maxOccurs="1" ref="xlf:target"/> - <xsd:element maxOccurs="unbounded" minOccurs="0" ref="xlf:context-group"/> - <xsd:element maxOccurs="unbounded" minOccurs="0" ref="xlf:note"/> - <xsd:any maxOccurs="unbounded" minOccurs="0" namespace="##other" processContents="strict"/> - </xsd:sequence> - <xsd:attribute name="match-quality" type="xsd:string" use="optional"/> - <xsd:attribute name="tool-id" type="xsd:string" use="optional"/> - <xsd:attribute name="crc" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute ref="xml:lang" use="optional"/> - <xsd:attribute name="origin" type="xsd:string" use="optional"/> - <xsd:attribute name="datatype" type="xlf:AttrType_datatype" use="optional"/> - <xsd:attribute default="default" ref="xml:space" use="optional"/> - <xsd:attribute name="restype" type="xlf:AttrType_restype" use="optional"/> - <xsd:attribute name="resname" type="xsd:string" use="optional"/> - <xsd:attribute name="extradata" type="xsd:string" use="optional"/> - <xsd:attribute name="extype" type="xsd:string" use="optional"/> - <xsd:attribute name="help-id" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute name="menu" type="xsd:string" use="optional"/> - <xsd:attribute name="menu-option" type="xsd:string" use="optional"/> - <xsd:attribute name="menu-name" type="xsd:string" use="optional"/> - <xsd:attribute name="mid" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute name="coord" type="xlf:AttrType_Coordinates" use="optional"/> - <xsd:attribute name="font" type="xsd:string" use="optional"/> - <xsd:attribute name="css-style" type="xsd:string" use="optional"/> - <xsd:attribute name="style" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute name="exstyle" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute name="phase-name" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute default="proposal" name="alttranstype" type="xlf:AttrType_alttranstype" use="optional"/> - <xsd:anyAttribute namespace="##other" processContents="strict"/> - </xsd:complexType> - <xsd:unique name="U_at_segsrc_mid"> - <xsd:selector xpath="./xlf:seg-source/xlf:mrk"/> - <xsd:field xpath="@mid"/> - </xsd:unique> - <xsd:keyref name="KR_at_segsrc_mid" refer="xlf:U_at_segsrc_mid"> - <xsd:selector xpath="./xlf:target/xlf:mrk"/> - <xsd:field xpath="@mid"/> - </xsd:keyref> - </xsd:element> - <xsd:element name="bin-unit"> - <xsd:complexType> - <xsd:sequence> - <xsd:element ref="xlf:bin-source"/> - <xsd:element minOccurs="0" ref="xlf:bin-target"/> - <xsd:choice maxOccurs="unbounded" minOccurs="0"> - <xsd:element ref="xlf:context-group"/> - <xsd:element ref="xlf:count-group"/> - <xsd:element ref="xlf:note"/> - <xsd:element ref="xlf:trans-unit"/> - </xsd:choice> - <xsd:any maxOccurs="unbounded" minOccurs="0" namespace="##other" processContents="strict"/> - </xsd:sequence> - <xsd:attribute name="id" type="xsd:string" use="required"/> - <xsd:attribute name="mime-type" type="xlf:mime-typeValueList" use="required"/> - <xsd:attribute name="approved" type="xlf:AttrType_YesNo" use="optional"/> - <xsd:attribute default="yes" name="translate" type="xlf:AttrType_YesNo" use="optional"/> - <xsd:attribute default="yes" name="reformat" type="xlf:AttrType_reformat" use="optional"/> - <xsd:attribute name="restype" type="xlf:AttrType_restype" use="optional"/> - <xsd:attribute name="resname" type="xsd:string" use="optional"/> - <xsd:attribute name="phase-name" type="xsd:string" use="optional"/> - <xsd:anyAttribute namespace="##other" processContents="strict"/> - </xsd:complexType> - </xsd:element> - <xsd:element name="bin-source"> - <xsd:complexType> - <xsd:choice> - <xsd:element ref="xlf:internal-file"/> - <xsd:element ref="xlf:external-file"/> - </xsd:choice> - <xsd:anyAttribute namespace="##other" processContents="strict"/> - </xsd:complexType> - </xsd:element> - <xsd:element name="bin-target"> - <xsd:complexType> - <xsd:choice> - <xsd:element ref="xlf:internal-file"/> - <xsd:element ref="xlf:external-file"/> - </xsd:choice> - <xsd:attribute name="mime-type" type="xlf:mime-typeValueList" use="optional"/> - <xsd:attribute name="state" type="xlf:AttrType_state" use="optional"/> - <xsd:attribute name="state-qualifier" type="xlf:AttrType_state-qualifier" use="optional"/> - <xsd:attribute name="phase-name" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute name="restype" type="xlf:AttrType_restype" use="optional"/> - <xsd:attribute name="resname" type="xsd:string" use="optional"/> - <xsd:anyAttribute namespace="##other" processContents="strict"/> - </xsd:complexType> - </xsd:element> - <!-- Element for inline codes --> - <xsd:element name="g"> - <xsd:complexType mixed="true"> - <xsd:group maxOccurs="unbounded" minOccurs="0" ref="xlf:ElemGroup_TextContent"/> - <xsd:attribute name="ctype" type="xlf:AttrType_InlineDelimiters" use="optional"/> - <xsd:attribute default="yes" name="clone" type="xlf:AttrType_YesNo" use="optional"/> - <xsd:attributeGroup ref="xlf:AttrGroup_TextContent"/> - </xsd:complexType> - </xsd:element> - <xsd:element name="x"> - <xsd:complexType> - <xsd:attribute name="ctype" type="xlf:AttrType_InlinePlaceholders" use="optional"/> - <xsd:attribute default="yes" name="clone" type="xlf:AttrType_YesNo" use="optional"/> - <xsd:attributeGroup ref="xlf:AttrGroup_TextContent"/> - </xsd:complexType> - </xsd:element> - <xsd:element name="bx"> - <xsd:complexType> - <xsd:attribute name="rid" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute name="ctype" type="xlf:AttrType_InlineDelimiters" use="optional"/> - <xsd:attribute default="yes" name="clone" type="xlf:AttrType_YesNo" use="optional"/> - <xsd:attributeGroup ref="xlf:AttrGroup_TextContent"/> - </xsd:complexType> - </xsd:element> - <xsd:element name="ex"> - <xsd:complexType> - <xsd:attribute name="rid" type="xsd:NMTOKEN" use="optional"/> - <xsd:attributeGroup ref="xlf:AttrGroup_TextContent"/> - </xsd:complexType> - </xsd:element> - <xsd:element name="ph"> - <xsd:complexType mixed="true"> - <xsd:sequence maxOccurs="unbounded" minOccurs="0"> - <xsd:element ref="xlf:sub"/> - </xsd:sequence> - <xsd:attribute name="ctype" type="xlf:AttrType_InlinePlaceholders" use="optional"/> - <xsd:attribute name="crc" type="xsd:string" use="optional"/> - <xsd:attribute name="assoc" type="xlf:AttrType_assoc" use="optional"/> - <xsd:attributeGroup ref="xlf:AttrGroup_TextContent"/> - </xsd:complexType> - </xsd:element> - <xsd:element name="bpt"> - <xsd:complexType mixed="true"> - <xsd:sequence maxOccurs="unbounded" minOccurs="0"> - <xsd:element ref="xlf:sub"/> - </xsd:sequence> - <xsd:attribute name="rid" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute name="ctype" type="xlf:AttrType_InlineDelimiters" use="optional"/> - <xsd:attribute name="crc" type="xsd:string" use="optional"/> - <xsd:attributeGroup ref="xlf:AttrGroup_TextContent"/> - </xsd:complexType> - </xsd:element> - <xsd:element name="ept"> - <xsd:complexType mixed="true"> - <xsd:sequence maxOccurs="unbounded" minOccurs="0"> - <xsd:element ref="xlf:sub"/> - </xsd:sequence> - <xsd:attribute name="rid" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute name="crc" type="xsd:string" use="optional"/> - <xsd:attributeGroup ref="xlf:AttrGroup_TextContent"/> - </xsd:complexType> - </xsd:element> - <xsd:element name="it"> - <xsd:complexType mixed="true"> - <xsd:sequence maxOccurs="unbounded" minOccurs="0"> - <xsd:element ref="xlf:sub"/> - </xsd:sequence> - <xsd:attribute name="pos" type="xlf:AttrType_Position" use="required"/> - <xsd:attribute name="rid" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute name="ctype" type="xlf:AttrType_InlineDelimiters" use="optional"/> - <xsd:attribute name="crc" type="xsd:string" use="optional"/> - <xsd:attributeGroup ref="xlf:AttrGroup_TextContent"/> - </xsd:complexType> - </xsd:element> - <xsd:element name="sub"> - <xsd:complexType mixed="true"> - <xsd:group maxOccurs="unbounded" minOccurs="0" ref="xlf:ElemGroup_TextContent"/> - <xsd:attribute name="datatype" type="xlf:AttrType_datatype" use="optional"/> - <xsd:attribute name="ctype" type="xlf:AttrType_InlineDelimiters" use="optional"/> - <xsd:attribute name="xid" type="xsd:string" use="optional"/> - </xsd:complexType> - </xsd:element> - <xsd:element name="mrk"> - <xsd:complexType mixed="true"> - <xsd:group maxOccurs="unbounded" minOccurs="0" ref="xlf:ElemGroup_TextContent"/> - <xsd:attribute name="mtype" type="xlf:AttrType_mtype" use="required"/> - <xsd:attribute name="mid" type="xsd:NMTOKEN" use="optional"/> - <xsd:attribute name="comment" type="xsd:string" use="optional"/> - <xsd:anyAttribute namespace="##other" processContents="strict"/> - </xsd:complexType> - </xsd:element> -</xsd:schema> diff --git a/vendor/symfony/translation/Loader/schema/dic/xliff-core/xliff-core-2.0.xsd b/vendor/symfony/translation/Loader/schema/dic/xliff-core/xliff-core-2.0.xsd deleted file mode 100644 index 963232f..0000000 --- a/vendor/symfony/translation/Loader/schema/dic/xliff-core/xliff-core-2.0.xsd +++ /dev/null @@ -1,411 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - - XLIFF Version 2.0 - OASIS Standard - 05 August 2014 - Copyright (c) OASIS Open 2014. All rights reserved. - Source: http://docs.oasis-open.org/xliff/xliff-core/v2.0/os/schemas/ - --> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" - elementFormDefault="qualified" - xmlns:xlf="urn:oasis:names:tc:xliff:document:2.0" - targetNamespace="urn:oasis:names:tc:xliff:document:2.0"> - - <!-- Import --> - - <xs:import namespace="http://www.w3.org/XML/1998/namespace" - schemaLocation="informativeCopiesOf3rdPartySchemas/w3c/xml.xsd"/> - - <!-- Element Group --> - - <xs:group name="inline"> - <xs:choice> - <xs:element ref="xlf:cp"/> - <xs:element ref="xlf:ph"/> - <xs:element ref="xlf:pc"/> - <xs:element ref="xlf:sc"/> - <xs:element ref="xlf:ec"/> - <xs:element ref="xlf:mrk"/> - <xs:element ref="xlf:sm"/> - <xs:element ref="xlf:em"/> - </xs:choice> - </xs:group> - - <!-- Attribute Types --> - - <xs:simpleType name="yesNo"> - <xs:restriction base="xs:string"> - <xs:enumeration value="yes"/> - <xs:enumeration value="no"/> - </xs:restriction> - </xs:simpleType> - - <xs:simpleType name="yesNoFirstNo"> - <xs:restriction base="xs:string"> - <xs:enumeration value="yes"/> - <xs:enumeration value="firstNo"/> - <xs:enumeration value="no"/> - </xs:restriction> - </xs:simpleType> - - <xs:simpleType name="dirValue"> - <xs:restriction base="xs:string"> - <xs:enumeration value="ltr"/> - <xs:enumeration value="rtl"/> - <xs:enumeration value="auto"/> - </xs:restriction> - </xs:simpleType> - - <xs:simpleType name="appliesTo"> - <xs:restriction base="xs:string"> - <xs:enumeration value="source"/> - <xs:enumeration value="target"/> - </xs:restriction> - </xs:simpleType> - - <xs:simpleType name="userDefinedValue"> - <xs:restriction base="xs:string"> - <xs:pattern value="[^\s:]+:[^\s:]+"/> - </xs:restriction> - </xs:simpleType> - - <xs:simpleType name="attrType_type"> - <xs:restriction base="xs:string"> - <xs:enumeration value="fmt"/> - <xs:enumeration value="ui"/> - <xs:enumeration value="quote"/> - <xs:enumeration value="link"/> - <xs:enumeration value="image"/> - <xs:enumeration value="other"/> - </xs:restriction> - </xs:simpleType> - - <xs:simpleType name="typeForMrkValues"> - <xs:restriction base="xs:NMTOKEN"> - <xs:enumeration value="generic"/> - <xs:enumeration value="comment"/> - <xs:enumeration value="term"/> - </xs:restriction> - </xs:simpleType> - - <xs:simpleType name="attrType_typeForMrk"> - <xs:union memberTypes="xlf:typeForMrkValues xlf:userDefinedValue"/> - </xs:simpleType> - - <xs:simpleType name="priorityValue"> - <xs:restriction base="xs:positiveInteger"> - <xs:minInclusive value="1"/> - <xs:maxInclusive value="10"/> - </xs:restriction> - </xs:simpleType> - - <xs:simpleType name="stateType"> - <xs:restriction base="xs:string"> - <xs:enumeration value="initial"/> - <xs:enumeration value="translated"/> - <xs:enumeration value="reviewed"/> - <xs:enumeration value="final"/> - </xs:restriction> - </xs:simpleType> - - <!-- Structural Elements --> - - <xs:element name="xliff"> - <xs:complexType mixed="false"> - <xs:sequence> - <xs:element minOccurs="1" maxOccurs="unbounded" ref="xlf:file"/> - </xs:sequence> - <xs:attribute name="version" use="required"/> - <xs:attribute name="srcLang" use="required"/> - <xs:attribute name="trgLang" use="optional"/> - <xs:attribute ref="xml:space" use="optional" default="default"/> - <xs:anyAttribute namespace="##other" processContents="lax"/> - </xs:complexType> - </xs:element> - - <xs:element name="file"> - <xs:complexType mixed="false"> - <xs:sequence> - <xs:element minOccurs="0" maxOccurs="1" ref="xlf:skeleton"/> - <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" - processContents="lax"/> - <xs:element minOccurs="0" maxOccurs="1" ref="xlf:notes"/> - <xs:choice minOccurs="1" maxOccurs="unbounded"> - <xs:element ref="xlf:unit"/> - <xs:element ref="xlf:group"/> - </xs:choice> - </xs:sequence> - <xs:attribute name="id" use="required" type="xs:NMTOKEN"/> - <xs:attribute name="canResegment" use="optional" type="xlf:yesNo" default="yes"/> - <xs:attribute name="original" use="optional"/> - <xs:attribute name="translate" use="optional" type="xlf:yesNo" default="yes"/> - <xs:attribute name="srcDir" use="optional" type="xlf:dirValue" default="auto"/> - <xs:attribute name="trgDir" use="optional" type="xlf:dirValue" default="auto"/> - <xs:attribute ref="xml:space" use="optional"/> - <xs:anyAttribute namespace="##other" processContents="lax"/> - </xs:complexType> - </xs:element> - - <xs:element name="skeleton"> - <xs:complexType mixed="true"> - <xs:sequence> - <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" - processContents="lax"/> - </xs:sequence> - <xs:attribute name="href" use="optional"/> - </xs:complexType> - </xs:element> - - <xs:element name="group"> - <xs:complexType mixed="false"> - <xs:sequence> - <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" - processContents="lax"/> - <xs:element minOccurs="0" maxOccurs="1" ref="xlf:notes"/> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:element ref="xlf:unit"/> - <xs:element ref="xlf:group"/> - </xs:choice> - </xs:sequence> - <xs:attribute name="id" use="required" type="xs:NMTOKEN"/> - <xs:attribute name="name" use="optional"/> - <xs:attribute name="canResegment" use="optional" type="xlf:yesNo"/> - <xs:attribute name="translate" use="optional" type="xlf:yesNo"/> - <xs:attribute name="srcDir" use="optional" type="xlf:dirValue"/> - <xs:attribute name="trgDir" use="optional" type="xlf:dirValue"/> - <xs:attribute name="type" use="optional" type="xlf:userDefinedValue"/> - <xs:attribute ref="xml:space" use="optional"/> - <xs:anyAttribute namespace="##other" processContents="lax"/> - </xs:complexType> - </xs:element> - - <xs:element name="unit"> - <xs:complexType mixed="false"> - <xs:sequence> - <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" - processContents="lax"/> - <xs:element minOccurs="0" maxOccurs="1" ref="xlf:notes"/> - <xs:element minOccurs="0" maxOccurs="1" ref="xlf:originalData"/> - <xs:choice minOccurs="1" maxOccurs="unbounded"> - <xs:element ref="xlf:segment"/> - <xs:element ref="xlf:ignorable"/> - </xs:choice> - </xs:sequence> - <xs:attribute name="id" use="required" type="xs:NMTOKEN"/> - <xs:attribute name="name" use="optional"/> - <xs:attribute name="canResegment" use="optional" type="xlf:yesNo"/> - <xs:attribute name="translate" use="optional" type="xlf:yesNo"/> - <xs:attribute name="srcDir" use="optional" type="xlf:dirValue"/> - <xs:attribute name="trgDir" use="optional" type="xlf:dirValue"/> - <xs:attribute ref="xml:space" use="optional"/> - <xs:attribute name="type" use="optional" type="xlf:userDefinedValue"/> - <xs:anyAttribute namespace="##other" processContents="lax"/> - </xs:complexType> - </xs:element> - - <xs:element name="segment"> - <xs:complexType mixed="false"> - <xs:sequence> - <xs:element minOccurs="1" maxOccurs="1" ref="xlf:source"/> - <xs:element minOccurs="0" maxOccurs="1" ref="xlf:target"/> - </xs:sequence> - <xs:attribute name="id" use="optional" type="xs:NMTOKEN"/> - <xs:attribute name="canResegment" use="optional" type="xlf:yesNo"/> - <xs:attribute name="state" use="optional" type="xlf:stateType" default="initial"/> - <xs:attribute name="subState" use="optional"/> - </xs:complexType> - </xs:element> - - <xs:element name="ignorable"> - <xs:complexType mixed="false"> - <xs:sequence> - <xs:element minOccurs="1" maxOccurs="1" ref="xlf:source"/> - <xs:element minOccurs="0" maxOccurs="1" ref="xlf:target"/> - </xs:sequence> - <xs:attribute name="id" use="optional" type="xs:NMTOKEN"/> - </xs:complexType> - </xs:element> - - <xs:element name="notes"> - <xs:complexType mixed="false"> - <xs:sequence> - <xs:element minOccurs="1" maxOccurs="unbounded" ref="xlf:note"/> - </xs:sequence> - </xs:complexType> - </xs:element> - - <xs:element name="note"> - <xs:complexType mixed="true"> - <xs:attribute name="id" use="optional" type="xs:NMTOKEN"/> - <xs:attribute name="appliesTo" use="optional" type="xlf:appliesTo"/> - <xs:attribute name="category" use="optional"/> - <xs:attribute name="priority" use="optional" type="xlf:priorityValue" default="1"/> - <xs:anyAttribute namespace="##other" processContents="lax"/> - </xs:complexType> - </xs:element> - - <xs:element name="originalData"> - <xs:complexType mixed="false"> - <xs:sequence> - <xs:element minOccurs="1" maxOccurs="unbounded" ref="xlf:data"/> - </xs:sequence> - </xs:complexType> - </xs:element> - - <xs:element name="data"> - <xs:complexType mixed="true"> - <xs:sequence> - <xs:element minOccurs="0" maxOccurs="unbounded" ref="xlf:cp"/> - </xs:sequence> - <xs:attribute name="id" use="required" type="xs:NMTOKEN"/> - <xs:attribute name="dir" use="optional" type="xlf:dirValue" default="auto"/> - <xs:attribute ref="xml:space" use="optional" fixed="preserve"/> - </xs:complexType> - </xs:element> - - <xs:element name="source"> - <xs:complexType mixed="true"> - <xs:group ref="xlf:inline" minOccurs="0" maxOccurs="unbounded"/> - <xs:attribute ref="xml:lang" use="optional"/> - <xs:attribute ref="xml:space" use="optional"/> - </xs:complexType> - </xs:element> - - <xs:element name="target"> - <xs:complexType mixed="true"> - <xs:group ref="xlf:inline" minOccurs="0" maxOccurs="unbounded"/> - <xs:attribute ref="xml:lang" use="optional"/> - <xs:attribute ref="xml:space" use="optional"/> - <xs:attribute name="order" use="optional" type="xs:positiveInteger"/> - </xs:complexType> - </xs:element> - - <!-- Inline Elements --> - - <xs:element name="cp"> - <!-- Code Point --> - <xs:complexType mixed="false"> - <xs:attribute name="hex" use="required" type="xs:hexBinary"/> - </xs:complexType> - </xs:element> - - <xs:element name="ph"> - <!-- Placeholder --> - <xs:complexType mixed="false"> - <xs:attribute name="canCopy" use="optional" type="xlf:yesNo" default="yes"/> - <xs:attribute name="canDelete" use="optional" type="xlf:yesNo" default="yes"/> - <xs:attribute name="canReorder" use="optional" type="xlf:yesNoFirstNo" default="yes"/> - <xs:attribute name="copyOf" use="optional" type="xs:NMTOKEN"/> - <xs:attribute name="disp" use="optional"/> - <xs:attribute name="equiv" use="optional"/> - <xs:attribute name="id" use="required" type="xs:NMTOKEN"/> - <xs:attribute name="dataRef" use="optional" type="xs:NMTOKEN"/> - <xs:attribute name="subFlows" use="optional" type="xs:NMTOKENS"/> - <xs:attribute name="subType" use="optional" type="xlf:userDefinedValue"/> - <xs:attribute name="type" use="optional" type="xlf:attrType_type"/> - <xs:anyAttribute namespace="##other" processContents="lax"/> - </xs:complexType> - </xs:element> - - <xs:element name="pc"> - <!-- Paired Code --> - <xs:complexType mixed="true"> - <xs:group ref="xlf:inline" minOccurs="0" maxOccurs="unbounded"/> - <xs:attribute name="canCopy" use="optional" type="xlf:yesNo" default="yes"/> - <xs:attribute name="canDelete" use="optional" type="xlf:yesNo" default="yes"/> - <xs:attribute name="canOverlap" use="optional" type="xlf:yesNo"/> - <xs:attribute name="canReorder" use="optional" type="xlf:yesNoFirstNo" default="yes"/> - <xs:attribute name="copyOf" use="optional" type="xs:NMTOKEN"/> - <xs:attribute name="dispEnd" use="optional"/> - <xs:attribute name="dispStart" use="optional"/> - <xs:attribute name="equivEnd" use="optional"/> - <xs:attribute name="equivStart" use="optional"/> - <xs:attribute name="id" use="required" type="xs:NMTOKEN"/> - <xs:attribute name="dataRefEnd" use="optional" type="xs:NMTOKEN"/> - <xs:attribute name="dataRefStart" use="optional" type="xs:NMTOKEN"/> - <xs:attribute name="subFlowsEnd" use="optional" type="xs:NMTOKENS"/> - <xs:attribute name="subFlowsStart" use="optional" type="xs:NMTOKENS"/> - <xs:attribute name="subType" use="optional" type="xlf:userDefinedValue"/> - <xs:attribute name="type" use="optional" type="xlf:attrType_type"/> - <xs:attribute name="dir" use="optional" type="xlf:dirValue"/> - <xs:anyAttribute namespace="##other" processContents="lax"/> - </xs:complexType> - </xs:element> - - <xs:element name="sc"> - <!-- Start Code --> - <xs:complexType mixed="false"> - <xs:attribute name="canCopy" use="optional" type="xlf:yesNo" default="yes"/> - <xs:attribute name="canDelete" use="optional" type="xlf:yesNo" default="yes"/> - <xs:attribute name="canOverlap" use="optional" type="xlf:yesNo" default="yes"/> - <xs:attribute name="canReorder" use="optional" type="xlf:yesNoFirstNo" default="yes"/> - <xs:attribute name="copyOf" use="optional" type="xs:NMTOKEN"/> - <xs:attribute name="dataRef" use="optional" type="xs:NMTOKEN"/> - <xs:attribute name="dir" use="optional" type="xlf:dirValue"/> - <xs:attribute name="disp" use="optional"/> - <xs:attribute name="equiv" use="optional"/> - <xs:attribute name="id" use="required" type="xs:NMTOKEN"/> - <xs:attribute name="isolated" use="optional" type="xlf:yesNo" default="no"/> - <xs:attribute name="subFlows" use="optional" type="xs:NMTOKENS"/> - <xs:attribute name="subType" use="optional" type="xlf:userDefinedValue"/> - <xs:attribute name="type" use="optional" type="xlf:attrType_type"/> - <xs:anyAttribute namespace="##other" processContents="lax"/> - </xs:complexType> - </xs:element> - - <xs:element name="ec"> - <!-- End Code --> - <xs:complexType mixed="false"> - <xs:attribute name="canCopy" use="optional" type="xlf:yesNo" default="yes"/> - <xs:attribute name="canDelete" use="optional" type="xlf:yesNo" default="yes"/> - <xs:attribute name="canOverlap" use="optional" type="xlf:yesNo" default="yes"/> - <xs:attribute name="canReorder" use="optional" type="xlf:yesNoFirstNo" default="yes"/> - <xs:attribute name="copyOf" use="optional" type="xs:NMTOKEN"/> - <xs:attribute name="dataRef" use="optional" type="xs:NMTOKEN"/> - <xs:attribute name="dir" use="optional" type="xlf:dirValue"/> - <xs:attribute name="disp" use="optional"/> - <xs:attribute name="equiv" use="optional"/> - <xs:attribute name="id" use="optional" type="xs:NMTOKEN"/> - <xs:attribute name="isolated" use="optional" type="xlf:yesNo" default="no"/> - <xs:attribute name="startRef" use="optional" type="xs:NMTOKEN"/> - <xs:attribute name="subFlows" use="optional" type="xs:NMTOKENS"/> - <xs:attribute name="subType" use="optional" type="xlf:userDefinedValue"/> - <xs:attribute name="type" use="optional" type="xlf:attrType_type"/> - <xs:anyAttribute namespace="##other" processContents="lax"/> - </xs:complexType> - </xs:element> - - <xs:element name="mrk"> - <!-- Annotation Marker --> - <xs:complexType mixed="true"> - <xs:group ref="xlf:inline" minOccurs="0" maxOccurs="unbounded"/> - <xs:attribute name="id" use="required" type="xs:NMTOKEN"/> - <xs:attribute name="translate" use="optional" type="xlf:yesNo"/> - <xs:attribute name="type" use="optional" type="xlf:attrType_typeForMrk"/> - <xs:attribute name="ref" use="optional" type="xs:anyURI"/> - <xs:attribute name="value" use="optional"/> - <xs:anyAttribute namespace="##other" processContents="lax"/> - </xs:complexType> - </xs:element> - - <xs:element name="sm"> - <!-- Start Annotation Marker --> - <xs:complexType mixed="false"> - <xs:attribute name="id" use="required" type="xs:NMTOKEN"/> - <xs:attribute name="translate" use="optional" type="xlf:yesNo"/> - <xs:attribute name="type" use="optional" type="xlf:attrType_typeForMrk"/> - <xs:attribute name="ref" use="optional" type="xs:anyURI"/> - <xs:attribute name="value" use="optional"/> - <xs:anyAttribute namespace="##other" processContents="lax"/> - </xs:complexType> - </xs:element> - - <xs:element name="em"> - <!-- End Annotation Marker --> - <xs:complexType mixed="false"> - <xs:attribute name="startRef" use="required" type="xs:NMTOKEN"/> - </xs:complexType> - </xs:element> - -</xs:schema> diff --git a/vendor/symfony/translation/Loader/schema/dic/xliff-core/xml.xsd b/vendor/symfony/translation/Loader/schema/dic/xliff-core/xml.xsd deleted file mode 100644 index a46162a..0000000 --- a/vendor/symfony/translation/Loader/schema/dic/xliff-core/xml.xsd +++ /dev/null @@ -1,309 +0,0 @@ -<?xml version='1.0'?> -<?xml-stylesheet href="../2008/09/xsd.xsl" type="text/xsl"?> -<xs:schema targetNamespace="http://www.w3.org/XML/1998/namespace" - xmlns:xs="http://www.w3.org/2001/XMLSchema" - xmlns ="http://www.w3.org/1999/xhtml" - xml:lang="en"> - - <xs:annotation> - <xs:documentation> - <div> - <h1>About the XML namespace</h1> - - <div class="bodytext"> - <p> - - This schema document describes the XML namespace, in a form - suitable for import by other schema documents. - </p> - <p> - See <a href="http://www.w3.org/XML/1998/namespace.html"> - http://www.w3.org/XML/1998/namespace.html</a> and - <a href="http://www.w3.org/TR/REC-xml"> - http://www.w3.org/TR/REC-xml</a> for information - about this namespace. - </p> - - <p> - Note that local names in this namespace are intended to be - defined only by the World Wide Web Consortium or its subgroups. - The names currently defined in this namespace are listed below. - They should not be used with conflicting semantics by any Working - Group, specification, or document instance. - </p> - <p> - See further below in this document for more information about <a - href="#usage">how to refer to this schema document from your own - XSD schema documents</a> and about <a href="#nsversioning">the - namespace-versioning policy governing this schema document</a>. - </p> - </div> - </div> - - </xs:documentation> - </xs:annotation> - - <xs:attribute name="lang"> - <xs:annotation> - <xs:documentation> - <div> - - <h3>lang (as an attribute name)</h3> - <p> - - denotes an attribute whose value - is a language code for the natural language of the content of - any element; its value is inherited. This name is reserved - by virtue of its definition in the XML specification.</p> - - </div> - <div> - <h4>Notes</h4> - <p> - Attempting to install the relevant ISO 2- and 3-letter - codes as the enumerated possible values is probably never - going to be a realistic possibility. - </p> - <p> - - See BCP 47 at <a href="http://www.rfc-editor.org/rfc/bcp/bcp47.txt"> - http://www.rfc-editor.org/rfc/bcp/bcp47.txt</a> - and the IANA language subtag registry at - <a href="http://www.iana.org/assignments/language-subtag-registry"> - http://www.iana.org/assignments/language-subtag-registry</a> - for further information. - </p> - <p> - - The union allows for the 'un-declaration' of xml:lang with - the empty string. - </p> - </div> - </xs:documentation> - </xs:annotation> - <xs:simpleType> - <xs:union memberTypes="xs:language"> - <xs:simpleType> - <xs:restriction base="xs:string"> - <xs:enumeration value=""/> - - </xs:restriction> - </xs:simpleType> - </xs:union> - </xs:simpleType> - </xs:attribute> - - <xs:attribute name="space"> - <xs:annotation> - <xs:documentation> - - <div> - - <h3>space (as an attribute name)</h3> - <p> - denotes an attribute whose - value is a keyword indicating what whitespace processing - discipline is intended for the content of the element; its - value is inherited. This name is reserved by virtue of its - definition in the XML specification.</p> - - </div> - </xs:documentation> - </xs:annotation> - <xs:simpleType> - - <xs:restriction base="xs:NCName"> - <xs:enumeration value="default"/> - <xs:enumeration value="preserve"/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - - <xs:attribute name="base" type="xs:anyURI"> <xs:annotation> - <xs:documentation> - - <div> - - <h3>base (as an attribute name)</h3> - <p> - denotes an attribute whose value - provides a URI to be used as the base for interpreting any - relative URIs in the scope of the element on which it - appears; its value is inherited. This name is reserved - by virtue of its definition in the XML Base specification.</p> - - <p> - See <a - href="http://www.w3.org/TR/xmlbase/">http://www.w3.org/TR/xmlbase/</a> - for information about this attribute. - </p> - - </div> - </xs:documentation> - </xs:annotation> - </xs:attribute> - - <xs:attribute name="id" type="xs:ID"> - <xs:annotation> - <xs:documentation> - <div> - - <h3>id (as an attribute name)</h3> - <p> - - denotes an attribute whose value - should be interpreted as if declared to be of type ID. - This name is reserved by virtue of its definition in the - xml:id specification.</p> - - <p> - See <a - href="http://www.w3.org/TR/xml-id/">http://www.w3.org/TR/xml-id/</a> - for information about this attribute. - </p> - </div> - </xs:documentation> - </xs:annotation> - - </xs:attribute> - - <xs:attributeGroup name="specialAttrs"> - <xs:attribute ref="xml:base"/> - <xs:attribute ref="xml:lang"/> - <xs:attribute ref="xml:space"/> - <xs:attribute ref="xml:id"/> - </xs:attributeGroup> - - <xs:annotation> - - <xs:documentation> - <div> - - <h3>Father (in any context at all)</h3> - - <div class="bodytext"> - <p> - denotes Jon Bosak, the chair of - the original XML Working Group. This name is reserved by - the following decision of the W3C XML Plenary and - XML Coordination groups: - </p> - <blockquote> - <p> - - In appreciation for his vision, leadership and - dedication the W3C XML Plenary on this 10th day of - February, 2000, reserves for Jon Bosak in perpetuity - the XML name "xml:Father". - </p> - </blockquote> - </div> - </div> - </xs:documentation> - </xs:annotation> - - <xs:annotation> - <xs:documentation> - - <div xml:id="usage" id="usage"> - <h2><a name="usage">About this schema document</a></h2> - - <div class="bodytext"> - <p> - This schema defines attributes and an attribute group suitable - for use by schemas wishing to allow <code>xml:base</code>, - <code>xml:lang</code>, <code>xml:space</code> or - <code>xml:id</code> attributes on elements they define. - </p> - - <p> - To enable this, such a schema must import this schema for - the XML namespace, e.g. as follows: - </p> - <pre> - <schema.. .> - .. . - <import namespace="http://www.w3.org/XML/1998/namespace" - schemaLocation="http://www.w3.org/2001/xml.xsd"/> - </pre> - <p> - or - </p> - <pre> - - <import namespace="http://www.w3.org/XML/1998/namespace" - schemaLocation="http://www.w3.org/2009/01/xml.xsd"/> - </pre> - <p> - Subsequently, qualified reference to any of the attributes or the - group defined below will have the desired effect, e.g. - </p> - <pre> - <type.. .> - .. . - <attributeGroup ref="xml:specialAttrs"/> - </pre> - <p> - will define a type which will schema-validate an instance element - with any of those attributes. - </p> - - </div> - </div> - </xs:documentation> - </xs:annotation> - - <xs:annotation> - <xs:documentation> - <div id="nsversioning" xml:id="nsversioning"> - <h2><a name="nsversioning">Versioning policy for this schema document</a></h2> - - <div class="bodytext"> - <p> - In keeping with the XML Schema WG's standard versioning - policy, this schema document will persist at - <a href="http://www.w3.org/2009/01/xml.xsd"> - http://www.w3.org/2009/01/xml.xsd</a>. - </p> - <p> - At the date of issue it can also be found at - <a href="http://www.w3.org/2001/xml.xsd"> - http://www.w3.org/2001/xml.xsd</a>. - </p> - - <p> - The schema document at that URI may however change in the future, - in order to remain compatible with the latest version of XML - Schema itself, or with the XML namespace itself. In other words, - if the XML Schema or XML namespaces change, the version of this - document at <a href="http://www.w3.org/2001/xml.xsd"> - http://www.w3.org/2001/xml.xsd - </a> - will change accordingly; the version at - <a href="http://www.w3.org/2009/01/xml.xsd"> - http://www.w3.org/2009/01/xml.xsd - </a> - will not change. - </p> - <p> - - Previous dated (and unchanging) versions of this schema - document are at: - </p> - <ul> - <li><a href="http://www.w3.org/2009/01/xml.xsd"> - http://www.w3.org/2009/01/xml.xsd</a></li> - <li><a href="http://www.w3.org/2007/08/xml.xsd"> - http://www.w3.org/2007/08/xml.xsd</a></li> - <li><a href="http://www.w3.org/2004/10/xml.xsd"> - - http://www.w3.org/2004/10/xml.xsd</a></li> - <li><a href="http://www.w3.org/2001/03/xml.xsd"> - http://www.w3.org/2001/03/xml.xsd</a></li> - </ul> - </div> - </div> - </xs:documentation> - </xs:annotation> - -</xs:schema> diff --git a/vendor/symfony/translation/LoggingTranslator.php b/vendor/symfony/translation/LoggingTranslator.php index 942736e..812136f 100644 --- a/vendor/symfony/translation/LoggingTranslator.php +++ b/vendor/symfony/translation/LoggingTranslator.php @@ -13,11 +13,14 @@ namespace Symfony\Component\Translation; use Psr\Log\LoggerInterface; use Symfony\Component\Translation\Exception\InvalidArgumentException; +use Symfony\Component\Translation\TranslatorInterface as LegacyTranslatorInterface; +use Symfony\Contracts\Translation\LocaleAwareInterface; +use Symfony\Contracts\Translation\TranslatorInterface; /** * @author Abdellatif Ait boudad <a.aitboudad@gmail.com> */ -class LoggingTranslator implements TranslatorInterface, TranslatorBagInterface +class LoggingTranslator implements TranslatorInterface, LegacyTranslatorInterface, TranslatorBagInterface { /** * @var TranslatorInterface|TranslatorBagInterface @@ -29,10 +32,13 @@ class LoggingTranslator implements TranslatorInterface, TranslatorBagInterface /** * @param TranslatorInterface $translator The translator must implement TranslatorBagInterface */ - public function __construct(TranslatorInterface $translator, LoggerInterface $logger) + public function __construct($translator, LoggerInterface $logger) { - if (!$translator instanceof TranslatorBagInterface) { - throw new InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface and TranslatorBagInterface.', \get_class($translator))); + if (!$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) { + throw new \TypeError(sprintf('Argument 1 passed to %s() must be an instance of %s, %s given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator))); + } + if (!$translator instanceof TranslatorBagInterface || !$translator instanceof LocaleAwareInterface) { + throw new InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface, TranslatorBagInterface and LocaleAwareInterface.', \get_class($translator))); } $this->translator = $translator; @@ -52,10 +58,19 @@ class LoggingTranslator implements TranslatorInterface, TranslatorBagInterface /** * {@inheritdoc} + * + * @deprecated since Symfony 4.2, use the trans() method instead with a %count% parameter */ public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null) { - $trans = $this->translator->transChoice($id, $number, $parameters, $domain, $locale); + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the trans() one instead with a "%%count%%" parameter.', __METHOD__), E_USER_DEPRECATED); + + if ($this->translator instanceof TranslatorInterface) { + $trans = $this->translator->trans($id, ['%count%' => $number] + $parameters, $domain, $locale); + } else { + $trans = $this->translator->transChoice($id, $number, $parameters, $domain, $locale); + } + $this->log($id, $domain, $locale); return $trans; @@ -66,7 +81,13 @@ class LoggingTranslator implements TranslatorInterface, TranslatorBagInterface */ public function setLocale($locale) { + $prev = $this->translator->getLocale(); $this->translator->setLocale($locale); + if ($prev === $locale) { + return; + } + + $this->logger->debug(sprintf('The locale of the translator has changed from "%s" to "%s".', $prev, $locale)); } /** @@ -104,17 +125,13 @@ class LoggingTranslator implements TranslatorInterface, TranslatorBagInterface */ public function __call($method, $args) { - return \call_user_func_array([$this->translator, $method], $args); + return $this->translator->{$method}(...$args); } /** * Logs for missing translations. - * - * @param string $id - * @param string|null $domain - * @param string|null $locale */ - private function log($id, $domain, $locale) + private function log(?string $id, ?string $domain, ?string $locale) { if (null === $domain) { $domain = 'messages'; diff --git a/vendor/symfony/translation/MessageCatalogue.php b/vendor/symfony/translation/MessageCatalogue.php index 9b59c87..cde056a 100644 --- a/vendor/symfony/translation/MessageCatalogue.php +++ b/vendor/symfony/translation/MessageCatalogue.php @@ -30,8 +30,12 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf * @param string $locale The locale * @param array $messages An array of messages classified by domain */ - public function __construct($locale, array $messages = []) + public function __construct(?string $locale, array $messages = []) { + if (null === $locale) { + @trigger_error(sprintf('Passing "null" to the first argument of the "%s" method has been deprecated since Symfony 4.4 and will throw an error in 5.0.', __METHOD__), E_USER_DEPRECATED); + } + $this->locale = $locale; $this->messages = $messages; } @@ -49,7 +53,17 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf */ public function getDomains() { - return array_keys($this->messages); + $domains = []; + $suffixLength = \strlen(self::INTL_DOMAIN_SUFFIX); + + foreach ($this->messages as $domain => $messages) { + if (\strlen($domain) > $suffixLength && false !== $i = strpos($domain, self::INTL_DOMAIN_SUFFIX, -$suffixLength)) { + $domain = substr($domain, 0, $i); + } + $domains[$domain] = $domain; + } + + return array_values($domains); } /** @@ -57,11 +71,23 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf */ public function all($domain = null) { - if (null === $domain) { - return $this->messages; + if (null !== $domain) { + return ($this->messages[$domain.self::INTL_DOMAIN_SUFFIX] ?? []) + ($this->messages[$domain] ?? []); + } + + $allMessages = []; + $suffixLength = \strlen(self::INTL_DOMAIN_SUFFIX); + + foreach ($this->messages as $domain => $messages) { + if (\strlen($domain) > $suffixLength && false !== $i = strpos($domain, self::INTL_DOMAIN_SUFFIX, -$suffixLength)) { + $domain = substr($domain, 0, $i); + $allMessages[$domain] = $messages + ($allMessages[$domain] ?? []); + } else { + $allMessages[$domain] = ($allMessages[$domain] ?? []) + $messages; + } } - return isset($this->messages[$domain]) ? $this->messages[$domain] : []; + return $allMessages; } /** @@ -77,7 +103,7 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf */ public function has($id, $domain = 'messages') { - if (isset($this->messages[$domain][$id])) { + if (isset($this->messages[$domain][$id]) || isset($this->messages[$domain.self::INTL_DOMAIN_SUFFIX][$id])) { return true; } @@ -93,7 +119,7 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf */ public function defines($id, $domain = 'messages') { - return isset($this->messages[$domain][$id]); + return isset($this->messages[$domain][$id]) || isset($this->messages[$domain.self::INTL_DOMAIN_SUFFIX][$id]); } /** @@ -101,6 +127,10 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf */ public function get($id, $domain = 'messages') { + if (isset($this->messages[$domain.self::INTL_DOMAIN_SUFFIX][$id])) { + return $this->messages[$domain.self::INTL_DOMAIN_SUFFIX][$id]; + } + if (isset($this->messages[$domain][$id])) { return $this->messages[$domain][$id]; } @@ -117,7 +147,7 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf */ public function replace($messages, $domain = 'messages') { - $this->messages[$domain] = []; + unset($this->messages[$domain], $this->messages[$domain.self::INTL_DOMAIN_SUFFIX]); $this->add($messages, $domain); } @@ -128,9 +158,19 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf public function add($messages, $domain = 'messages') { if (!isset($this->messages[$domain])) { - $this->messages[$domain] = $messages; - } else { - $this->messages[$domain] = array_replace($this->messages[$domain], $messages); + $this->messages[$domain] = []; + } + $intlDomain = $domain; + $suffixLength = \strlen(self::INTL_DOMAIN_SUFFIX); + if (\strlen($domain) > $suffixLength && false !== strpos($domain, self::INTL_DOMAIN_SUFFIX, -$suffixLength)) { + $intlDomain .= self::INTL_DOMAIN_SUFFIX; + } + foreach ($messages as $id => $message) { + if (isset($this->messages[$intlDomain]) && \array_key_exists($id, $this->messages[$intlDomain])) { + $this->messages[$intlDomain][$id] = $message; + } else { + $this->messages[$domain][$id] = $message; + } } } @@ -144,6 +184,10 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf } foreach ($catalogue->all() as $domain => $messages) { + if ($intlMessages = $catalogue->all($domain.self::INTL_DOMAIN_SUFFIX)) { + $this->add($intlMessages, $domain.self::INTL_DOMAIN_SUFFIX); + $messages = array_diff_key($messages, $intlMessages); + } $this->add($messages, $domain); } diff --git a/vendor/symfony/translation/MessageCatalogueInterface.php b/vendor/symfony/translation/MessageCatalogueInterface.php index e0dbb2b..f3d3f5e 100644 --- a/vendor/symfony/translation/MessageCatalogueInterface.php +++ b/vendor/symfony/translation/MessageCatalogueInterface.php @@ -20,6 +20,8 @@ use Symfony\Component\Config\Resource\ResourceInterface; */ interface MessageCatalogueInterface { + const INTL_DOMAIN_SUFFIX = '+intl-icu'; + /** * Gets the catalogue locale. * diff --git a/vendor/symfony/translation/MessageSelector.php b/vendor/symfony/translation/MessageSelector.php index a7743eb..0f0febb 100644 --- a/vendor/symfony/translation/MessageSelector.php +++ b/vendor/symfony/translation/MessageSelector.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Translation; +@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.2, use IdentityTranslator instead.', MessageSelector::class), E_USER_DEPRECATED); + use Symfony\Component\Translation\Exception\InvalidArgumentException; /** @@ -18,6 +20,8 @@ use Symfony\Component\Translation\Exception\InvalidArgumentException; * * @author Fabien Potencier <fabien@symfony.com> * @author Bernhard Schussek <bschussek@gmail.com> + * + * @deprecated since Symfony 4.2, use IdentityTranslator instead. */ class MessageSelector { @@ -39,9 +43,9 @@ class MessageSelector * The two methods can also be mixed: * {0} There are no apples|one: There is one apple|more: There are %count% apples * - * @param string $message The message being translated - * @param int $number The number of items represented for the message - * @param string $locale The locale to use for choosing + * @param string $message The message being translated + * @param int|float $number The number of items represented for the message + * @param string $locale The locale to use for choosing * * @return string * diff --git a/vendor/symfony/translation/PluralizationRules.php b/vendor/symfony/translation/PluralizationRules.php index d369f5f..77c2760 100644 --- a/vendor/symfony/translation/PluralizationRules.php +++ b/vendor/symfony/translation/PluralizationRules.php @@ -15,6 +15,8 @@ namespace Symfony\Component\Translation; * Returns the plural rules for a given locale. * * @author Fabien Potencier <fabien@symfony.com> + * + * @deprecated since Symfony 4.2, use IdentityTranslator instead */ class PluralizationRules { @@ -28,8 +30,12 @@ class PluralizationRules * * @return int The plural position */ - public static function get($number, $locale) + public static function get($number, $locale/*, bool $triggerDeprecation = true*/) { + if (3 > \func_num_args() || func_get_arg(2)) { + @trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.2.', __CLASS__), E_USER_DEPRECATED); + } + if ('pt_BR' === $locale) { // temporary set a locale for brazilian $locale = 'xbr'; @@ -40,7 +46,7 @@ class PluralizationRules } if (isset(self::$rules[$locale])) { - $return = \call_user_func(self::$rules[$locale], $number); + $return = self::$rules[$locale]($number); if (!\is_int($return) || $return < 0) { return 0; @@ -196,6 +202,8 @@ class PluralizationRules */ public static function set(callable $rule, $locale) { + @trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.2.', __CLASS__), E_USER_DEPRECATED); + if ('pt_BR' === $locale) { // temporary set a locale for brazilian $locale = 'xbr'; diff --git a/vendor/symfony/translation/README.md b/vendor/symfony/translation/README.md index 46f3d1f..f4f1706 100644 --- a/vendor/symfony/translation/README.md +++ b/vendor/symfony/translation/README.md @@ -3,10 +3,28 @@ Translation Component The Translation component provides tools to internationalize your application. +Getting Started +--------------- + +``` +$ composer require symfony/translation +``` + +```php +use Symfony\Component\Translation\Translator; + +$translator = new Translator('fr_FR'); +$translator->addResource('array', [ + 'Hello World!' => 'Bonjour !', +], 'fr_FR'); + +echo $translator->trans('Hello World!'); // outputs « Bonjour ! » +``` + Resources --------- - * [Documentation](https://symfony.com/doc/current/components/translation/index.html) + * [Documentation](https://symfony.com/doc/current/translation.html) * [Contributing](https://symfony.com/doc/current/contributing/index.html) * [Report issues](https://github.com/symfony/symfony/issues) and [send Pull Requests](https://github.com/symfony/symfony/pulls) diff --git a/vendor/symfony/translation/Tests/Catalogue/AbstractOperationTest.php b/vendor/symfony/translation/Tests/Catalogue/AbstractOperationTest.php deleted file mode 100644 index f82b18f..0000000 --- a/vendor/symfony/translation/Tests/Catalogue/AbstractOperationTest.php +++ /dev/null @@ -1,74 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\Catalogue; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\MessageCatalogue; -use Symfony\Component\Translation\MessageCatalogueInterface; - -abstract class AbstractOperationTest extends TestCase -{ - public function testGetEmptyDomains() - { - $this->assertEquals( - [], - $this->createOperation( - new MessageCatalogue('en'), - new MessageCatalogue('en') - )->getDomains() - ); - } - - public function testGetMergedDomains() - { - $this->assertEquals( - ['a', 'b', 'c'], - $this->createOperation( - new MessageCatalogue('en', ['a' => [], 'b' => []]), - new MessageCatalogue('en', ['b' => [], 'c' => []]) - )->getDomains() - ); - } - - public function testGetMessagesFromUnknownDomain() - { - $this->expectException('InvalidArgumentException'); - $this->createOperation( - new MessageCatalogue('en'), - new MessageCatalogue('en') - )->getMessages('domain'); - } - - public function testGetEmptyMessages() - { - $this->assertEquals( - [], - $this->createOperation( - new MessageCatalogue('en', ['a' => []]), - new MessageCatalogue('en') - )->getMessages('a') - ); - } - - public function testGetEmptyResult() - { - $this->assertEquals( - new MessageCatalogue('en'), - $this->createOperation( - new MessageCatalogue('en'), - new MessageCatalogue('en') - )->getResult() - ); - } - - abstract protected function createOperation(MessageCatalogueInterface $source, MessageCatalogueInterface $target); -} diff --git a/vendor/symfony/translation/Tests/Catalogue/MergeOperationTest.php b/vendor/symfony/translation/Tests/Catalogue/MergeOperationTest.php deleted file mode 100644 index 0dc68be..0000000 --- a/vendor/symfony/translation/Tests/Catalogue/MergeOperationTest.php +++ /dev/null @@ -1,83 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\Catalogue; - -use Symfony\Component\Translation\Catalogue\MergeOperation; -use Symfony\Component\Translation\MessageCatalogue; -use Symfony\Component\Translation\MessageCatalogueInterface; - -class MergeOperationTest extends AbstractOperationTest -{ - public function testGetMessagesFromSingleDomain() - { - $operation = $this->createOperation( - new MessageCatalogue('en', ['messages' => ['a' => 'old_a', 'b' => 'old_b']]), - new MessageCatalogue('en', ['messages' => ['a' => 'new_a', 'c' => 'new_c']]) - ); - - $this->assertEquals( - ['a' => 'old_a', 'b' => 'old_b', 'c' => 'new_c'], - $operation->getMessages('messages') - ); - - $this->assertEquals( - ['c' => 'new_c'], - $operation->getNewMessages('messages') - ); - - $this->assertEquals( - [], - $operation->getObsoleteMessages('messages') - ); - } - - public function testGetResultFromSingleDomain() - { - $this->assertEquals( - new MessageCatalogue('en', [ - 'messages' => ['a' => 'old_a', 'b' => 'old_b', 'c' => 'new_c'], - ]), - $this->createOperation( - new MessageCatalogue('en', ['messages' => ['a' => 'old_a', 'b' => 'old_b']]), - new MessageCatalogue('en', ['messages' => ['a' => 'new_a', 'c' => 'new_c']]) - )->getResult() - ); - } - - public function testGetResultWithMetadata() - { - $leftCatalogue = new MessageCatalogue('en', ['messages' => ['a' => 'old_a', 'b' => 'old_b']]); - $leftCatalogue->setMetadata('a', 'foo', 'messages'); - $leftCatalogue->setMetadata('b', 'bar', 'messages'); - $rightCatalogue = new MessageCatalogue('en', ['messages' => ['b' => 'new_b', 'c' => 'new_c']]); - $rightCatalogue->setMetadata('b', 'baz', 'messages'); - $rightCatalogue->setMetadata('c', 'qux', 'messages'); - - $mergedCatalogue = new MessageCatalogue('en', ['messages' => ['a' => 'old_a', 'b' => 'old_b', 'c' => 'new_c']]); - $mergedCatalogue->setMetadata('a', 'foo', 'messages'); - $mergedCatalogue->setMetadata('b', 'bar', 'messages'); - $mergedCatalogue->setMetadata('c', 'qux', 'messages'); - - $this->assertEquals( - $mergedCatalogue, - $this->createOperation( - $leftCatalogue, - $rightCatalogue - )->getResult() - ); - } - - protected function createOperation(MessageCatalogueInterface $source, MessageCatalogueInterface $target) - { - return new MergeOperation($source, $target); - } -} diff --git a/vendor/symfony/translation/Tests/Catalogue/TargetOperationTest.php b/vendor/symfony/translation/Tests/Catalogue/TargetOperationTest.php deleted file mode 100644 index 8077ff0..0000000 --- a/vendor/symfony/translation/Tests/Catalogue/TargetOperationTest.php +++ /dev/null @@ -1,82 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\Catalogue; - -use Symfony\Component\Translation\Catalogue\TargetOperation; -use Symfony\Component\Translation\MessageCatalogue; -use Symfony\Component\Translation\MessageCatalogueInterface; - -class TargetOperationTest extends AbstractOperationTest -{ - public function testGetMessagesFromSingleDomain() - { - $operation = $this->createOperation( - new MessageCatalogue('en', ['messages' => ['a' => 'old_a', 'b' => 'old_b']]), - new MessageCatalogue('en', ['messages' => ['a' => 'new_a', 'c' => 'new_c']]) - ); - - $this->assertEquals( - ['a' => 'old_a', 'c' => 'new_c'], - $operation->getMessages('messages') - ); - - $this->assertEquals( - ['c' => 'new_c'], - $operation->getNewMessages('messages') - ); - - $this->assertEquals( - ['b' => 'old_b'], - $operation->getObsoleteMessages('messages') - ); - } - - public function testGetResultFromSingleDomain() - { - $this->assertEquals( - new MessageCatalogue('en', [ - 'messages' => ['a' => 'old_a', 'c' => 'new_c'], - ]), - $this->createOperation( - new MessageCatalogue('en', ['messages' => ['a' => 'old_a', 'b' => 'old_b']]), - new MessageCatalogue('en', ['messages' => ['a' => 'new_a', 'c' => 'new_c']]) - )->getResult() - ); - } - - public function testGetResultWithMetadata() - { - $leftCatalogue = new MessageCatalogue('en', ['messages' => ['a' => 'old_a', 'b' => 'old_b']]); - $leftCatalogue->setMetadata('a', 'foo', 'messages'); - $leftCatalogue->setMetadata('b', 'bar', 'messages'); - $rightCatalogue = new MessageCatalogue('en', ['messages' => ['b' => 'new_b', 'c' => 'new_c']]); - $rightCatalogue->setMetadata('b', 'baz', 'messages'); - $rightCatalogue->setMetadata('c', 'qux', 'messages'); - - $diffCatalogue = new MessageCatalogue('en', ['messages' => ['b' => 'old_b', 'c' => 'new_c']]); - $diffCatalogue->setMetadata('b', 'bar', 'messages'); - $diffCatalogue->setMetadata('c', 'qux', 'messages'); - - $this->assertEquals( - $diffCatalogue, - $this->createOperation( - $leftCatalogue, - $rightCatalogue - )->getResult() - ); - } - - protected function createOperation(MessageCatalogueInterface $source, MessageCatalogueInterface $target) - { - return new TargetOperation($source, $target); - } -} diff --git a/vendor/symfony/translation/Tests/DataCollector/TranslationDataCollectorTest.php b/vendor/symfony/translation/Tests/DataCollector/TranslationDataCollectorTest.php deleted file mode 100644 index bd97a24..0000000 --- a/vendor/symfony/translation/Tests/DataCollector/TranslationDataCollectorTest.php +++ /dev/null @@ -1,150 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\DataCollector; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\DataCollector\TranslationDataCollector; -use Symfony\Component\Translation\DataCollectorTranslator; - -class TranslationDataCollectorTest extends TestCase -{ - protected function setUp() - { - if (!class_exists('Symfony\Component\HttpKernel\DataCollector\DataCollector')) { - $this->markTestSkipped('The "DataCollector" is not available'); - } - } - - public function testCollectEmptyMessages() - { - $translator = $this->getTranslator(); - $translator->expects($this->any())->method('getCollectedMessages')->willReturn([]); - - $dataCollector = new TranslationDataCollector($translator); - $dataCollector->lateCollect(); - - $this->assertEquals(0, $dataCollector->getCountMissings()); - $this->assertEquals(0, $dataCollector->getCountFallbacks()); - $this->assertEquals(0, $dataCollector->getCountDefines()); - $this->assertEquals([], $dataCollector->getMessages()->getValue()); - } - - public function testCollect() - { - $collectedMessages = [ - [ - 'id' => 'foo', - 'translation' => 'foo (en)', - 'locale' => 'en', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_DEFINED, - 'parameters' => [], - 'transChoiceNumber' => null, - ], - [ - 'id' => 'bar', - 'translation' => 'bar (fr)', - 'locale' => 'fr', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, - 'parameters' => [], - 'transChoiceNumber' => null, - ], - [ - 'id' => 'choice', - 'translation' => 'choice', - 'locale' => 'en', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_MISSING, - 'parameters' => ['%count%' => 3], - 'transChoiceNumber' => 3, - ], - [ - 'id' => 'choice', - 'translation' => 'choice', - 'locale' => 'en', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_MISSING, - 'parameters' => ['%count%' => 3], - 'transChoiceNumber' => 3, - ], - [ - 'id' => 'choice', - 'translation' => 'choice', - 'locale' => 'en', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_MISSING, - 'parameters' => ['%count%' => 4, '%foo%' => 'bar'], - 'transChoiceNumber' => 4, - ], - ]; - $expectedMessages = [ - [ - 'id' => 'foo', - 'translation' => 'foo (en)', - 'locale' => 'en', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_DEFINED, - 'count' => 1, - 'parameters' => [], - 'transChoiceNumber' => null, - ], - [ - 'id' => 'bar', - 'translation' => 'bar (fr)', - 'locale' => 'fr', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, - 'count' => 1, - 'parameters' => [], - 'transChoiceNumber' => null, - ], - [ - 'id' => 'choice', - 'translation' => 'choice', - 'locale' => 'en', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_MISSING, - 'count' => 3, - 'parameters' => [ - ['%count%' => 3], - ['%count%' => 3], - ['%count%' => 4, '%foo%' => 'bar'], - ], - 'transChoiceNumber' => 3, - ], - ]; - - $translator = $this->getTranslator(); - $translator->expects($this->any())->method('getCollectedMessages')->willReturn($collectedMessages); - - $dataCollector = new TranslationDataCollector($translator); - $dataCollector->lateCollect(); - - $this->assertEquals(1, $dataCollector->getCountMissings()); - $this->assertEquals(1, $dataCollector->getCountFallbacks()); - $this->assertEquals(1, $dataCollector->getCountDefines()); - - $this->assertEquals($expectedMessages, array_values($dataCollector->getMessages()->getValue(true))); - } - - private function getTranslator() - { - $translator = $this - ->getMockBuilder('Symfony\Component\Translation\DataCollectorTranslator') - ->disableOriginalConstructor() - ->getMock() - ; - - return $translator; - } -} diff --git a/vendor/symfony/translation/Tests/DataCollectorTranslatorTest.php b/vendor/symfony/translation/Tests/DataCollectorTranslatorTest.php deleted file mode 100644 index 5cb7c31..0000000 --- a/vendor/symfony/translation/Tests/DataCollectorTranslatorTest.php +++ /dev/null @@ -1,97 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\DataCollectorTranslator; -use Symfony\Component\Translation\Loader\ArrayLoader; -use Symfony\Component\Translation\Translator; - -class DataCollectorTranslatorTest extends TestCase -{ - public function testCollectMessages() - { - $collector = $this->createCollector(); - $collector->setFallbackLocales(['fr', 'ru']); - - $collector->trans('foo'); - $collector->trans('bar'); - $collector->transChoice('choice', 0); - $collector->trans('bar_ru'); - $collector->trans('bar_ru', ['foo' => 'bar']); - - $expectedMessages = []; - $expectedMessages[] = [ - 'id' => 'foo', - 'translation' => 'foo (en)', - 'locale' => 'en', - 'fallbackLocale' => null, - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_DEFINED, - 'parameters' => [], - 'transChoiceNumber' => null, - ]; - $expectedMessages[] = [ - 'id' => 'bar', - 'translation' => 'bar (fr)', - 'locale' => 'en', - 'fallbackLocale' => 'fr', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, - 'parameters' => [], - 'transChoiceNumber' => null, - ]; - $expectedMessages[] = [ - 'id' => 'choice', - 'translation' => 'choice', - 'locale' => 'en', - 'fallbackLocale' => null, - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_MISSING, - 'parameters' => [], - 'transChoiceNumber' => 0, - ]; - $expectedMessages[] = [ - 'id' => 'bar_ru', - 'translation' => 'bar (ru)', - 'locale' => 'en', - 'fallbackLocale' => 'ru', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, - 'parameters' => [], - 'transChoiceNumber' => null, - ]; - $expectedMessages[] = [ - 'id' => 'bar_ru', - 'translation' => 'bar (ru)', - 'locale' => 'en', - 'fallbackLocale' => 'ru', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, - 'parameters' => ['foo' => 'bar'], - 'transChoiceNumber' => null, - ]; - - $this->assertEquals($expectedMessages, $collector->getCollectedMessages()); - } - - private function createCollector() - { - $translator = new Translator('en'); - $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', ['foo' => 'foo (en)'], 'en'); - $translator->addResource('array', ['bar' => 'bar (fr)'], 'fr'); - $translator->addResource('array', ['bar_ru' => 'bar (ru)'], 'ru'); - - return new DataCollectorTranslator($translator); - } -} diff --git a/vendor/symfony/translation/Tests/DependencyInjection/TranslationDumperPassTest.php b/vendor/symfony/translation/Tests/DependencyInjection/TranslationDumperPassTest.php deleted file mode 100644 index 94769e9..0000000 --- a/vendor/symfony/translation/Tests/DependencyInjection/TranslationDumperPassTest.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\DependencyInjection; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\Translation\DependencyInjection\TranslationDumperPass; - -class TranslationDumperPassTest extends TestCase -{ - public function testProcess() - { - $container = new ContainerBuilder(); - $writerDefinition = $container->register('translation.writer'); - $container->register('foo.id') - ->addTag('translation.dumper', ['alias' => 'bar.alias']); - - $translationDumperPass = new TranslationDumperPass(); - $translationDumperPass->process($container); - - $this->assertEquals([['addDumper', ['bar.alias', new Reference('foo.id')]]], $writerDefinition->getMethodCalls()); - } - - public function testProcessNoDefinitionFound() - { - $container = new ContainerBuilder(); - - $definitionsBefore = \count($container->getDefinitions()); - $aliasesBefore = \count($container->getAliases()); - - $translationDumperPass = new TranslationDumperPass(); - $translationDumperPass->process($container); - - // the container is untouched (i.e. no new definitions or aliases) - $this->assertCount($definitionsBefore, $container->getDefinitions()); - $this->assertCount($aliasesBefore, $container->getAliases()); - } -} diff --git a/vendor/symfony/translation/Tests/DependencyInjection/TranslationExtractorPassTest.php b/vendor/symfony/translation/Tests/DependencyInjection/TranslationExtractorPassTest.php deleted file mode 100644 index 113536b..0000000 --- a/vendor/symfony/translation/Tests/DependencyInjection/TranslationExtractorPassTest.php +++ /dev/null @@ -1,61 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\DependencyInjection; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\Translation\DependencyInjection\TranslationExtractorPass; - -class TranslationExtractorPassTest extends TestCase -{ - public function testProcess() - { - $container = new ContainerBuilder(); - $extractorDefinition = $container->register('translation.extractor'); - $container->register('foo.id') - ->addTag('translation.extractor', ['alias' => 'bar.alias']); - - $translationDumperPass = new TranslationExtractorPass(); - $translationDumperPass->process($container); - - $this->assertEquals([['addExtractor', ['bar.alias', new Reference('foo.id')]]], $extractorDefinition->getMethodCalls()); - } - - public function testProcessNoDefinitionFound() - { - $container = new ContainerBuilder(); - - $definitionsBefore = \count($container->getDefinitions()); - $aliasesBefore = \count($container->getAliases()); - - $translationDumperPass = new TranslationExtractorPass(); - $translationDumperPass->process($container); - - // the container is untouched (i.e. no new definitions or aliases) - $this->assertCount($definitionsBefore, $container->getDefinitions()); - $this->assertCount($aliasesBefore, $container->getAliases()); - } - - public function testProcessMissingAlias() - { - $this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException'); - $this->expectExceptionMessage('The alias for the tag "translation.extractor" of service "foo.id" must be set.'); - $container = new ContainerBuilder(); - $container->register('translation.extractor'); - $container->register('foo.id') - ->addTag('translation.extractor', []); - - $translationDumperPass = new TranslationExtractorPass(); - $translationDumperPass->process($container); - } -} diff --git a/vendor/symfony/translation/Tests/DependencyInjection/TranslationPassTest.php b/vendor/symfony/translation/Tests/DependencyInjection/TranslationPassTest.php deleted file mode 100644 index 96ec625..0000000 --- a/vendor/symfony/translation/Tests/DependencyInjection/TranslationPassTest.php +++ /dev/null @@ -1,103 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\DependencyInjection; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\Translation\DependencyInjection\TranslatorPass; - -class TranslationPassTest extends TestCase -{ - public function testValidCollector() - { - $loader = (new Definition()) - ->addTag('translation.loader', ['alias' => 'xliff', 'legacy-alias' => 'xlf']); - - $reader = new Definition(); - - $translator = (new Definition()) - ->setArguments([null, null, null, null]); - - $container = new ContainerBuilder(); - $container->setDefinition('translator.default', $translator); - $container->setDefinition('translation.reader', $reader); - $container->setDefinition('translation.xliff_loader', $loader); - - $pass = new TranslatorPass('translator.default', 'translation.reader'); - $pass->process($container); - - $expectedReader = (new Definition()) - ->addMethodCall('addLoader', ['xliff', new Reference('translation.xliff_loader')]) - ->addMethodCall('addLoader', ['xlf', new Reference('translation.xliff_loader')]) - ; - $this->assertEquals($expectedReader, $reader); - - $expectedLoader = (new Definition()) - ->addTag('translation.loader', ['alias' => 'xliff', 'legacy-alias' => 'xlf']) - ; - $this->assertEquals($expectedLoader, $loader); - - $this->assertSame(['translation.xliff_loader' => ['xliff', 'xlf']], $translator->getArgument(3)); - - $expected = ['translation.xliff_loader' => new ServiceClosureArgument(new Reference('translation.xliff_loader'))]; - $this->assertEquals($expected, $container->getDefinition((string) $translator->getArgument(0))->getArgument(0)); - } - - /** - * @group legacy - * @expectedDeprecation The default value for $readerServiceId in "Symfony\Component\Translation\DependencyInjection\TranslatorPass::__construct()" will change in 4.0 to "translation.reader". - * - * A test that verifies the deprecated "translation.loader" gets the LoaderInterfaces added. - * - * This test should be removed in 4.0. - */ - public function testValidCollectorWithDeprecatedTranslationLoader() - { - $loader = (new Definition()) - ->addTag('translation.loader', ['alias' => 'xliff', 'legacy-alias' => 'xlf']); - - $legacyReader = new Definition(); - $reader = new Definition(); - - $translator = (new Definition()) - ->setArguments([null, null, null, null]); - - $container = new ContainerBuilder(); - $container->setDefinition('translator.default', $translator); - $container->setDefinition('translation.loader', $legacyReader); - $container->setDefinition('translation.reader', $reader); - $container->setDefinition('translation.xliff_loader', $loader); - - $pass = new TranslatorPass(); - $pass->process($container); - - $expectedReader = (new Definition()) - ->addMethodCall('addLoader', ['xliff', new Reference('translation.xliff_loader')]) - ->addMethodCall('addLoader', ['xlf', new Reference('translation.xliff_loader')]) - ; - $this->assertEquals($expectedReader, $legacyReader); - $this->assertEquals($expectedReader, $reader); - - $expectedLoader = (new Definition()) - ->addTag('translation.loader', ['alias' => 'xliff', 'legacy-alias' => 'xlf']) - ; - $this->assertEquals($expectedLoader, $loader); - - $this->assertSame(['translation.xliff_loader' => ['xliff', 'xlf']], $translator->getArgument(3)); - - $expected = ['translation.xliff_loader' => new ServiceClosureArgument(new Reference('translation.xliff_loader'))]; - $this->assertEquals($expected, $container->getDefinition((string) $translator->getArgument(0))->getArgument(0)); - } -} diff --git a/vendor/symfony/translation/Tests/Dumper/CsvFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/CsvFileDumperTest.php deleted file mode 100644 index 0d1cf2c..0000000 --- a/vendor/symfony/translation/Tests/Dumper/CsvFileDumperTest.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\Dumper; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\Dumper\CsvFileDumper; -use Symfony\Component\Translation\MessageCatalogue; - -class CsvFileDumperTest extends TestCase -{ - public function testFormatCatalogue() - { - $catalogue = new MessageCatalogue('en'); - $catalogue->add(['foo' => 'bar', 'bar' => 'foo -foo', 'foo;foo' => 'bar']); - - $dumper = new CsvFileDumper(); - - $this->assertStringEqualsFile(__DIR__.'/../fixtures/valid.csv', $dumper->formatCatalogue($catalogue, 'messages')); - } -} diff --git a/vendor/symfony/translation/Tests/Dumper/FileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/FileDumperTest.php deleted file mode 100644 index df20146..0000000 --- a/vendor/symfony/translation/Tests/Dumper/FileDumperTest.php +++ /dev/null @@ -1,89 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\Dumper; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\Dumper\FileDumper; -use Symfony\Component\Translation\MessageCatalogue; - -class FileDumperTest extends TestCase -{ - public function testDump() - { - $tempDir = sys_get_temp_dir(); - - $catalogue = new MessageCatalogue('en'); - $catalogue->add(['foo' => 'bar']); - - $dumper = new ConcreteFileDumper(); - $dumper->dump($catalogue, ['path' => $tempDir]); - - $this->assertFileExists($tempDir.'/messages.en.concrete'); - - @unlink($tempDir.'/messages.en.concrete'); - } - - /** - * @group legacy - */ - public function testDumpBackupsFileIfExisting() - { - $tempDir = sys_get_temp_dir(); - $file = $tempDir.'/messages.en.concrete'; - $backupFile = $file.'~'; - - @touch($file); - - $catalogue = new MessageCatalogue('en'); - $catalogue->add(['foo' => 'bar']); - - $dumper = new ConcreteFileDumper(); - $dumper->dump($catalogue, ['path' => $tempDir]); - - $this->assertFileExists($backupFile); - - @unlink($file); - @unlink($backupFile); - } - - public function testDumpCreatesNestedDirectoriesAndFile() - { - $tempDir = sys_get_temp_dir(); - $translationsDir = $tempDir.'/test/translations'; - $file = $translationsDir.'/messages.en.concrete'; - - $catalogue = new MessageCatalogue('en'); - $catalogue->add(['foo' => 'bar']); - - $dumper = new ConcreteFileDumper(); - $dumper->setRelativePathTemplate('test/translations/%domain%.%locale%.%extension%'); - $dumper->dump($catalogue, ['path' => $tempDir]); - - $this->assertFileExists($file); - - @unlink($file); - @rmdir($translationsDir); - } -} - -class ConcreteFileDumper extends FileDumper -{ - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) - { - return ''; - } - - protected function getExtension() - { - return 'concrete'; - } -} diff --git a/vendor/symfony/translation/Tests/Dumper/IcuResFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/IcuResFileDumperTest.php deleted file mode 100644 index dcb9c2c..0000000 --- a/vendor/symfony/translation/Tests/Dumper/IcuResFileDumperTest.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\Dumper; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\Dumper\IcuResFileDumper; -use Symfony\Component\Translation\MessageCatalogue; - -class IcuResFileDumperTest extends TestCase -{ - public function testFormatCatalogue() - { - $catalogue = new MessageCatalogue('en'); - $catalogue->add(['foo' => 'bar']); - - $dumper = new IcuResFileDumper(); - - $this->assertStringEqualsFile(__DIR__.'/../fixtures/resourcebundle/res/en.res', $dumper->formatCatalogue($catalogue, 'messages')); - } -} diff --git a/vendor/symfony/translation/Tests/Dumper/IniFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/IniFileDumperTest.php deleted file mode 100644 index 1ed168b..0000000 --- a/vendor/symfony/translation/Tests/Dumper/IniFileDumperTest.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\Dumper; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\Dumper\IniFileDumper; -use Symfony\Component\Translation\MessageCatalogue; - -class IniFileDumperTest extends TestCase -{ - public function testFormatCatalogue() - { - $catalogue = new MessageCatalogue('en'); - $catalogue->add(['foo' => 'bar']); - - $dumper = new IniFileDumper(); - - $this->assertStringEqualsFile(__DIR__.'/../fixtures/resources.ini', $dumper->formatCatalogue($catalogue, 'messages')); - } -} diff --git a/vendor/symfony/translation/Tests/Dumper/JsonFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/JsonFileDumperTest.php deleted file mode 100644 index 04e3d86..0000000 --- a/vendor/symfony/translation/Tests/Dumper/JsonFileDumperTest.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\Dumper; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\Dumper\JsonFileDumper; -use Symfony\Component\Translation\MessageCatalogue; - -class JsonFileDumperTest extends TestCase -{ - public function testFormatCatalogue() - { - $catalogue = new MessageCatalogue('en'); - $catalogue->add(['foo' => 'bar']); - - $dumper = new JsonFileDumper(); - - $this->assertStringEqualsFile(__DIR__.'/../fixtures/resources.json', $dumper->formatCatalogue($catalogue, 'messages')); - } - - public function testDumpWithCustomEncoding() - { - $catalogue = new MessageCatalogue('en'); - $catalogue->add(['foo' => '"bar"']); - - $dumper = new JsonFileDumper(); - - $this->assertStringEqualsFile(__DIR__.'/../fixtures/resources.dump.json', $dumper->formatCatalogue($catalogue, 'messages', ['json_encoding' => JSON_HEX_QUOT])); - } -} diff --git a/vendor/symfony/translation/Tests/Dumper/MoFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/MoFileDumperTest.php deleted file mode 100644 index fbbd75d..0000000 --- a/vendor/symfony/translation/Tests/Dumper/MoFileDumperTest.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\Dumper; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\Dumper\MoFileDumper; -use Symfony\Component\Translation\MessageCatalogue; - -class MoFileDumperTest extends TestCase -{ - public function testFormatCatalogue() - { - $catalogue = new MessageCatalogue('en'); - $catalogue->add(['foo' => 'bar']); - - $dumper = new MoFileDumper(); - - $this->assertStringEqualsFile(__DIR__.'/../fixtures/resources.mo', $dumper->formatCatalogue($catalogue, 'messages')); - } -} diff --git a/vendor/symfony/translation/Tests/Dumper/PhpFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/PhpFileDumperTest.php deleted file mode 100644 index 00e535d..0000000 --- a/vendor/symfony/translation/Tests/Dumper/PhpFileDumperTest.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\Dumper; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\Dumper\PhpFileDumper; -use Symfony\Component\Translation\MessageCatalogue; - -class PhpFileDumperTest extends TestCase -{ - public function testFormatCatalogue() - { - $catalogue = new MessageCatalogue('en'); - $catalogue->add(['foo' => 'bar']); - - $dumper = new PhpFileDumper(); - - $this->assertStringEqualsFile(__DIR__.'/../fixtures/resources.php', $dumper->formatCatalogue($catalogue, 'messages')); - } -} diff --git a/vendor/symfony/translation/Tests/Dumper/PoFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/PoFileDumperTest.php deleted file mode 100644 index 960ec2d..0000000 --- a/vendor/symfony/translation/Tests/Dumper/PoFileDumperTest.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\Dumper; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\Dumper\PoFileDumper; -use Symfony\Component\Translation\MessageCatalogue; - -class PoFileDumperTest extends TestCase -{ - public function testFormatCatalogue() - { - $catalogue = new MessageCatalogue('en'); - $catalogue->add(['foo' => 'bar', 'bar' => 'foo']); - - $dumper = new PoFileDumper(); - - $this->assertStringEqualsFile(__DIR__.'/../fixtures/resources.po', $dumper->formatCatalogue($catalogue, 'messages')); - } -} diff --git a/vendor/symfony/translation/Tests/Dumper/QtFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/QtFileDumperTest.php deleted file mode 100644 index edfad60..0000000 --- a/vendor/symfony/translation/Tests/Dumper/QtFileDumperTest.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\Dumper; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\Dumper\QtFileDumper; -use Symfony\Component\Translation\MessageCatalogue; - -class QtFileDumperTest extends TestCase -{ - public function testFormatCatalogue() - { - $catalogue = new MessageCatalogue('en'); - $catalogue->add(['foo' => 'bar'], 'resources'); - - $dumper = new QtFileDumper(); - - $this->assertStringEqualsFile(__DIR__.'/../fixtures/resources.ts', $dumper->formatCatalogue($catalogue, 'resources')); - } -} diff --git a/vendor/symfony/translation/Tests/Dumper/XliffFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/XliffFileDumperTest.php deleted file mode 100644 index c634a27..0000000 --- a/vendor/symfony/translation/Tests/Dumper/XliffFileDumperTest.php +++ /dev/null @@ -1,115 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\Dumper; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\Dumper\XliffFileDumper; -use Symfony\Component\Translation\MessageCatalogue; - -class XliffFileDumperTest extends TestCase -{ - public function testFormatCatalogue() - { - $catalogue = new MessageCatalogue('en_US'); - $catalogue->add([ - 'foo' => 'bar', - 'key' => '', - 'key.with.cdata' => '<source> & <target>', - ]); - $catalogue->setMetadata('foo', ['notes' => [['priority' => 1, 'from' => 'bar', 'content' => 'baz']]]); - $catalogue->setMetadata('key', ['notes' => [['content' => 'baz'], ['content' => 'qux']]]); - - $dumper = new XliffFileDumper(); - - $this->assertStringEqualsFile( - __DIR__.'/../fixtures/resources-clean.xlf', - $dumper->formatCatalogue($catalogue, 'messages', ['default_locale' => 'fr_FR']) - ); - } - - public function testFormatCatalogueXliff2() - { - $catalogue = new MessageCatalogue('en_US'); - $catalogue->add([ - 'foo' => 'bar', - 'key' => '', - 'key.with.cdata' => '<source> & <target>', - ]); - $catalogue->setMetadata('key', ['target-attributes' => ['order' => 1]]); - - $dumper = new XliffFileDumper(); - - $this->assertStringEqualsFile( - __DIR__.'/../fixtures/resources-2.0-clean.xlf', - $dumper->formatCatalogue($catalogue, 'messages', ['default_locale' => 'fr_FR', 'xliff_version' => '2.0']) - ); - } - - public function testFormatCatalogueWithCustomToolInfo() - { - $options = [ - 'default_locale' => 'en_US', - 'tool_info' => ['tool-id' => 'foo', 'tool-name' => 'foo', 'tool-version' => '0.0', 'tool-company' => 'Foo'], - ]; - - $catalogue = new MessageCatalogue('en_US'); - $catalogue->add(['foo' => 'bar']); - - $dumper = new XliffFileDumper(); - - $this->assertStringEqualsFile( - __DIR__.'/../fixtures/resources-tool-info.xlf', - $dumper->formatCatalogue($catalogue, 'messages', $options) - ); - } - - public function testFormatCatalogueWithTargetAttributesMetadata() - { - $catalogue = new MessageCatalogue('en_US'); - $catalogue->add([ - 'foo' => 'bar', - ]); - $catalogue->setMetadata('foo', ['target-attributes' => ['state' => 'needs-translation']]); - - $dumper = new XliffFileDumper(); - - $this->assertStringEqualsFile( - __DIR__.'/../fixtures/resources-target-attributes.xlf', - $dumper->formatCatalogue($catalogue, 'messages', ['default_locale' => 'fr_FR']) - ); - } - - public function testFormatCatalogueWithNotesMetadata() - { - $catalogue = new MessageCatalogue('en_US'); - $catalogue->add([ - 'foo' => 'bar', - 'baz' => 'biz', - ]); - $catalogue->setMetadata('foo', ['notes' => [ - ['category' => 'state', 'content' => 'new'], - ['category' => 'approved', 'content' => 'true'], - ['category' => 'section', 'content' => 'user login', 'priority' => '1'], - ]]); - $catalogue->setMetadata('baz', ['notes' => [ - ['id' => 'x', 'content' => 'x_content'], - ['appliesTo' => 'target', 'category' => 'quality', 'content' => 'Fuzzy'], - ]]); - - $dumper = new XliffFileDumper(); - - $this->assertStringEqualsFile( - __DIR__.'/../fixtures/resources-notes-meta.xlf', - $dumper->formatCatalogue($catalogue, 'messages', ['default_locale' => 'fr_FR', 'xliff_version' => '2.0']) - ); - } -} diff --git a/vendor/symfony/translation/Tests/Dumper/YamlFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/YamlFileDumperTest.php deleted file mode 100644 index e46da5a..0000000 --- a/vendor/symfony/translation/Tests/Dumper/YamlFileDumperTest.php +++ /dev/null @@ -1,45 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\Dumper; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\Dumper\YamlFileDumper; -use Symfony\Component\Translation\MessageCatalogue; - -class YamlFileDumperTest extends TestCase -{ - public function testTreeFormatCatalogue() - { - $catalogue = new MessageCatalogue('en'); - $catalogue->add([ - 'foo.bar1' => 'value1', - 'foo.bar2' => 'value2', - ]); - - $dumper = new YamlFileDumper(); - - $this->assertStringEqualsFile(__DIR__.'/../fixtures/messages.yml', $dumper->formatCatalogue($catalogue, 'messages', ['as_tree' => true, 'inline' => 999])); - } - - public function testLinearFormatCatalogue() - { - $catalogue = new MessageCatalogue('en'); - $catalogue->add([ - 'foo.bar1' => 'value1', - 'foo.bar2' => 'value2', - ]); - - $dumper = new YamlFileDumper(); - - $this->assertStringEqualsFile(__DIR__.'/../fixtures/messages_linear.yml', $dumper->formatCatalogue($catalogue, 'messages')); - } -} diff --git a/vendor/symfony/translation/Tests/Extractor/PhpExtractorTest.php b/vendor/symfony/translation/Tests/Extractor/PhpExtractorTest.php deleted file mode 100644 index 7cde108..0000000 --- a/vendor/symfony/translation/Tests/Extractor/PhpExtractorTest.php +++ /dev/null @@ -1,97 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\Extractor; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\Extractor\PhpExtractor; -use Symfony\Component\Translation\MessageCatalogue; - -class PhpExtractorTest extends TestCase -{ - /** - * @dataProvider resourcesProvider - * - * @param array|string $resource - */ - public function testExtraction($resource) - { - // Arrange - $extractor = new PhpExtractor(); - $extractor->setPrefix('prefix'); - $catalogue = new MessageCatalogue('en'); - - // Act - $extractor->extract($resource, $catalogue); - - $expectedHeredoc = <<<EOF -heredoc key with whitespace and escaped \$\n sequences -EOF; - $expectedNowdoc = <<<'EOF' -nowdoc key with whitespace and nonescaped \$\n sequences -EOF; - // Assert - $expectedCatalogue = [ - 'messages' => [ - 'single-quoted key' => 'prefixsingle-quoted key', - 'double-quoted key' => 'prefixdouble-quoted key', - 'heredoc key' => 'prefixheredoc key', - 'nowdoc key' => 'prefixnowdoc key', - "double-quoted key with whitespace and escaped \$\n\" sequences" => "prefixdouble-quoted key with whitespace and escaped \$\n\" sequences", - 'single-quoted key with whitespace and nonescaped \$\n\' sequences' => 'prefixsingle-quoted key with whitespace and nonescaped \$\n\' sequences', - 'single-quoted key with "quote mark at the end"' => 'prefixsingle-quoted key with "quote mark at the end"', - $expectedHeredoc => 'prefix'.$expectedHeredoc, - $expectedNowdoc => 'prefix'.$expectedNowdoc, - '{0} There is no apples|{1} There is one apple|]1,Inf[ There are %count% apples' => 'prefix{0} There is no apples|{1} There is one apple|]1,Inf[ There are %count% apples', - 'concatenated message with heredoc and nowdoc' => 'prefixconcatenated message with heredoc and nowdoc', - 'default domain' => 'prefixdefault domain', - ], - 'not_messages' => [ - 'other-domain-test-no-params-short-array' => 'prefixother-domain-test-no-params-short-array', - 'other-domain-test-no-params-long-array' => 'prefixother-domain-test-no-params-long-array', - 'other-domain-test-params-short-array' => 'prefixother-domain-test-params-short-array', - 'other-domain-test-params-long-array' => 'prefixother-domain-test-params-long-array', - 'other-domain-test-trans-choice-short-array-%count%' => 'prefixother-domain-test-trans-choice-short-array-%count%', - 'other-domain-test-trans-choice-long-array-%count%' => 'prefixother-domain-test-trans-choice-long-array-%count%', - 'typecast' => 'prefixtypecast', - 'msg1' => 'prefixmsg1', - 'msg2' => 'prefixmsg2', - ], - ]; - $actualCatalogue = $catalogue->all(); - - $this->assertEquals($expectedCatalogue, $actualCatalogue); - } - - public function resourcesProvider() - { - $directory = __DIR__.'/../fixtures/extractor/'; - $splFiles = []; - foreach (new \DirectoryIterator($directory) as $fileInfo) { - if ($fileInfo->isDot()) { - continue; - } - if ('translation.html.php' === $fileInfo->getBasename()) { - $phpFile = $fileInfo->getPathname(); - } - $splFiles[] = $fileInfo->getFileInfo(); - } - - return [ - [$directory], - [$phpFile], - [glob($directory.'*')], - [$splFiles], - [new \ArrayObject(glob($directory.'*'))], - [new \ArrayObject($splFiles)], - ]; - } -} diff --git a/vendor/symfony/translation/Tests/Formatter/MessageFormatterTest.php b/vendor/symfony/translation/Tests/Formatter/MessageFormatterTest.php deleted file mode 100644 index 17b815d..0000000 --- a/vendor/symfony/translation/Tests/Formatter/MessageFormatterTest.php +++ /dev/null @@ -1,82 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\Formatter; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\Formatter\MessageFormatter; - -class MessageFormatterTest extends TestCase -{ - /** - * @dataProvider getTransMessages - */ - public function testFormat($expected, $message, $parameters = []) - { - $this->assertEquals($expected, $this->getMessageFormatter()->format($message, 'en', $parameters)); - } - - /** - * @dataProvider getTransChoiceMessages - */ - public function testFormatPlural($expected, $message, $number, $parameters) - { - $this->assertEquals($expected, $this->getMessageFormatter()->choiceFormat($message, $number, 'fr', $parameters)); - } - - public function getTransMessages() - { - return [ - [ - 'There is one apple', - 'There is one apple', - ], - [ - 'There are 5 apples', - 'There are %count% apples', - ['%count%' => 5], - ], - [ - 'There are 5 apples', - 'There are {{count}} apples', - ['{{count}}' => 5], - ], - ]; - } - - public function getTransChoiceMessages() - { - return [ - ['Il y a 0 pomme', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 0, ['%count%' => 0]], - ['Il y a 1 pomme', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 1, ['%count%' => 1]], - ['Il y a 10 pommes', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 10, ['%count%' => 10]], - - ['Il y a 0 pomme', 'Il y a %count% pomme|Il y a %count% pommes', 0, ['%count%' => 0]], - ['Il y a 1 pomme', 'Il y a %count% pomme|Il y a %count% pommes', 1, ['%count%' => 1]], - ['Il y a 10 pommes', 'Il y a %count% pomme|Il y a %count% pommes', 10, ['%count%' => 10]], - - ['Il y a 0 pomme', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 0, ['%count%' => 0]], - ['Il y a 1 pomme', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 1, ['%count%' => 1]], - ['Il y a 10 pommes', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 10, ['%count%' => 10]], - - ['Il n\'y a aucune pomme', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 0, ['%count%' => 0]], - ['Il y a 1 pomme', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 1, ['%count%' => 1]], - ['Il y a 10 pommes', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 10, ['%count%' => 10]], - - ['Il y a 0 pomme', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 0, ['%count%' => 0]], - ]; - } - - private function getMessageFormatter() - { - return new MessageFormatter(); - } -} diff --git a/vendor/symfony/translation/Tests/IdentityTranslatorTest.php b/vendor/symfony/translation/Tests/IdentityTranslatorTest.php deleted file mode 100644 index a5c63df..0000000 --- a/vendor/symfony/translation/Tests/IdentityTranslatorTest.php +++ /dev/null @@ -1,112 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Intl\Util\IntlTestHelper; -use Symfony\Component\Translation\IdentityTranslator; - -class IdentityTranslatorTest extends TestCase -{ - private $defaultLocale; - - protected function setUp() - { - parent::setUp(); - - $this->defaultLocale = \Locale::getDefault(); - } - - protected function tearDown() - { - parent::tearDown(); - - \Locale::setDefault($this->defaultLocale); - } - - /** - * @dataProvider getTransTests - */ - public function testTrans($expected, $id, $parameters) - { - $translator = new IdentityTranslator(); - - $this->assertEquals($expected, $translator->trans($id, $parameters)); - } - - /** - * @dataProvider getTransChoiceTests - */ - public function testTransChoiceWithExplicitLocale($expected, $id, $number, $parameters) - { - $translator = new IdentityTranslator(); - $translator->setLocale('en'); - - $this->assertEquals($expected, $translator->transChoice($id, $number, $parameters)); - } - - /** - * @dataProvider getTransChoiceTests - */ - public function testTransChoiceWithDefaultLocale($expected, $id, $number, $parameters) - { - \Locale::setDefault('en'); - - $translator = new IdentityTranslator(); - - $this->assertEquals($expected, $translator->transChoice($id, $number, $parameters)); - } - - public function testGetSetLocale() - { - $translator = new IdentityTranslator(); - $translator->setLocale('en'); - - $this->assertEquals('en', $translator->getLocale()); - } - - public function testGetLocaleReturnsDefaultLocaleIfNotSet() - { - // in order to test with "pt_BR" - IntlTestHelper::requireFullIntl($this, false); - - $translator = new IdentityTranslator(); - - \Locale::setDefault('en'); - $this->assertEquals('en', $translator->getLocale()); - - \Locale::setDefault('pt_BR'); - $this->assertEquals('pt_BR', $translator->getLocale()); - } - - public function getTransTests() - { - return [ - ['Symfony is great!', 'Symfony is great!', []], - ['Symfony is awesome!', 'Symfony is %what%!', ['%what%' => 'awesome']], - ]; - } - - public function getTransChoiceTests() - { - return [ - ['There are no apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0, ['%count%' => 0]], - ['There is one apple', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 1, ['%count%' => 1]], - ['There are 10 apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 10, ['%count%' => 10]], - ['There are 0 apples', 'There is 1 apple|There are %count% apples', 0, ['%count%' => 0]], - ['There is 1 apple', 'There is 1 apple|There are %count% apples', 1, ['%count%' => 1]], - ['There are 10 apples', 'There is 1 apple|There are %count% apples', 10, ['%count%' => 10]], - // custom validation messages may be coded with a fixed value - ['There are 2 apples', 'There are 2 apples', 2, ['%count%' => 2]], - ]; - } -} diff --git a/vendor/symfony/translation/Tests/IntervalTest.php b/vendor/symfony/translation/Tests/IntervalTest.php deleted file mode 100644 index e49a30b..0000000 --- a/vendor/symfony/translation/Tests/IntervalTest.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\Interval; - -class IntervalTest extends TestCase -{ - /** - * @dataProvider getTests - */ - public function testTest($expected, $number, $interval) - { - $this->assertEquals($expected, Interval::test($number, $interval)); - } - - public function testTestException() - { - $this->expectException('Symfony\Component\Translation\Exception\InvalidArgumentException'); - Interval::test(1, 'foobar'); - } - - public function getTests() - { - return [ - [true, 3, '{1,2, 3 ,4}'], - [false, 10, '{1,2, 3 ,4}'], - [false, 3, '[1,2]'], - [true, 1, '[1,2]'], - [true, 2, '[1,2]'], - [false, 1, ']1,2['], - [false, 2, ']1,2['], - [true, log(0), '[-Inf,2['], - [true, -log(0), '[-2,+Inf]'], - ]; - } -} diff --git a/vendor/symfony/translation/Tests/Loader/CsvFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/CsvFileLoaderTest.php deleted file mode 100644 index 9537e1f..0000000 --- a/vendor/symfony/translation/Tests/Loader/CsvFileLoaderTest.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\Loader; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Translation\Loader\CsvFileLoader; - -class CsvFileLoaderTest extends TestCase -{ - public function testLoad() - { - $loader = new CsvFileLoader(); - $resource = __DIR__.'/../fixtures/resources.csv'; - $catalogue = $loader->load($resource, 'en', 'domain1'); - - $this->assertEquals(['foo' => 'bar'], $catalogue->all('domain1')); - $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); - } - - public function testLoadDoesNothingIfEmpty() - { - $loader = new CsvFileLoader(); - $resource = __DIR__.'/../fixtures/empty.csv'; - $catalogue = $loader->load($resource, 'en', 'domain1'); - - $this->assertEquals([], $catalogue->all('domain1')); - $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); - } - - public function testLoadNonExistingResource() - { - $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException'); - $loader = new CsvFileLoader(); - $resource = __DIR__.'/../fixtures/not-exists.csv'; - $loader->load($resource, 'en', 'domain1'); - } - - public function testLoadNonLocalResource() - { - $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException'); - $loader = new CsvFileLoader(); - $resource = 'http://example.com/resources.csv'; - $loader->load($resource, 'en', 'domain1'); - } -} diff --git a/vendor/symfony/translation/Tests/Loader/IcuDatFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/IcuDatFileLoaderTest.php deleted file mode 100644 index 77db041..0000000 --- a/vendor/symfony/translation/Tests/Loader/IcuDatFileLoaderTest.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\Loader; - -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Translation\Loader\IcuDatFileLoader; - -/** - * @requires extension intl - */ -class IcuDatFileLoaderTest extends LocalizedTestCase -{ - public function testLoadInvalidResource() - { - $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException'); - $loader = new IcuDatFileLoader(); - $loader->load(__DIR__.'/../fixtures/resourcebundle/corrupted/resources', 'es', 'domain2'); - } - - public function testDatEnglishLoad() - { - // bundled resource is build using pkgdata command which at least in ICU 4.2 comes in extremely! buggy form - // you must specify an temporary build directory which is not the same as current directory and - // MUST reside on the same partition. pkgdata -p resources -T /srv -d.packagelist.txt - $loader = new IcuDatFileLoader(); - $resource = __DIR__.'/../fixtures/resourcebundle/dat/resources'; - $catalogue = $loader->load($resource, 'en', 'domain1'); - - $this->assertEquals(['symfony' => 'Symfony 2 is great'], $catalogue->all('domain1')); - $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals([new FileResource($resource.'.dat')], $catalogue->getResources()); - } - - public function testDatFrenchLoad() - { - $loader = new IcuDatFileLoader(); - $resource = __DIR__.'/../fixtures/resourcebundle/dat/resources'; - $catalogue = $loader->load($resource, 'fr', 'domain1'); - - $this->assertEquals(['symfony' => 'Symfony 2 est génial'], $catalogue->all('domain1')); - $this->assertEquals('fr', $catalogue->getLocale()); - $this->assertEquals([new FileResource($resource.'.dat')], $catalogue->getResources()); - } - - public function testLoadNonExistingResource() - { - $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException'); - $loader = new IcuDatFileLoader(); - $loader->load(__DIR__.'/../fixtures/non-existing.txt', 'en', 'domain1'); - } -} diff --git a/vendor/symfony/translation/Tests/Loader/IcuResFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/IcuResFileLoaderTest.php deleted file mode 100644 index 99b2f90..0000000 --- a/vendor/symfony/translation/Tests/Loader/IcuResFileLoaderTest.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\Loader; - -use Symfony\Component\Config\Resource\DirectoryResource; -use Symfony\Component\Translation\Loader\IcuResFileLoader; - -/** - * @requires extension intl - */ -class IcuResFileLoaderTest extends LocalizedTestCase -{ - public function testLoad() - { - // resource is build using genrb command - $loader = new IcuResFileLoader(); - $resource = __DIR__.'/../fixtures/resourcebundle/res'; - $catalogue = $loader->load($resource, 'en', 'domain1'); - - $this->assertEquals(['foo' => 'bar'], $catalogue->all('domain1')); - $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals([new DirectoryResource($resource)], $catalogue->getResources()); - } - - public function testLoadNonExistingResource() - { - $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException'); - $loader = new IcuResFileLoader(); - $loader->load(__DIR__.'/../fixtures/non-existing.txt', 'en', 'domain1'); - } - - public function testLoadInvalidResource() - { - $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException'); - $loader = new IcuResFileLoader(); - $loader->load(__DIR__.'/../fixtures/resourcebundle/corrupted', 'en', 'domain1'); - } -} diff --git a/vendor/symfony/translation/Tests/Loader/IniFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/IniFileLoaderTest.php deleted file mode 100644 index fd66e20..0000000 --- a/vendor/symfony/translation/Tests/Loader/IniFileLoaderTest.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\Loader; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Translation\Loader\IniFileLoader; - -class IniFileLoaderTest extends TestCase -{ - public function testLoad() - { - $loader = new IniFileLoader(); - $resource = __DIR__.'/../fixtures/resources.ini'; - $catalogue = $loader->load($resource, 'en', 'domain1'); - - $this->assertEquals(['foo' => 'bar'], $catalogue->all('domain1')); - $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); - } - - public function testLoadDoesNothingIfEmpty() - { - $loader = new IniFileLoader(); - $resource = __DIR__.'/../fixtures/empty.ini'; - $catalogue = $loader->load($resource, 'en', 'domain1'); - - $this->assertEquals([], $catalogue->all('domain1')); - $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); - } - - public function testLoadNonExistingResource() - { - $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException'); - $loader = new IniFileLoader(); - $resource = __DIR__.'/../fixtures/non-existing.ini'; - $loader->load($resource, 'en', 'domain1'); - } -} diff --git a/vendor/symfony/translation/Tests/Loader/JsonFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/JsonFileLoaderTest.php deleted file mode 100644 index d264bb1..0000000 --- a/vendor/symfony/translation/Tests/Loader/JsonFileLoaderTest.php +++ /dev/null @@ -1,58 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\Loader; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Translation\Loader\JsonFileLoader; - -class JsonFileLoaderTest extends TestCase -{ - public function testLoad() - { - $loader = new JsonFileLoader(); - $resource = __DIR__.'/../fixtures/resources.json'; - $catalogue = $loader->load($resource, 'en', 'domain1'); - - $this->assertEquals(['foo' => 'bar'], $catalogue->all('domain1')); - $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); - } - - public function testLoadDoesNothingIfEmpty() - { - $loader = new JsonFileLoader(); - $resource = __DIR__.'/../fixtures/empty.json'; - $catalogue = $loader->load($resource, 'en', 'domain1'); - - $this->assertEquals([], $catalogue->all('domain1')); - $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); - } - - public function testLoadNonExistingResource() - { - $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException'); - $loader = new JsonFileLoader(); - $resource = __DIR__.'/../fixtures/non-existing.json'; - $loader->load($resource, 'en', 'domain1'); - } - - public function testParseException() - { - $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException'); - $this->expectExceptionMessage('Error parsing JSON - Syntax error, malformed JSON'); - $loader = new JsonFileLoader(); - $resource = __DIR__.'/../fixtures/malformed.json'; - $loader->load($resource, 'en', 'domain1'); - } -} diff --git a/vendor/symfony/translation/Tests/Loader/LocalizedTestCase.php b/vendor/symfony/translation/Tests/Loader/LocalizedTestCase.php deleted file mode 100644 index 279e9fd..0000000 --- a/vendor/symfony/translation/Tests/Loader/LocalizedTestCase.php +++ /dev/null @@ -1,24 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\Loader; - -use PHPUnit\Framework\TestCase; - -abstract class LocalizedTestCase extends TestCase -{ - protected function setUp() - { - if (!\extension_loaded('intl')) { - $this->markTestSkipped('Extension intl is required.'); - } - } -} diff --git a/vendor/symfony/translation/Tests/Loader/MoFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/MoFileLoaderTest.php deleted file mode 100644 index 3fe3a99..0000000 --- a/vendor/symfony/translation/Tests/Loader/MoFileLoaderTest.php +++ /dev/null @@ -1,71 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\Loader; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Translation\Loader\MoFileLoader; - -class MoFileLoaderTest extends TestCase -{ - public function testLoad() - { - $loader = new MoFileLoader(); - $resource = __DIR__.'/../fixtures/resources.mo'; - $catalogue = $loader->load($resource, 'en', 'domain1'); - - $this->assertEquals(['foo' => 'bar'], $catalogue->all('domain1')); - $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); - } - - public function testLoadPlurals() - { - $loader = new MoFileLoader(); - $resource = __DIR__.'/../fixtures/plurals.mo'; - $catalogue = $loader->load($resource, 'en', 'domain1'); - - $this->assertEquals([ - 'foo|foos' => 'bar|bars', - '{0} no foos|one foo|%count% foos' => '{0} no bars|one bar|%count% bars', - ], $catalogue->all('domain1')); - $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); - } - - public function testLoadNonExistingResource() - { - $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException'); - $loader = new MoFileLoader(); - $resource = __DIR__.'/../fixtures/non-existing.mo'; - $loader->load($resource, 'en', 'domain1'); - } - - public function testLoadInvalidResource() - { - $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException'); - $loader = new MoFileLoader(); - $resource = __DIR__.'/../fixtures/empty.mo'; - $loader->load($resource, 'en', 'domain1'); - } - - public function testLoadEmptyTranslation() - { - $loader = new MoFileLoader(); - $resource = __DIR__.'/../fixtures/empty-translation.mo'; - $catalogue = $loader->load($resource, 'en', 'message'); - - $this->assertEquals([], $catalogue->all('message')); - $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); - } -} diff --git a/vendor/symfony/translation/Tests/Loader/PhpFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/PhpFileLoaderTest.php deleted file mode 100644 index d4da645..0000000 --- a/vendor/symfony/translation/Tests/Loader/PhpFileLoaderTest.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\Loader; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Translation\Loader\PhpFileLoader; - -class PhpFileLoaderTest extends TestCase -{ - public function testLoad() - { - $loader = new PhpFileLoader(); - $resource = __DIR__.'/../fixtures/resources.php'; - $catalogue = $loader->load($resource, 'en', 'domain1'); - - $this->assertEquals(['foo' => 'bar'], $catalogue->all('domain1')); - $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); - } - - public function testLoadNonExistingResource() - { - $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException'); - $loader = new PhpFileLoader(); - $resource = __DIR__.'/../fixtures/non-existing.php'; - $loader->load($resource, 'en', 'domain1'); - } - - public function testLoadThrowsAnExceptionIfFileNotLocal() - { - $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException'); - $loader = new PhpFileLoader(); - $resource = 'http://example.com/resources.php'; - $loader->load($resource, 'en', 'domain1'); - } -} diff --git a/vendor/symfony/translation/Tests/Loader/PoFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/PoFileLoaderTest.php deleted file mode 100644 index 72c4c66..0000000 --- a/vendor/symfony/translation/Tests/Loader/PoFileLoaderTest.php +++ /dev/null @@ -1,120 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\Loader; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Translation\Loader\PoFileLoader; - -class PoFileLoaderTest extends TestCase -{ - public function testLoad() - { - $loader = new PoFileLoader(); - $resource = __DIR__.'/../fixtures/resources.po'; - $catalogue = $loader->load($resource, 'en', 'domain1'); - - $this->assertEquals(['foo' => 'bar', 'bar' => 'foo'], $catalogue->all('domain1')); - $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); - } - - public function testLoadPlurals() - { - $loader = new PoFileLoader(); - $resource = __DIR__.'/../fixtures/plurals.po'; - $catalogue = $loader->load($resource, 'en', 'domain1'); - - $this->assertEquals([ - 'foo|foos' => 'bar|bars', - '{0} no foos|one foo|%count% foos' => '{0} no bars|one bar|%count% bars', - ], $catalogue->all('domain1')); - $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); - } - - public function testLoadDoesNothingIfEmpty() - { - $loader = new PoFileLoader(); - $resource = __DIR__.'/../fixtures/empty.po'; - $catalogue = $loader->load($resource, 'en', 'domain1'); - - $this->assertEquals([], $catalogue->all('domain1')); - $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); - } - - public function testLoadNonExistingResource() - { - $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException'); - $loader = new PoFileLoader(); - $resource = __DIR__.'/../fixtures/non-existing.po'; - $loader->load($resource, 'en', 'domain1'); - } - - public function testLoadEmptyTranslation() - { - $loader = new PoFileLoader(); - $resource = __DIR__.'/../fixtures/empty-translation.po'; - $catalogue = $loader->load($resource, 'en', 'domain1'); - - $this->assertEquals(['foo' => ''], $catalogue->all('domain1')); - $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); - } - - public function testEscapedId() - { - $loader = new PoFileLoader(); - $resource = __DIR__.'/../fixtures/escaped-id.po'; - $catalogue = $loader->load($resource, 'en', 'domain1'); - - $messages = $catalogue->all('domain1'); - $this->assertArrayHasKey('escaped "foo"', $messages); - $this->assertEquals('escaped "bar"', $messages['escaped "foo"']); - } - - public function testEscapedIdPlurals() - { - $loader = new PoFileLoader(); - $resource = __DIR__.'/../fixtures/escaped-id-plurals.po'; - $catalogue = $loader->load($resource, 'en', 'domain1'); - - $messages = $catalogue->all('domain1'); - $this->assertArrayHasKey('escaped "foo"|escaped "foos"', $messages); - $this->assertEquals('escaped "bar"|escaped "bars"', $messages['escaped "foo"|escaped "foos"']); - } - - public function testSkipFuzzyTranslations() - { - $loader = new PoFileLoader(); - $resource = __DIR__.'/../fixtures/fuzzy-translations.po'; - $catalogue = $loader->load($resource, 'en', 'domain1'); - - $messages = $catalogue->all('domain1'); - $this->assertArrayHasKey('foo1', $messages); - $this->assertArrayNotHasKey('foo2', $messages); - $this->assertArrayHasKey('foo3', $messages); - } - - public function testMissingPlurals() - { - $loader = new PoFileLoader(); - $resource = __DIR__.'/../fixtures/missing-plurals.po'; - $catalogue = $loader->load($resource, 'en', 'domain1'); - - $this->assertEquals([ - 'foo|foos' => '-|bar|-|bars', - ], $catalogue->all('domain1')); - $this->assertEquals('en', $catalogue->getLocale()); - } -} diff --git a/vendor/symfony/translation/Tests/Loader/QtFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/QtFileLoaderTest.php deleted file mode 100644 index 47462d6..0000000 --- a/vendor/symfony/translation/Tests/Loader/QtFileLoaderTest.php +++ /dev/null @@ -1,65 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\Loader; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Translation\Loader\QtFileLoader; - -class QtFileLoaderTest extends TestCase -{ - public function testLoad() - { - $loader = new QtFileLoader(); - $resource = __DIR__.'/../fixtures/resources.ts'; - $catalogue = $loader->load($resource, 'en', 'resources'); - - $this->assertEquals(['foo' => 'bar'], $catalogue->all('resources')); - $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); - } - - public function testLoadNonExistingResource() - { - $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException'); - $loader = new QtFileLoader(); - $resource = __DIR__.'/../fixtures/non-existing.ts'; - $loader->load($resource, 'en', 'domain1'); - } - - public function testLoadNonLocalResource() - { - $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException'); - $loader = new QtFileLoader(); - $resource = 'http://domain1.com/resources.ts'; - $loader->load($resource, 'en', 'domain1'); - } - - public function testLoadInvalidResource() - { - $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException'); - $loader = new QtFileLoader(); - $resource = __DIR__.'/../fixtures/invalid-xml-resources.xlf'; - $loader->load($resource, 'en', 'domain1'); - } - - public function testLoadEmptyResource() - { - $loader = new QtFileLoader(); - $resource = __DIR__.'/../fixtures/empty.xlf'; - - $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException'); - $this->expectExceptionMessage(sprintf('Unable to load "%s".', $resource)); - - $loader->load($resource, 'en', 'domain1'); - } -} diff --git a/vendor/symfony/translation/Tests/Loader/XliffFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/XliffFileLoaderTest.php deleted file mode 100644 index 3dcff7b..0000000 --- a/vendor/symfony/translation/Tests/Loader/XliffFileLoaderTest.php +++ /dev/null @@ -1,246 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\Loader; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Translation\Loader\XliffFileLoader; - -class XliffFileLoaderTest extends TestCase -{ - public function testLoad() - { - $loader = new XliffFileLoader(); - $resource = __DIR__.'/../fixtures/resources.xlf'; - $catalogue = $loader->load($resource, 'en', 'domain1'); - - $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); - $this->assertSame([], libxml_get_errors()); - $this->assertContainsOnly('string', $catalogue->all('domain1')); - } - - public function testLoadWithInternalErrorsEnabled() - { - $internalErrors = libxml_use_internal_errors(true); - - $this->assertSame([], libxml_get_errors()); - - $loader = new XliffFileLoader(); - $resource = __DIR__.'/../fixtures/resources.xlf'; - $catalogue = $loader->load($resource, 'en', 'domain1'); - - $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); - $this->assertSame([], libxml_get_errors()); - - libxml_clear_errors(); - libxml_use_internal_errors($internalErrors); - } - - public function testLoadWithExternalEntitiesDisabled() - { - $disableEntities = libxml_disable_entity_loader(true); - - $loader = new XliffFileLoader(); - $resource = __DIR__.'/../fixtures/resources.xlf'; - $catalogue = $loader->load($resource, 'en', 'domain1'); - - libxml_disable_entity_loader($disableEntities); - - $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); - } - - public function testLoadWithResname() - { - $loader = new XliffFileLoader(); - $catalogue = $loader->load(__DIR__.'/../fixtures/resname.xlf', 'en', 'domain1'); - - $this->assertEquals(['foo' => 'bar', 'bar' => 'baz', 'baz' => 'foo', 'qux' => 'qux source'], $catalogue->all('domain1')); - } - - public function testIncompleteResource() - { - $loader = new XliffFileLoader(); - $catalogue = $loader->load(__DIR__.'/../fixtures/resources.xlf', 'en', 'domain1'); - - $this->assertEquals(['foo' => 'bar', 'extra' => 'extra', 'key' => '', 'test' => 'with'], $catalogue->all('domain1')); - } - - public function testEncoding() - { - $loader = new XliffFileLoader(); - $catalogue = $loader->load(__DIR__.'/../fixtures/encoding.xlf', 'en', 'domain1'); - - $this->assertEquals(utf8_decode('föö'), $catalogue->get('bar', 'domain1')); - $this->assertEquals(utf8_decode('bär'), $catalogue->get('foo', 'domain1')); - $this->assertEquals(['notes' => [['content' => utf8_decode('bäz')]], 'id' => '1'], $catalogue->getMetadata('foo', 'domain1')); - } - - public function testTargetAttributesAreStoredCorrectly() - { - $loader = new XliffFileLoader(); - $catalogue = $loader->load(__DIR__.'/../fixtures/with-attributes.xlf', 'en', 'domain1'); - - $metadata = $catalogue->getMetadata('foo', 'domain1'); - $this->assertEquals('translated', $metadata['target-attributes']['state']); - } - - public function testLoadInvalidResource() - { - $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException'); - $loader = new XliffFileLoader(); - $loader->load(__DIR__.'/../fixtures/resources.php', 'en', 'domain1'); - } - - public function testLoadResourceDoesNotValidate() - { - $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException'); - $loader = new XliffFileLoader(); - $loader->load(__DIR__.'/../fixtures/non-valid.xlf', 'en', 'domain1'); - } - - public function testLoadNonExistingResource() - { - $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException'); - $loader = new XliffFileLoader(); - $resource = __DIR__.'/../fixtures/non-existing.xlf'; - $loader->load($resource, 'en', 'domain1'); - } - - public function testLoadThrowsAnExceptionIfFileNotLocal() - { - $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException'); - $loader = new XliffFileLoader(); - $resource = 'http://example.com/resources.xlf'; - $loader->load($resource, 'en', 'domain1'); - } - - public function testDocTypeIsNotAllowed() - { - $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException'); - $this->expectExceptionMessage('Document types are not allowed.'); - $loader = new XliffFileLoader(); - $loader->load(__DIR__.'/../fixtures/withdoctype.xlf', 'en', 'domain1'); - } - - public function testParseEmptyFile() - { - $loader = new XliffFileLoader(); - $resource = __DIR__.'/../fixtures/empty.xlf'; - - $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException'); - $this->expectExceptionMessage(sprintf('Unable to load "%s":', $resource)); - - $loader->load($resource, 'en', 'domain1'); - } - - public function testLoadNotes() - { - $loader = new XliffFileLoader(); - $catalogue = $loader->load(__DIR__.'/../fixtures/withnote.xlf', 'en', 'domain1'); - - $this->assertEquals(['notes' => [['priority' => 1, 'content' => 'foo']], 'id' => '1'], $catalogue->getMetadata('foo', 'domain1')); - // message without target - $this->assertEquals(['notes' => [['content' => 'bar', 'from' => 'foo']], 'id' => '2'], $catalogue->getMetadata('extra', 'domain1')); - // message with empty target - $this->assertEquals(['notes' => [['content' => 'baz'], ['priority' => 2, 'from' => 'bar', 'content' => 'qux']], 'id' => '123'], $catalogue->getMetadata('key', 'domain1')); - } - - public function testLoadVersion2() - { - $loader = new XliffFileLoader(); - $resource = __DIR__.'/../fixtures/resources-2.0.xlf'; - $catalogue = $loader->load($resource, 'en', 'domain1'); - - $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); - $this->assertSame([], libxml_get_errors()); - - $domains = $catalogue->all(); - $this->assertCount(3, $domains['domain1']); - $this->assertContainsOnly('string', $catalogue->all('domain1')); - - // target attributes - $this->assertEquals(['target-attributes' => ['order' => 1]], $catalogue->getMetadata('bar', 'domain1')); - } - - public function testLoadVersion2WithNoteMeta() - { - $loader = new XliffFileLoader(); - $resource = __DIR__.'/../fixtures/resources-notes-meta.xlf'; - $catalogue = $loader->load($resource, 'en', 'domain1'); - - $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); - $this->assertSame([], libxml_get_errors()); - - // test for "foo" metadata - $this->assertTrue($catalogue->defines('foo', 'domain1')); - $metadata = $catalogue->getMetadata('foo', 'domain1'); - $this->assertNotEmpty($metadata); - $this->assertCount(3, $metadata['notes']); - - $this->assertEquals('state', $metadata['notes'][0]['category']); - $this->assertEquals('new', $metadata['notes'][0]['content']); - - $this->assertEquals('approved', $metadata['notes'][1]['category']); - $this->assertEquals('true', $metadata['notes'][1]['content']); - - $this->assertEquals('section', $metadata['notes'][2]['category']); - $this->assertEquals('1', $metadata['notes'][2]['priority']); - $this->assertEquals('user login', $metadata['notes'][2]['content']); - - // test for "baz" metadata - $this->assertTrue($catalogue->defines('baz', 'domain1')); - $metadata = $catalogue->getMetadata('baz', 'domain1'); - $this->assertNotEmpty($metadata); - $this->assertCount(2, $metadata['notes']); - - $this->assertEquals('x', $metadata['notes'][0]['id']); - $this->assertEquals('x_content', $metadata['notes'][0]['content']); - - $this->assertEquals('target', $metadata['notes'][1]['appliesTo']); - $this->assertEquals('quality', $metadata['notes'][1]['category']); - $this->assertEquals('Fuzzy', $metadata['notes'][1]['content']); - } - - public function testLoadVersion2WithMultiSegmentUnit() - { - $loader = new XliffFileLoader(); - $resource = __DIR__.'/../fixtures/resources-2.0-multi-segment-unit.xlf'; - $catalog = $loader->load($resource, 'en', 'domain1'); - - $this->assertSame('en', $catalog->getLocale()); - $this->assertEquals([new FileResource($resource)], $catalog->getResources()); - $this->assertFalse(libxml_get_last_error()); - - // test for "foo" metadata - $this->assertTrue($catalog->defines('foo', 'domain1')); - $metadata = $catalog->getMetadata('foo', 'domain1'); - $this->assertNotEmpty($metadata); - $this->assertCount(1, $metadata['notes']); - - $this->assertSame('processed', $metadata['notes'][0]['category']); - $this->assertSame('true', $metadata['notes'][0]['content']); - - // test for "bar" metadata - $this->assertTrue($catalog->defines('bar', 'domain1')); - $metadata = $catalog->getMetadata('bar', 'domain1'); - $this->assertNotEmpty($metadata); - $this->assertCount(1, $metadata['notes']); - - $this->assertSame('processed', $metadata['notes'][0]['category']); - $this->assertSame('true', $metadata['notes'][0]['content']); - } -} diff --git a/vendor/symfony/translation/Tests/Loader/YamlFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/YamlFileLoaderTest.php deleted file mode 100644 index b46fff7..0000000 --- a/vendor/symfony/translation/Tests/Loader/YamlFileLoaderTest.php +++ /dev/null @@ -1,65 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\Loader; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Translation\Loader\YamlFileLoader; - -class YamlFileLoaderTest extends TestCase -{ - public function testLoad() - { - $loader = new YamlFileLoader(); - $resource = __DIR__.'/../fixtures/resources.yml'; - $catalogue = $loader->load($resource, 'en', 'domain1'); - - $this->assertEquals(['foo' => 'bar'], $catalogue->all('domain1')); - $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); - } - - public function testLoadDoesNothingIfEmpty() - { - $loader = new YamlFileLoader(); - $resource = __DIR__.'/../fixtures/empty.yml'; - $catalogue = $loader->load($resource, 'en', 'domain1'); - - $this->assertEquals([], $catalogue->all('domain1')); - $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); - } - - public function testLoadNonExistingResource() - { - $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException'); - $loader = new YamlFileLoader(); - $resource = __DIR__.'/../fixtures/non-existing.yml'; - $loader->load($resource, 'en', 'domain1'); - } - - public function testLoadThrowsAnExceptionIfFileNotLocal() - { - $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException'); - $loader = new YamlFileLoader(); - $resource = 'http://example.com/resources.yml'; - $loader->load($resource, 'en', 'domain1'); - } - - public function testLoadThrowsAnExceptionIfNotAnArray() - { - $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException'); - $loader = new YamlFileLoader(); - $resource = __DIR__.'/../fixtures/non-valid.yml'; - $loader->load($resource, 'en', 'domain1'); - } -} diff --git a/vendor/symfony/translation/Tests/LoggingTranslatorTest.php b/vendor/symfony/translation/Tests/LoggingTranslatorTest.php deleted file mode 100644 index 1d3f065..0000000 --- a/vendor/symfony/translation/Tests/LoggingTranslatorTest.php +++ /dev/null @@ -1,50 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\Loader\ArrayLoader; -use Symfony\Component\Translation\LoggingTranslator; -use Symfony\Component\Translation\Translator; - -class LoggingTranslatorTest extends TestCase -{ - public function testTransWithNoTranslationIsLogged() - { - $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); - $logger->expects($this->exactly(2)) - ->method('warning') - ->with('Translation not found.') - ; - - $translator = new Translator('ar'); - $loggableTranslator = new LoggingTranslator($translator, $logger); - $loggableTranslator->transChoice('some_message2', 10, ['%count%' => 10]); - $loggableTranslator->trans('bar'); - } - - public function testTransChoiceFallbackIsLogged() - { - $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); - $logger->expects($this->once()) - ->method('debug') - ->with('Translation use fallback catalogue.') - ; - - $translator = new Translator('ar'); - $translator->setFallbackLocales(['en']); - $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', ['some_message2' => 'one thing|%count% things'], 'en'); - $loggableTranslator = new LoggingTranslator($translator, $logger); - $loggableTranslator->transChoice('some_message2', 10, ['%count%' => 10]); - } -} diff --git a/vendor/symfony/translation/Tests/MessageCatalogueTest.php b/vendor/symfony/translation/Tests/MessageCatalogueTest.php deleted file mode 100644 index b78dbf4..0000000 --- a/vendor/symfony/translation/Tests/MessageCatalogueTest.php +++ /dev/null @@ -1,216 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\MessageCatalogue; - -class MessageCatalogueTest extends TestCase -{ - public function testGetLocale() - { - $catalogue = new MessageCatalogue('en'); - - $this->assertEquals('en', $catalogue->getLocale()); - } - - public function testGetDomains() - { - $catalogue = new MessageCatalogue('en', ['domain1' => [], 'domain2' => []]); - - $this->assertEquals(['domain1', 'domain2'], $catalogue->getDomains()); - } - - public function testAll() - { - $catalogue = new MessageCatalogue('en', $messages = ['domain1' => ['foo' => 'foo'], 'domain2' => ['bar' => 'bar']]); - - $this->assertEquals(['foo' => 'foo'], $catalogue->all('domain1')); - $this->assertEquals([], $catalogue->all('domain88')); - $this->assertEquals($messages, $catalogue->all()); - } - - public function testHas() - { - $catalogue = new MessageCatalogue('en', ['domain1' => ['foo' => 'foo'], 'domain2' => ['bar' => 'bar']]); - - $this->assertTrue($catalogue->has('foo', 'domain1')); - $this->assertFalse($catalogue->has('bar', 'domain1')); - $this->assertFalse($catalogue->has('foo', 'domain88')); - } - - public function testGetSet() - { - $catalogue = new MessageCatalogue('en', ['domain1' => ['foo' => 'foo'], 'domain2' => ['bar' => 'bar']]); - $catalogue->set('foo1', 'foo1', 'domain1'); - - $this->assertEquals('foo', $catalogue->get('foo', 'domain1')); - $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1')); - } - - public function testAdd() - { - $catalogue = new MessageCatalogue('en', ['domain1' => ['foo' => 'foo'], 'domain2' => ['bar' => 'bar']]); - $catalogue->add(['foo1' => 'foo1'], 'domain1'); - - $this->assertEquals('foo', $catalogue->get('foo', 'domain1')); - $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1')); - - $catalogue->add(['foo' => 'bar'], 'domain1'); - $this->assertEquals('bar', $catalogue->get('foo', 'domain1')); - $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1')); - - $catalogue->add(['foo' => 'bar'], 'domain88'); - $this->assertEquals('bar', $catalogue->get('foo', 'domain88')); - } - - public function testReplace() - { - $catalogue = new MessageCatalogue('en', ['domain1' => ['foo' => 'foo'], 'domain2' => ['bar' => 'bar']]); - $catalogue->replace($messages = ['foo1' => 'foo1'], 'domain1'); - - $this->assertEquals($messages, $catalogue->all('domain1')); - } - - public function testAddCatalogue() - { - $r = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock(); - $r->expects($this->any())->method('__toString')->willReturn('r'); - - $r1 = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock(); - $r1->expects($this->any())->method('__toString')->willReturn('r1'); - - $catalogue = new MessageCatalogue('en', ['domain1' => ['foo' => 'foo'], 'domain2' => ['bar' => 'bar']]); - $catalogue->addResource($r); - - $catalogue1 = new MessageCatalogue('en', ['domain1' => ['foo1' => 'foo1']]); - $catalogue1->addResource($r1); - - $catalogue->addCatalogue($catalogue1); - - $this->assertEquals('foo', $catalogue->get('foo', 'domain1')); - $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1')); - - $this->assertEquals([$r, $r1], $catalogue->getResources()); - } - - public function testAddFallbackCatalogue() - { - $r = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock(); - $r->expects($this->any())->method('__toString')->willReturn('r'); - - $r1 = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock(); - $r1->expects($this->any())->method('__toString')->willReturn('r1'); - - $r2 = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock(); - $r2->expects($this->any())->method('__toString')->willReturn('r2'); - - $catalogue = new MessageCatalogue('fr_FR', ['domain1' => ['foo' => 'foo'], 'domain2' => ['bar' => 'bar']]); - $catalogue->addResource($r); - - $catalogue1 = new MessageCatalogue('fr', ['domain1' => ['foo' => 'bar', 'foo1' => 'foo1']]); - $catalogue1->addResource($r1); - - $catalogue2 = new MessageCatalogue('en'); - $catalogue2->addResource($r2); - - $catalogue->addFallbackCatalogue($catalogue1); - $catalogue1->addFallbackCatalogue($catalogue2); - - $this->assertEquals('foo', $catalogue->get('foo', 'domain1')); - $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1')); - - $this->assertEquals([$r, $r1, $r2], $catalogue->getResources()); - } - - public function testAddFallbackCatalogueWithParentCircularReference() - { - $this->expectException('Symfony\Component\Translation\Exception\LogicException'); - $main = new MessageCatalogue('en_US'); - $fallback = new MessageCatalogue('fr_FR'); - - $fallback->addFallbackCatalogue($main); - $main->addFallbackCatalogue($fallback); - } - - public function testAddFallbackCatalogueWithFallbackCircularReference() - { - $this->expectException('Symfony\Component\Translation\Exception\LogicException'); - $fr = new MessageCatalogue('fr'); - $en = new MessageCatalogue('en'); - $es = new MessageCatalogue('es'); - - $fr->addFallbackCatalogue($en); - $es->addFallbackCatalogue($en); - $en->addFallbackCatalogue($fr); - } - - public function testAddCatalogueWhenLocaleIsNotTheSameAsTheCurrentOne() - { - $this->expectException('Symfony\Component\Translation\Exception\LogicException'); - $catalogue = new MessageCatalogue('en'); - $catalogue->addCatalogue(new MessageCatalogue('fr', [])); - } - - public function testGetAddResource() - { - $catalogue = new MessageCatalogue('en'); - $r = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock(); - $r->expects($this->any())->method('__toString')->willReturn('r'); - $catalogue->addResource($r); - $catalogue->addResource($r); - $r1 = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock(); - $r1->expects($this->any())->method('__toString')->willReturn('r1'); - $catalogue->addResource($r1); - - $this->assertEquals([$r, $r1], $catalogue->getResources()); - } - - public function testMetadataDelete() - { - $catalogue = new MessageCatalogue('en'); - $this->assertEquals([], $catalogue->getMetadata('', ''), 'Metadata is empty'); - $catalogue->deleteMetadata('key', 'messages'); - $catalogue->deleteMetadata('', 'messages'); - $catalogue->deleteMetadata(); - } - - public function testMetadataSetGetDelete() - { - $catalogue = new MessageCatalogue('en'); - $catalogue->setMetadata('key', 'value'); - $this->assertEquals('value', $catalogue->getMetadata('key', 'messages'), "Metadata 'key' = 'value'"); - - $catalogue->setMetadata('key2', []); - $this->assertEquals([], $catalogue->getMetadata('key2', 'messages'), 'Metadata key2 is array'); - - $catalogue->deleteMetadata('key2', 'messages'); - $this->assertNull($catalogue->getMetadata('key2', 'messages'), 'Metadata key2 should is deleted.'); - - $catalogue->deleteMetadata('key2', 'domain'); - $this->assertNull($catalogue->getMetadata('key2', 'domain'), 'Metadata key2 should is deleted.'); - } - - public function testMetadataMerge() - { - $cat1 = new MessageCatalogue('en'); - $cat1->setMetadata('a', 'b'); - $this->assertEquals(['messages' => ['a' => 'b']], $cat1->getMetadata('', ''), 'Cat1 contains messages metadata.'); - - $cat2 = new MessageCatalogue('en'); - $cat2->setMetadata('b', 'c', 'domain'); - $this->assertEquals(['domain' => ['b' => 'c']], $cat2->getMetadata('', ''), 'Cat2 contains domain metadata.'); - - $cat1->addCatalogue($cat2); - $this->assertEquals(['messages' => ['a' => 'b'], 'domain' => ['b' => 'c']], $cat1->getMetadata('', ''), 'Cat1 contains merged metadata.'); - } -} diff --git a/vendor/symfony/translation/Tests/MessageSelectorTest.php b/vendor/symfony/translation/Tests/MessageSelectorTest.php deleted file mode 100644 index abb1d48..0000000 --- a/vendor/symfony/translation/Tests/MessageSelectorTest.php +++ /dev/null @@ -1,137 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\MessageSelector; - -class MessageSelectorTest extends TestCase -{ - /** - * @dataProvider getChooseTests - */ - public function testChoose($expected, $id, $number) - { - $selector = new MessageSelector(); - - $this->assertEquals($expected, $selector->choose($id, $number, 'en')); - } - - public function testReturnMessageIfExactlyOneStandardRuleIsGiven() - { - $selector = new MessageSelector(); - - $this->assertEquals('There are two apples', $selector->choose('There are two apples', 2, 'en')); - } - - /** - * @dataProvider getNonMatchingMessages - */ - public function testThrowExceptionIfMatchingMessageCannotBeFound($id, $number) - { - $this->expectException('Symfony\Component\Translation\Exception\InvalidArgumentException'); - $selector = new MessageSelector(); - - $selector->choose($id, $number, 'en'); - } - - public function getNonMatchingMessages() - { - return [ - ['{0} There are no apples|{1} There is one apple', 2], - ['{1} There is one apple|]1,Inf] There are %count% apples', 0], - ['{1} There is one apple|]2,Inf] There are %count% apples', 2], - ['{0} There are no apples|There is one apple', 2], - ]; - } - - public function getChooseTests() - { - return [ - ['There are no apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0], - ['There are no apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0], - ['There are no apples', '{0}There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0], - - ['There is one apple', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 1], - - ['There are %count% apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 10], - ['There are %count% apples', '{0} There are no apples|{1} There is one apple|]1,Inf]There are %count% apples', 10], - ['There are %count% apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 10], - - ['There are %count% apples', 'There is one apple|There are %count% apples', 0], - ['There is one apple', 'There is one apple|There are %count% apples', 1], - ['There are %count% apples', 'There is one apple|There are %count% apples', 10], - - ['There are %count% apples', 'one: There is one apple|more: There are %count% apples', 0], - ['There is one apple', 'one: There is one apple|more: There are %count% apples', 1], - ['There are %count% apples', 'one: There is one apple|more: There are %count% apples', 10], - - ['There are no apples', '{0} There are no apples|one: There is one apple|more: There are %count% apples', 0], - ['There is one apple', '{0} There are no apples|one: There is one apple|more: There are %count% apples', 1], - ['There are %count% apples', '{0} There are no apples|one: There is one apple|more: There are %count% apples', 10], - - ['', '{0}|{1} There is one apple|]1,Inf] There are %count% apples', 0], - ['', '{0} There are no apples|{1}|]1,Inf] There are %count% apples', 1], - - // Indexed only tests which are Gettext PoFile* compatible strings. - ['There are %count% apples', 'There is one apple|There are %count% apples', 0], - ['There is one apple', 'There is one apple|There are %count% apples', 1], - ['There are %count% apples', 'There is one apple|There are %count% apples', 2], - - // Tests for float numbers - ['There is almost one apple', '{0} There are no apples|]0,1[ There is almost one apple|{1} There is one apple|[1,Inf] There is more than one apple', 0.7], - ['There is one apple', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 1], - ['There is more than one apple', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 1.7], - ['There are no apples', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0], - ['There are no apples', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0.0], - ['There are no apples', '{0.0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0], - - // Test texts with new-lines - // with double-quotes and \n in id & double-quotes and actual newlines in text - ["This is a text with a\n new-line in it. Selector = 0.", '{0}This is a text with a - new-line in it. Selector = 0.|{1}This is a text with a - new-line in it. Selector = 1.|[1,Inf]This is a text with a - new-line in it. Selector > 1.', 0], - // with double-quotes and \n in id and single-quotes and actual newlines in text - ["This is a text with a\n new-line in it. Selector = 1.", '{0}This is a text with a - new-line in it. Selector = 0.|{1}This is a text with a - new-line in it. Selector = 1.|[1,Inf]This is a text with a - new-line in it. Selector > 1.', 1], - ["This is a text with a\n new-line in it. Selector > 1.", '{0}This is a text with a - new-line in it. Selector = 0.|{1}This is a text with a - new-line in it. Selector = 1.|[1,Inf]This is a text with a - new-line in it. Selector > 1.', 5], - // with double-quotes and id split accros lines - ['This is a text with a - new-line in it. Selector = 1.', '{0}This is a text with a - new-line in it. Selector = 0.|{1}This is a text with a - new-line in it. Selector = 1.|[1,Inf]This is a text with a - new-line in it. Selector > 1.', 1], - // with single-quotes and id split accros lines - ['This is a text with a - new-line in it. Selector > 1.', '{0}This is a text with a - new-line in it. Selector = 0.|{1}This is a text with a - new-line in it. Selector = 1.|[1,Inf]This is a text with a - new-line in it. Selector > 1.', 5], - // with single-quotes and \n in text - ['This is a text with a\nnew-line in it. Selector = 0.', '{0}This is a text with a\nnew-line in it. Selector = 0.|{1}This is a text with a\nnew-line in it. Selector = 1.|[1,Inf]This is a text with a\nnew-line in it. Selector > 1.', 0], - // with double-quotes and id split accros lines - ["This is a text with a\nnew-line in it. Selector = 1.", "{0}This is a text with a\nnew-line in it. Selector = 0.|{1}This is a text with a\nnew-line in it. Selector = 1.|[1,Inf]This is a text with a\nnew-line in it. Selector > 1.", 1], - // esacape pipe - ['This is a text with | in it. Selector = 0.', '{0}This is a text with || in it. Selector = 0.|{1}This is a text with || in it. Selector = 1.', 0], - // Empty plural set (2 plural forms) from a .PO file - ['', '|', 1], - // Empty plural set (3 plural forms) from a .PO file - ['', '||', 1], - ]; - } -} diff --git a/vendor/symfony/translation/Tests/PluralizationRulesTest.php b/vendor/symfony/translation/Tests/PluralizationRulesTest.php deleted file mode 100644 index 2877643..0000000 --- a/vendor/symfony/translation/Tests/PluralizationRulesTest.php +++ /dev/null @@ -1,122 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\PluralizationRules; - -/** - * Test should cover all languages mentioned on http://translate.sourceforge.net/wiki/l10n/pluralforms - * and Plural forms mentioned on http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms. - * - * See also https://developer.mozilla.org/en/Localization_and_Plurals which mentions 15 rules having a maximum of 6 forms. - * The mozilla code is also interesting to check for. - * - * As mentioned by chx http://drupal.org/node/1273968 we can cover all by testing number from 0 to 199 - * - * The goal to cover all languages is to far fetched so this test case is smaller. - * - * @author Clemens Tolboom clemens@build2be.nl - */ -class PluralizationRulesTest extends TestCase -{ - /** - * We test failed langcode here. - * - * TODO: The languages mentioned in the data provide need to get fixed somehow within PluralizationRules. - * - * @dataProvider failingLangcodes - */ - public function testFailedLangcodes($nplural, $langCodes) - { - $matrix = $this->generateTestData($langCodes); - $this->validateMatrix($nplural, $matrix, false); - } - - /** - * @dataProvider successLangcodes - */ - public function testLangcodes($nplural, $langCodes) - { - $matrix = $this->generateTestData($langCodes); - $this->validateMatrix($nplural, $matrix); - } - - /** - * This array should contain all currently known langcodes. - * - * As it is impossible to have this ever complete we should try as hard as possible to have it almost complete. - * - * @return array - */ - public function successLangcodes() - { - return [ - ['1', ['ay', 'bo', 'cgg', 'dz', 'id', 'ja', 'jbo', 'ka', 'kk', 'km', 'ko', 'ky']], - ['2', ['nl', 'fr', 'en', 'de', 'de_GE', 'hy', 'hy_AM']], - ['3', ['be', 'bs', 'cs', 'hr']], - ['4', ['cy', 'mt', 'sl']], - ['6', ['ar']], - ]; - } - - /** - * This array should be at least empty within the near future. - * - * This both depends on a complete list trying to add above as understanding - * the plural rules of the current failing languages. - * - * @return array with nplural together with langcodes - */ - public function failingLangcodes() - { - return [ - ['1', ['fa']], - ['2', ['jbo']], - ['3', ['cbs']], - ['4', ['gd', 'kw']], - ['5', ['ga']], - ]; - } - - /** - * We validate only on the plural coverage. Thus the real rules is not tested. - * - * @param string $nplural Plural expected - * @param array $matrix Containing langcodes and their plural index values - * @param bool $expectSuccess - */ - protected function validateMatrix($nplural, $matrix, $expectSuccess = true) - { - foreach ($matrix as $langCode => $data) { - $indexes = array_flip($data); - if ($expectSuccess) { - $this->assertEquals($nplural, \count($indexes), "Langcode '$langCode' has '$nplural' plural forms."); - } else { - $this->assertNotEquals((int) $nplural, \count($indexes), "Langcode '$langCode' has '$nplural' plural forms."); - } - } - } - - protected function generateTestData($langCodes) - { - $matrix = []; - foreach ($langCodes as $langCode) { - for ($count = 0; $count < 200; ++$count) { - $plural = PluralizationRules::get($count, $langCode); - $matrix[$langCode][$count] = $plural; - } - } - - return $matrix; - } -} diff --git a/vendor/symfony/translation/Tests/TranslatorCacheTest.php b/vendor/symfony/translation/Tests/TranslatorCacheTest.php deleted file mode 100644 index 6b23a9f..0000000 --- a/vendor/symfony/translation/Tests/TranslatorCacheTest.php +++ /dev/null @@ -1,312 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests; - -use PHPUnit\Framework\MockObject\MockObject; -use PHPUnit\Framework\TestCase; -use Symfony\Component\Config\Resource\SelfCheckingResourceInterface; -use Symfony\Component\Translation\Loader\ArrayLoader; -use Symfony\Component\Translation\Loader\LoaderInterface; -use Symfony\Component\Translation\MessageCatalogue; -use Symfony\Component\Translation\Translator; - -class TranslatorCacheTest extends TestCase -{ - protected $tmpDir; - - protected function setUp() - { - $this->tmpDir = sys_get_temp_dir().'/sf2_translation'; - $this->deleteTmpDir(); - } - - protected function tearDown() - { - $this->deleteTmpDir(); - } - - protected function deleteTmpDir() - { - if (!file_exists($dir = $this->tmpDir)) { - return; - } - - $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->tmpDir), \RecursiveIteratorIterator::CHILD_FIRST); - foreach ($iterator as $path) { - if (preg_match('#[/\\\\]\.\.?$#', $path->__toString())) { - continue; - } - if ($path->isDir()) { - rmdir($path->__toString()); - } else { - unlink($path->__toString()); - } - } - rmdir($this->tmpDir); - } - - /** - * @dataProvider runForDebugAndProduction - */ - public function testThatACacheIsUsed($debug) - { - $locale = 'any_locale'; - $format = 'some_format'; - $msgid = 'test'; - - // Prime the cache - $translator = new Translator($locale, null, $this->tmpDir, $debug); - $translator->addLoader($format, new ArrayLoader()); - $translator->addResource($format, [$msgid => 'OK'], $locale); - $translator->trans($msgid); - - // Try again and see we get a valid result whilst no loader can be used - $translator = new Translator($locale, null, $this->tmpDir, $debug); - $translator->addLoader($format, $this->createFailingLoader()); - $translator->addResource($format, [$msgid => 'OK'], $locale); - $this->assertEquals('OK', $translator->trans($msgid), '-> caching does not work in '.($debug ? 'debug' : 'production')); - } - - public function testCatalogueIsReloadedWhenResourcesAreNoLongerFresh() - { - /* - * The testThatACacheIsUsed() test showed that we don't need the loader as long as the cache - * is fresh. - * - * Now we add a Resource that is never fresh and make sure that the - * cache is discarded (the loader is called twice). - * - * We need to run this for debug=true only because in production the cache - * will never be revalidated. - */ - - $locale = 'any_locale'; - $format = 'some_format'; - $msgid = 'test'; - - $catalogue = new MessageCatalogue($locale, []); - $catalogue->addResource(new StaleResource()); // better use a helper class than a mock, because it gets serialized in the cache and re-loaded - - /** @var LoaderInterface|MockObject $loader */ - $loader = $this->getMockBuilder('Symfony\Component\Translation\Loader\LoaderInterface')->getMock(); - $loader - ->expects($this->exactly(2)) - ->method('load') - ->willReturn($catalogue) - ; - - // 1st pass - $translator = new Translator($locale, null, $this->tmpDir, true); - $translator->addLoader($format, $loader); - $translator->addResource($format, null, $locale); - $translator->trans($msgid); - - // 2nd pass - $translator = new Translator($locale, null, $this->tmpDir, true); - $translator->addLoader($format, $loader); - $translator->addResource($format, null, $locale); - $translator->trans($msgid); - } - - /** - * @dataProvider runForDebugAndProduction - */ - public function testDifferentTranslatorsForSameLocaleDoNotOverwriteEachOthersCache($debug) - { - /* - * Similar to the previous test. After we used the second translator, make - * sure there's still a usable cache for the first one. - */ - - $locale = 'any_locale'; - $format = 'some_format'; - $msgid = 'test'; - - // Create a Translator and prime its cache - $translator = new Translator($locale, null, $this->tmpDir, $debug); - $translator->addLoader($format, new ArrayLoader()); - $translator->addResource($format, [$msgid => 'OK'], $locale); - $translator->trans($msgid); - - // Create another Translator with a different catalogue for the same locale - $translator = new Translator($locale, null, $this->tmpDir, $debug); - $translator->addLoader($format, new ArrayLoader()); - $translator->addResource($format, [$msgid => 'FAIL'], $locale); - $translator->trans($msgid); - - // Now the first translator must still have a usable cache. - $translator = new Translator($locale, null, $this->tmpDir, $debug); - $translator->addLoader($format, $this->createFailingLoader()); - $translator->addResource($format, [$msgid => 'OK'], $locale); - $this->assertEquals('OK', $translator->trans($msgid), '-> the cache was overwritten by another translator instance in '.($debug ? 'debug' : 'production')); - } - - public function testGeneratedCacheFilesAreOnlyBelongRequestedLocales() - { - $translator = new Translator('a', null, $this->tmpDir); - $translator->setFallbackLocales(['b']); - $translator->trans('bar'); - - $cachedFiles = glob($this->tmpDir.'/*.php'); - - $this->assertCount(1, $cachedFiles); - } - - public function testDifferentCacheFilesAreUsedForDifferentSetsOfFallbackLocales() - { - /* - * Because the cache file contains a catalogue including all of its fallback - * catalogues, we must take the set of fallback locales into consideration when - * loading a catalogue from the cache. - */ - $translator = new Translator('a', null, $this->tmpDir); - $translator->setFallbackLocales(['b']); - - $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', ['foo' => 'foo (a)'], 'a'); - $translator->addResource('array', ['bar' => 'bar (b)'], 'b'); - - $this->assertEquals('bar (b)', $translator->trans('bar')); - - // Remove fallback locale - $translator->setFallbackLocales([]); - $this->assertEquals('bar', $translator->trans('bar')); - - // Use a fresh translator with no fallback locales, result should be the same - $translator = new Translator('a', null, $this->tmpDir); - - $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', ['foo' => 'foo (a)'], 'a'); - $translator->addResource('array', ['bar' => 'bar (b)'], 'b'); - - $this->assertEquals('bar', $translator->trans('bar')); - } - - public function testPrimaryAndFallbackCataloguesContainTheSameMessagesRegardlessOfCaching() - { - /* - * As a safeguard against potential BC breaks, make sure that primary and fallback - * catalogues (reachable via getFallbackCatalogue()) always contain the full set of - * messages provided by the loader. This must also be the case when these catalogues - * are (internally) read from a cache. - * - * Optimizations inside the translator must not change this behavior. - */ - - /* - * Create a translator that loads two catalogues for two different locales. - * The catalogues contain distinct sets of messages. - */ - $translator = new Translator('a', null, $this->tmpDir); - $translator->setFallbackLocales(['b']); - - $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', ['foo' => 'foo (a)'], 'a'); - $translator->addResource('array', ['foo' => 'foo (b)'], 'b'); - $translator->addResource('array', ['bar' => 'bar (b)'], 'b'); - - $catalogue = $translator->getCatalogue('a'); - $this->assertFalse($catalogue->defines('bar')); // Sure, the "a" catalogue does not contain that message. - - $fallback = $catalogue->getFallbackCatalogue(); - $this->assertTrue($fallback->defines('foo')); // "foo" is present in "a" and "b" - - /* - * Now, repeat the same test. - * Behind the scenes, the cache is used. But that should not matter, right? - */ - $translator = new Translator('a', null, $this->tmpDir); - $translator->setFallbackLocales(['b']); - - $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', ['foo' => 'foo (a)'], 'a'); - $translator->addResource('array', ['foo' => 'foo (b)'], 'b'); - $translator->addResource('array', ['bar' => 'bar (b)'], 'b'); - - $catalogue = $translator->getCatalogue('a'); - $this->assertFalse($catalogue->defines('bar')); - - $fallback = $catalogue->getFallbackCatalogue(); - $this->assertTrue($fallback->defines('foo')); - } - - public function testRefreshCacheWhenResourcesAreNoLongerFresh() - { - $resource = $this->getMockBuilder('Symfony\Component\Config\Resource\SelfCheckingResourceInterface')->getMock(); - $loader = $this->getMockBuilder('Symfony\Component\Translation\Loader\LoaderInterface')->getMock(); - $resource->method('isFresh')->willReturn(false); - $loader - ->expects($this->exactly(2)) - ->method('load') - ->willReturn($this->getCatalogue('fr', [], [$resource])); - - // prime the cache - $translator = new Translator('fr', null, $this->tmpDir, true); - $translator->addLoader('loader', $loader); - $translator->addResource('loader', 'foo', 'fr'); - $translator->trans('foo'); - - // prime the cache second time - $translator = new Translator('fr', null, $this->tmpDir, true); - $translator->addLoader('loader', $loader); - $translator->addResource('loader', 'foo', 'fr'); - $translator->trans('foo'); - } - - protected function getCatalogue($locale, $messages, $resources = []) - { - $catalogue = new MessageCatalogue($locale); - foreach ($messages as $key => $translation) { - $catalogue->set($key, $translation); - } - foreach ($resources as $resource) { - $catalogue->addResource($resource); - } - - return $catalogue; - } - - public function runForDebugAndProduction() - { - return [[true], [false]]; - } - - /** - * @return LoaderInterface - */ - private function createFailingLoader() - { - $loader = $this->getMockBuilder('Symfony\Component\Translation\Loader\LoaderInterface')->getMock(); - $loader - ->expects($this->never()) - ->method('load'); - - return $loader; - } -} - -class StaleResource implements SelfCheckingResourceInterface -{ - public function isFresh($timestamp) - { - return false; - } - - public function getResource() - { - } - - public function __toString() - { - return ''; - } -} diff --git a/vendor/symfony/translation/Tests/TranslatorTest.php b/vendor/symfony/translation/Tests/TranslatorTest.php deleted file mode 100644 index 77af7de..0000000 --- a/vendor/symfony/translation/Tests/TranslatorTest.php +++ /dev/null @@ -1,547 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\Loader\ArrayLoader; -use Symfony\Component\Translation\MessageCatalogue; -use Symfony\Component\Translation\Translator; - -class TranslatorTest extends TestCase -{ - /** - * @dataProvider getInvalidLocalesTests - */ - public function testConstructorInvalidLocale($locale) - { - $this->expectException('Symfony\Component\Translation\Exception\InvalidArgumentException'); - new Translator($locale); - } - - /** - * @dataProvider getValidLocalesTests - */ - public function testConstructorValidLocale($locale) - { - $translator = new Translator($locale); - - $this->assertEquals($locale, $translator->getLocale()); - } - - public function testConstructorWithoutLocale() - { - $translator = new Translator(null); - - $this->assertNull($translator->getLocale()); - } - - public function testSetGetLocale() - { - $translator = new Translator('en'); - - $this->assertEquals('en', $translator->getLocale()); - - $translator->setLocale('fr'); - $this->assertEquals('fr', $translator->getLocale()); - } - - /** - * @dataProvider getInvalidLocalesTests - */ - public function testSetInvalidLocale($locale) - { - $this->expectException('Symfony\Component\Translation\Exception\InvalidArgumentException'); - $translator = new Translator('fr'); - $translator->setLocale($locale); - } - - /** - * @dataProvider getValidLocalesTests - */ - public function testSetValidLocale($locale) - { - $translator = new Translator($locale); - $translator->setLocale($locale); - - $this->assertEquals($locale, $translator->getLocale()); - } - - public function testGetCatalogue() - { - $translator = new Translator('en'); - - $this->assertEquals(new MessageCatalogue('en'), $translator->getCatalogue()); - - $translator->setLocale('fr'); - $this->assertEquals(new MessageCatalogue('fr'), $translator->getCatalogue('fr')); - } - - public function testGetCatalogueReturnsConsolidatedCatalogue() - { - /* - * This will be useful once we refactor so that different domains will be loaded lazily (on-demand). - * In that case, getCatalogue() will probably have to load all missing domains in order to return - * one complete catalogue. - */ - - $locale = 'whatever'; - $translator = new Translator($locale); - $translator->addLoader('loader-a', new ArrayLoader()); - $translator->addLoader('loader-b', new ArrayLoader()); - $translator->addResource('loader-a', ['foo' => 'foofoo'], $locale, 'domain-a'); - $translator->addResource('loader-b', ['bar' => 'foobar'], $locale, 'domain-b'); - - /* - * Test that we get a single catalogue comprising messages - * from different loaders and different domains - */ - $catalogue = $translator->getCatalogue($locale); - $this->assertTrue($catalogue->defines('foo', 'domain-a')); - $this->assertTrue($catalogue->defines('bar', 'domain-b')); - } - - public function testSetFallbackLocales() - { - $translator = new Translator('en'); - $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', ['foo' => 'foofoo'], 'en'); - $translator->addResource('array', ['bar' => 'foobar'], 'fr'); - - // force catalogue loading - $translator->trans('bar'); - - $translator->setFallbackLocales(['fr']); - $this->assertEquals('foobar', $translator->trans('bar')); - } - - public function testSetFallbackLocalesMultiple() - { - $translator = new Translator('en'); - $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', ['foo' => 'foo (en)'], 'en'); - $translator->addResource('array', ['bar' => 'bar (fr)'], 'fr'); - - // force catalogue loading - $translator->trans('bar'); - - $translator->setFallbackLocales(['fr_FR', 'fr']); - $this->assertEquals('bar (fr)', $translator->trans('bar')); - } - - /** - * @dataProvider getInvalidLocalesTests - */ - public function testSetFallbackInvalidLocales($locale) - { - $this->expectException('Symfony\Component\Translation\Exception\InvalidArgumentException'); - $translator = new Translator('fr'); - $translator->setFallbackLocales(['fr', $locale]); - } - - /** - * @dataProvider getValidLocalesTests - */ - public function testSetFallbackValidLocales($locale) - { - $translator = new Translator($locale); - $translator->setFallbackLocales(['fr', $locale]); - // no assertion. this method just asserts that no exception is thrown - $this->addToAssertionCount(1); - } - - public function testTransWithFallbackLocale() - { - $translator = new Translator('fr_FR'); - $translator->setFallbackLocales(['en']); - - $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', ['bar' => 'foobar'], 'en'); - - $this->assertEquals('foobar', $translator->trans('bar')); - } - - /** - * @dataProvider getInvalidLocalesTests - */ - public function testAddResourceInvalidLocales($locale) - { - $this->expectException('Symfony\Component\Translation\Exception\InvalidArgumentException'); - $translator = new Translator('fr'); - $translator->addResource('array', ['foo' => 'foofoo'], $locale); - } - - /** - * @dataProvider getValidLocalesTests - */ - public function testAddResourceValidLocales($locale) - { - $translator = new Translator('fr'); - $translator->addResource('array', ['foo' => 'foofoo'], $locale); - // no assertion. this method just asserts that no exception is thrown - $this->addToAssertionCount(1); - } - - public function testAddResourceAfterTrans() - { - $translator = new Translator('fr'); - $translator->addLoader('array', new ArrayLoader()); - - $translator->setFallbackLocales(['en']); - - $translator->addResource('array', ['foo' => 'foofoo'], 'en'); - $this->assertEquals('foofoo', $translator->trans('foo')); - - $translator->addResource('array', ['bar' => 'foobar'], 'en'); - $this->assertEquals('foobar', $translator->trans('bar')); - } - - /** - * @dataProvider getTransFileTests - */ - public function testTransWithoutFallbackLocaleFile($format, $loader) - { - $this->expectException('Symfony\Component\Translation\Exception\NotFoundResourceException'); - $loaderClass = 'Symfony\\Component\\Translation\\Loader\\'.$loader; - $translator = new Translator('en'); - $translator->addLoader($format, new $loaderClass()); - $translator->addResource($format, __DIR__.'/fixtures/non-existing', 'en'); - $translator->addResource($format, __DIR__.'/fixtures/resources.'.$format, 'en'); - - // force catalogue loading - $translator->trans('foo'); - } - - /** - * @dataProvider getTransFileTests - */ - public function testTransWithFallbackLocaleFile($format, $loader) - { - $loaderClass = 'Symfony\\Component\\Translation\\Loader\\'.$loader; - $translator = new Translator('en_GB'); - $translator->addLoader($format, new $loaderClass()); - $translator->addResource($format, __DIR__.'/fixtures/non-existing', 'en_GB'); - $translator->addResource($format, __DIR__.'/fixtures/resources.'.$format, 'en', 'resources'); - - $this->assertEquals('bar', $translator->trans('foo', [], 'resources')); - } - - public function testTransWithFallbackLocaleBis() - { - $translator = new Translator('en_US'); - $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', ['foo' => 'foofoo'], 'en_US'); - $translator->addResource('array', ['bar' => 'foobar'], 'en'); - $this->assertEquals('foobar', $translator->trans('bar')); - } - - public function testTransWithFallbackLocaleTer() - { - $translator = new Translator('fr_FR'); - $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', ['foo' => 'foo (en_US)'], 'en_US'); - $translator->addResource('array', ['bar' => 'bar (en)'], 'en'); - - $translator->setFallbackLocales(['en_US', 'en']); - - $this->assertEquals('foo (en_US)', $translator->trans('foo')); - $this->assertEquals('bar (en)', $translator->trans('bar')); - } - - public function testTransNonExistentWithFallback() - { - $translator = new Translator('fr'); - $translator->setFallbackLocales(['en']); - $translator->addLoader('array', new ArrayLoader()); - $this->assertEquals('non-existent', $translator->trans('non-existent')); - } - - public function testWhenAResourceHasNoRegisteredLoader() - { - $this->expectException('Symfony\Component\Translation\Exception\RuntimeException'); - $translator = new Translator('en'); - $translator->addResource('array', ['foo' => 'foofoo'], 'en'); - - $translator->trans('foo'); - } - - public function testNestedFallbackCatalogueWhenUsingMultipleLocales() - { - $translator = new Translator('fr'); - $translator->setFallbackLocales(['ru', 'en']); - - $translator->getCatalogue('fr'); - - $this->assertNotNull($translator->getCatalogue('ru')->getFallbackCatalogue()); - } - - public function testFallbackCatalogueResources() - { - $translator = new Translator('en_GB'); - $translator->addLoader('yml', new \Symfony\Component\Translation\Loader\YamlFileLoader()); - $translator->addResource('yml', __DIR__.'/fixtures/empty.yml', 'en_GB'); - $translator->addResource('yml', __DIR__.'/fixtures/resources.yml', 'en'); - - // force catalogue loading - $this->assertEquals('bar', $translator->trans('foo', [])); - - $resources = $translator->getCatalogue('en')->getResources(); - $this->assertCount(1, $resources); - $this->assertContains(__DIR__.\DIRECTORY_SEPARATOR.'fixtures'.\DIRECTORY_SEPARATOR.'resources.yml', $resources); - - $resources = $translator->getCatalogue('en_GB')->getResources(); - $this->assertCount(2, $resources); - $this->assertContains(__DIR__.\DIRECTORY_SEPARATOR.'fixtures'.\DIRECTORY_SEPARATOR.'empty.yml', $resources); - $this->assertContains(__DIR__.\DIRECTORY_SEPARATOR.'fixtures'.\DIRECTORY_SEPARATOR.'resources.yml', $resources); - } - - /** - * @dataProvider getTransTests - */ - public function testTrans($expected, $id, $translation, $parameters, $locale, $domain) - { - $translator = new Translator('en'); - $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', [(string) $id => $translation], $locale, $domain); - - $this->assertEquals($expected, $translator->trans($id, $parameters, $domain, $locale)); - } - - /** - * @dataProvider getInvalidLocalesTests - */ - public function testTransInvalidLocale($locale) - { - $this->expectException('Symfony\Component\Translation\Exception\InvalidArgumentException'); - $translator = new Translator('en'); - $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', ['foo' => 'foofoo'], 'en'); - - $translator->trans('foo', [], '', $locale); - } - - /** - * @dataProvider getValidLocalesTests - */ - public function testTransValidLocale($locale) - { - $translator = new Translator($locale); - $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', ['test' => 'OK'], $locale); - - $this->assertEquals('OK', $translator->trans('test')); - $this->assertEquals('OK', $translator->trans('test', [], null, $locale)); - } - - /** - * @dataProvider getFlattenedTransTests - */ - public function testFlattenedTrans($expected, $messages, $id) - { - $translator = new Translator('en'); - $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', $messages, 'fr', ''); - - $this->assertEquals($expected, $translator->trans($id, [], '', 'fr')); - } - - /** - * @dataProvider getTransChoiceTests - */ - public function testTransChoice($expected, $id, $translation, $number, $parameters, $locale, $domain) - { - $translator = new Translator('en'); - $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', [(string) $id => $translation], $locale, $domain); - - $this->assertEquals($expected, $translator->transChoice($id, $number, $parameters, $domain, $locale)); - } - - /** - * @dataProvider getInvalidLocalesTests - */ - public function testTransChoiceInvalidLocale($locale) - { - $this->expectException('Symfony\Component\Translation\Exception\InvalidArgumentException'); - $translator = new Translator('en'); - $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', ['foo' => 'foofoo'], 'en'); - - $translator->transChoice('foo', 1, [], '', $locale); - } - - /** - * @dataProvider getValidLocalesTests - */ - public function testTransChoiceValidLocale($locale) - { - $translator = new Translator('en'); - $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', ['foo' => 'foofoo'], 'en'); - - $translator->transChoice('foo', 1, [], '', $locale); - // no assertion. this method just asserts that no exception is thrown - $this->addToAssertionCount(1); - } - - public function getTransFileTests() - { - return [ - ['csv', 'CsvFileLoader'], - ['ini', 'IniFileLoader'], - ['mo', 'MoFileLoader'], - ['po', 'PoFileLoader'], - ['php', 'PhpFileLoader'], - ['ts', 'QtFileLoader'], - ['xlf', 'XliffFileLoader'], - ['yml', 'YamlFileLoader'], - ['json', 'JsonFileLoader'], - ]; - } - - public function getTransTests() - { - return [ - ['Symfony est super !', 'Symfony is great!', 'Symfony est super !', [], 'fr', ''], - ['Symfony est awesome !', 'Symfony is %what%!', 'Symfony est %what% !', ['%what%' => 'awesome'], 'fr', ''], - ['Symfony est super !', new StringClass('Symfony is great!'), 'Symfony est super !', [], 'fr', ''], - ]; - } - - public function getFlattenedTransTests() - { - $messages = [ - 'symfony' => [ - 'is' => [ - 'great' => 'Symfony est super!', - ], - ], - 'foo' => [ - 'bar' => [ - 'baz' => 'Foo Bar Baz', - ], - 'baz' => 'Foo Baz', - ], - ]; - - return [ - ['Symfony est super!', $messages, 'symfony.is.great'], - ['Foo Bar Baz', $messages, 'foo.bar.baz'], - ['Foo Baz', $messages, 'foo.baz'], - ]; - } - - public function getTransChoiceTests() - { - return [ - ['Il y a 0 pomme', '{0} There are no appless|{1} There is one apple|]1,Inf] There is %count% apples', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 0, [], 'fr', ''], - ['Il y a 1 pomme', '{0} There are no appless|{1} There is one apple|]1,Inf] There is %count% apples', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 1, [], 'fr', ''], - ['Il y a 10 pommes', '{0} There are no appless|{1} There is one apple|]1,Inf] There is %count% apples', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 10, [], 'fr', ''], - - ['Il y a 0 pomme', 'There is one apple|There is %count% apples', 'Il y a %count% pomme|Il y a %count% pommes', 0, [], 'fr', ''], - ['Il y a 1 pomme', 'There is one apple|There is %count% apples', 'Il y a %count% pomme|Il y a %count% pommes', 1, [], 'fr', ''], - ['Il y a 10 pommes', 'There is one apple|There is %count% apples', 'Il y a %count% pomme|Il y a %count% pommes', 10, [], 'fr', ''], - - ['Il y a 0 pomme', 'one: There is one apple|more: There is %count% apples', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 0, [], 'fr', ''], - ['Il y a 1 pomme', 'one: There is one apple|more: There is %count% apples', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 1, [], 'fr', ''], - ['Il y a 10 pommes', 'one: There is one apple|more: There is %count% apples', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 10, [], 'fr', ''], - - ['Il n\'y a aucune pomme', '{0} There are no apples|one: There is one apple|more: There is %count% apples', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 0, [], 'fr', ''], - ['Il y a 1 pomme', '{0} There are no apples|one: There is one apple|more: There is %count% apples', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 1, [], 'fr', ''], - ['Il y a 10 pommes', '{0} There are no apples|one: There is one apple|more: There is %count% apples', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 10, [], 'fr', ''], - - ['Il y a 0 pomme', new StringClass('{0} There are no appless|{1} There is one apple|]1,Inf] There is %count% apples'), '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 0, [], 'fr', ''], - - // Override %count% with a custom value - ['Il y a quelques pommes', 'one: There is one apple|more: There are %count% apples', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 2, ['%count%' => 'quelques'], 'fr', ''], - ]; - } - - public function getInvalidLocalesTests() - { - return [ - ['fr FR'], - ['français'], - ['fr+en'], - ['utf#8'], - ['fr&en'], - ['fr~FR'], - [' fr'], - ['fr '], - ['fr*'], - ['fr/FR'], - ['fr\\FR'], - ]; - } - - public function getValidLocalesTests() - { - return [ - [''], - [null], - ['fr'], - ['francais'], - ['FR'], - ['frFR'], - ['fr-FR'], - ['fr_FR'], - ['fr.FR'], - ['fr-FR.UTF8'], - ['sr@latin'], - ]; - } - - public function testTransChoiceFallback() - { - $translator = new Translator('ru'); - $translator->setFallbackLocales(['en']); - $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', ['some_message2' => 'one thing|%count% things'], 'en'); - - $this->assertEquals('10 things', $translator->transChoice('some_message2', 10, ['%count%' => 10])); - } - - public function testTransChoiceFallbackBis() - { - $translator = new Translator('ru'); - $translator->setFallbackLocales(['en_US', 'en']); - $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', ['some_message2' => 'one thing|%count% things'], 'en_US'); - - $this->assertEquals('10 things', $translator->transChoice('some_message2', 10, ['%count%' => 10])); - } - - public function testTransChoiceFallbackWithNoTranslation() - { - $translator = new Translator('ru'); - $translator->setFallbackLocales(['en']); - $translator->addLoader('array', new ArrayLoader()); - - // consistent behavior with Translator::trans(), which returns the string - // unchanged if it can't be found - $this->assertEquals('some_message2', $translator->transChoice('some_message2', 10, ['%count%' => 10])); - } -} - -class StringClass -{ - protected $str; - - public function __construct($str) - { - $this->str = $str; - } - - public function __toString() - { - return $this->str; - } -} diff --git a/vendor/symfony/translation/Tests/Util/ArrayConverterTest.php b/vendor/symfony/translation/Tests/Util/ArrayConverterTest.php deleted file mode 100644 index b033541..0000000 --- a/vendor/symfony/translation/Tests/Util/ArrayConverterTest.php +++ /dev/null @@ -1,74 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\Util; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\Util\ArrayConverter; - -class ArrayConverterTest extends TestCase -{ - /** - * @dataProvider messagesData - */ - public function testDump($input, $expectedOutput) - { - $this->assertEquals($expectedOutput, ArrayConverter::expandToTree($input)); - } - - public function messagesData() - { - return [ - [ - // input - [ - 'foo1' => 'bar', - 'foo.bar' => 'value', - ], - // expected output - [ - 'foo1' => 'bar', - 'foo' => ['bar' => 'value'], - ], - ], - [ - // input - [ - 'foo.bar' => 'value1', - 'foo.bar.test' => 'value2', - ], - // expected output - [ - 'foo' => [ - 'bar' => 'value1', - 'bar.test' => 'value2', - ], - ], - ], - [ - // input - [ - 'foo.level2.level3.level4' => 'value1', - 'foo.level2' => 'value2', - 'foo.bar' => 'value3', - ], - // expected output - [ - 'foo' => [ - 'level2' => 'value2', - 'level2.level3.level4' => 'value1', - 'bar' => 'value3', - ], - ], - ], - ]; - } -} diff --git a/vendor/symfony/translation/Tests/Writer/TranslationWriterTest.php b/vendor/symfony/translation/Tests/Writer/TranslationWriterTest.php deleted file mode 100644 index dbcc14e..0000000 --- a/vendor/symfony/translation/Tests/Writer/TranslationWriterTest.php +++ /dev/null @@ -1,82 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Tests\Writer; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\Dumper\DumperInterface; -use Symfony\Component\Translation\MessageCatalogue; -use Symfony\Component\Translation\Writer\TranslationWriter; - -class TranslationWriterTest extends TestCase -{ - /** - * @group legacy - * @expectedDeprecation The "Symfony\Component\Translation\Writer\TranslationWriter::writeTranslations()" method is deprecated since Symfony 3.4 and will be removed in 4.0. Use write() instead. - */ - public function testWriteTranslations() - { - $dumper = $this->getMockBuilder('Symfony\Component\Translation\Dumper\DumperInterface')->getMock(); - $dumper - ->expects($this->once()) - ->method('dump'); - - $writer = new TranslationWriter(); - $writer->addDumper('test', $dumper); - $writer->writeTranslations(new MessageCatalogue('en'), 'test'); - } - - public function testWrite() - { - $dumper = $this->getMockBuilder('Symfony\Component\Translation\Dumper\DumperInterface')->getMock(); - $dumper - ->expects($this->once()) - ->method('dump'); - - $writer = new TranslationWriter(); - $writer->addDumper('test', $dumper); - $writer->write(new MessageCatalogue([]), 'test'); - } - - public function testDisableBackup() - { - $nonBackupDumper = new NonBackupDumper(); - $backupDumper = new BackupDumper(); - - $writer = new TranslationWriter(); - $writer->addDumper('non_backup', $nonBackupDumper); - $writer->addDumper('backup', $backupDumper); - $writer->disableBackup(); - - $this->assertFalse($backupDumper->backup, 'backup can be disabled if setBackup() method does exist'); - } -} - -class NonBackupDumper implements DumperInterface -{ - public function dump(MessageCatalogue $messages, $options = []) - { - } -} - -class BackupDumper implements DumperInterface -{ - public $backup = true; - - public function dump(MessageCatalogue $messages, $options = []) - { - } - - public function setBackup($backup) - { - $this->backup = $backup; - } -} diff --git a/vendor/symfony/translation/Tests/fixtures/empty-translation.mo b/vendor/symfony/translation/Tests/fixtures/empty-translation.mo deleted file mode 100644 index ed01000c9b1b3fdf40fc2369a7799e72e41a1edf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 49 ncmca7#4?ou2pEA_28dNa93apEVrC%L1#y7D5JaTq=Q98RUv2}O diff --git a/vendor/symfony/translation/Tests/fixtures/empty-translation.po b/vendor/symfony/translation/Tests/fixtures/empty-translation.po deleted file mode 100644 index ff6f22a..0000000 --- a/vendor/symfony/translation/Tests/fixtures/empty-translation.po +++ /dev/null @@ -1,3 +0,0 @@ -msgid "foo" -msgstr "" - diff --git a/vendor/symfony/translation/Tests/fixtures/empty.csv b/vendor/symfony/translation/Tests/fixtures/empty.csv deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/symfony/translation/Tests/fixtures/empty.ini b/vendor/symfony/translation/Tests/fixtures/empty.ini deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/symfony/translation/Tests/fixtures/empty.json b/vendor/symfony/translation/Tests/fixtures/empty.json deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/symfony/translation/Tests/fixtures/empty.mo b/vendor/symfony/translation/Tests/fixtures/empty.mo deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/symfony/translation/Tests/fixtures/empty.po b/vendor/symfony/translation/Tests/fixtures/empty.po deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/symfony/translation/Tests/fixtures/empty.xlf b/vendor/symfony/translation/Tests/fixtures/empty.xlf deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/symfony/translation/Tests/fixtures/empty.yml b/vendor/symfony/translation/Tests/fixtures/empty.yml deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/symfony/translation/Tests/fixtures/encoding.xlf b/vendor/symfony/translation/Tests/fixtures/encoding.xlf deleted file mode 100644 index 0a88f92..0000000 --- a/vendor/symfony/translation/Tests/fixtures/encoding.xlf +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2"> - <file source-language="en" datatype="plaintext" original="file.ext"> - <body> - <trans-unit id="1" resname="foo"> - <source>foo</source> - <target>b�r</target> - <note>b�z</note> - </trans-unit> - <trans-unit id="2" resname="bar"> - <source>bar</source> - <target>f��</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/vendor/symfony/translation/Tests/fixtures/escaped-id-plurals.po b/vendor/symfony/translation/Tests/fixtures/escaped-id-plurals.po deleted file mode 100644 index c412aa2..0000000 --- a/vendor/symfony/translation/Tests/fixtures/escaped-id-plurals.po +++ /dev/null @@ -1,10 +0,0 @@ -msgid "" -msgstr "" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: en\n" - -msgid "escaped \"foo\"" -msgid_plural "escaped \"foos\"" -msgstr[0] "escaped \"bar\"" -msgstr[1] "escaped \"bars\"" diff --git a/vendor/symfony/translation/Tests/fixtures/escaped-id.po b/vendor/symfony/translation/Tests/fixtures/escaped-id.po deleted file mode 100644 index 308eadd..0000000 --- a/vendor/symfony/translation/Tests/fixtures/escaped-id.po +++ /dev/null @@ -1,8 +0,0 @@ -msgid "" -msgstr "" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: en\n" - -msgid "escaped \"foo\"" -msgstr "escaped \"bar\"" diff --git a/vendor/symfony/translation/Tests/fixtures/extractor/resource.format.engine b/vendor/symfony/translation/Tests/fixtures/extractor/resource.format.engine deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/symfony/translation/Tests/fixtures/extractor/this.is.a.template.format.engine b/vendor/symfony/translation/Tests/fixtures/extractor/this.is.a.template.format.engine deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/symfony/translation/Tests/fixtures/extractor/translation.html.php b/vendor/symfony/translation/Tests/fixtures/extractor/translation.html.php deleted file mode 100644 index 5085eab..0000000 --- a/vendor/symfony/translation/Tests/fixtures/extractor/translation.html.php +++ /dev/null @@ -1,59 +0,0 @@ -This template is used for translation message extraction tests -<?php echo $view['translator']->trans('single-quoted key'); ?> -<?php echo $view['translator']->trans('double-quoted key'); ?> -<?php echo $view['translator']->trans(<<<EOF -heredoc key -EOF -); ?> -<?php echo $view['translator']->trans(<<<'EOF' -nowdoc key -EOF -); ?> -<?php echo $view['translator']->trans( - "double-quoted key with whitespace and escaped \$\n\" sequences" -); ?> -<?php echo $view['translator']->trans( - 'single-quoted key with whitespace and nonescaped \$\n\' sequences' -); ?> -<?php echo $view['translator']->trans(<<<EOF -heredoc key with whitespace and escaped \$\n sequences -EOF -); ?> -<?php echo $view['translator']->trans(<<<'EOF' -nowdoc key with whitespace and nonescaped \$\n sequences -EOF -); ?> - -<?php echo $view['translator']->trans('single-quoted key with "quote mark at the end"'); ?> - -<?php echo $view['translator']->transChoice( - '{0} There is no apples|{1} There is one apple|]1,Inf[ There are %count% apples', - 10, - ['%count%' => 10] -); ?> - -<?php echo $view['translator']->trans('concatenated'.' message'.<<<EOF - with heredoc -EOF -.<<<'EOF' - and nowdoc -EOF -); ?> - -<?php echo $view['translator']->trans('other-domain-test-no-params-short-array', [], 'not_messages'); ?> - -<?php echo $view['translator']->trans('other-domain-test-no-params-long-array', [], 'not_messages'); ?> - -<?php echo $view['translator']->trans('other-domain-test-params-short-array', ['foo' => 'bar'], 'not_messages'); ?> - -<?php echo $view['translator']->trans('other-domain-test-params-long-array', ['foo' => 'bar'], 'not_messages'); ?> - -<?php echo $view['translator']->transChoice('other-domain-test-trans-choice-short-array-%count%', 10, ['%count%' => 10], 'not_messages'); ?> - -<?php echo $view['translator']->transChoice('other-domain-test-trans-choice-long-array-%count%', 10, ['%count%' => 10], 'not_messages'); ?> - -<?php echo $view['translator']->trans('typecast', ['a' => (int) '123'], 'not_messages'); ?> -<?php echo $view['translator']->transChoice('msg1', 10 + 1, [], 'not_messages'); ?> -<?php echo $view['translator']->transChoice('msg2', ceil(4.5), [], 'not_messages'); ?> - -<?php echo $view['translator']->trans('default domain', [], null); ?> diff --git a/vendor/symfony/translation/Tests/fixtures/fuzzy-translations.po b/vendor/symfony/translation/Tests/fixtures/fuzzy-translations.po deleted file mode 100644 index 04d4047..0000000 --- a/vendor/symfony/translation/Tests/fixtures/fuzzy-translations.po +++ /dev/null @@ -1,10 +0,0 @@ -#, php-format -msgid "foo1" -msgstr "bar1" - -#, fuzzy, php-format -msgid "foo2" -msgstr "fuzzy bar2" - -msgid "foo3" -msgstr "bar3" diff --git a/vendor/symfony/translation/Tests/fixtures/invalid-xml-resources.xlf b/vendor/symfony/translation/Tests/fixtures/invalid-xml-resources.xlf deleted file mode 100644 index 7bf6c98..0000000 --- a/vendor/symfony/translation/Tests/fixtures/invalid-xml-resources.xlf +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2"> - <file source-language="en" datatype="plaintext" original="file.ext"> - <body> - <trans-unit id="1"> - <source>foo</source> - <target>bar - </trans-unit> - <trans-unit id="2"> - <source>extra</source> - </trans-unit> - <trans-unit id="3"> - <source>key</source> - <target></target> - </trans-unit> - <trans-unit id="4"> - <source>test</source> - <target>with</target> - <note>note</note> - </trans-unit> - </body> - </file> -</xliff> diff --git a/vendor/symfony/translation/Tests/fixtures/malformed.json b/vendor/symfony/translation/Tests/fixtures/malformed.json deleted file mode 100644 index 4563ec6..0000000 --- a/vendor/symfony/translation/Tests/fixtures/malformed.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "foo" "bar" -} \ No newline at end of file diff --git a/vendor/symfony/translation/Tests/fixtures/messages.yml b/vendor/symfony/translation/Tests/fixtures/messages.yml deleted file mode 100644 index d4f82d7..0000000 --- a/vendor/symfony/translation/Tests/fixtures/messages.yml +++ /dev/null @@ -1,3 +0,0 @@ -foo: - bar1: value1 - bar2: value2 diff --git a/vendor/symfony/translation/Tests/fixtures/messages_linear.yml b/vendor/symfony/translation/Tests/fixtures/messages_linear.yml deleted file mode 100644 index 6c1687d..0000000 --- a/vendor/symfony/translation/Tests/fixtures/messages_linear.yml +++ /dev/null @@ -1,2 +0,0 @@ -foo.bar1: value1 -foo.bar2: value2 diff --git a/vendor/symfony/translation/Tests/fixtures/missing-plurals.po b/vendor/symfony/translation/Tests/fixtures/missing-plurals.po deleted file mode 100644 index 3b47fca..0000000 --- a/vendor/symfony/translation/Tests/fixtures/missing-plurals.po +++ /dev/null @@ -1,4 +0,0 @@ -msgid "foo" -msgid_plural "foos" -msgstr[3] "bars" -msgstr[1] "bar" diff --git a/vendor/symfony/translation/Tests/fixtures/non-valid.xlf b/vendor/symfony/translation/Tests/fixtures/non-valid.xlf deleted file mode 100644 index 734fc97..0000000 --- a/vendor/symfony/translation/Tests/fixtures/non-valid.xlf +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file source-language="en" datatype="plaintext" original="file.ext"> - <body> - <trans-unit> - <source>foo</source> - <target>bar</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/vendor/symfony/translation/Tests/fixtures/non-valid.yml b/vendor/symfony/translation/Tests/fixtures/non-valid.yml deleted file mode 100644 index 257cc56..0000000 --- a/vendor/symfony/translation/Tests/fixtures/non-valid.yml +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/vendor/symfony/translation/Tests/fixtures/plurals.mo b/vendor/symfony/translation/Tests/fixtures/plurals.mo deleted file mode 100644 index 3945ad95beae6c9ce059cb8d5209c53653c47440..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 448 zcmYL_&rSkC493@giP@uP5A{Hzhe047$dWxF7!rsZvl@?<rQnjKLuLk}5ud=bUVSs4 z#m*3++28c*mu_d$-;=|yNa8>^6|RIMVJP@`5{?BFK$r{hUKD*w_WrkMko+TAzA#5p zh<$%fwf5NPz3~C8!RxhV@?u>p^om_Am{C@(3|6YI&B7+Y%TU_1)q#yn&l%2AXkK*U z%;-54P7NmNfs8FRClF`1x#}81C#AYZN5NBf^iukce`|==soWsj3Y|96G(?`Qa7HR8 zTu40{jC#Ad&3Ys5YIel(+uKs6I(l`N%L+^GK=F*ml1uONzH0CK{P-yu)#E}>N}eUq r9+z%=Qv$^Cqq-p`vw1|OX;M09)m!yu9F5U<woCImEKS6AX`$f{DY|<A diff --git a/vendor/symfony/translation/Tests/fixtures/plurals.po b/vendor/symfony/translation/Tests/fixtures/plurals.po deleted file mode 100644 index 61d1ba4..0000000 --- a/vendor/symfony/translation/Tests/fixtures/plurals.po +++ /dev/null @@ -1,7 +0,0 @@ -msgid "foo" -msgid_plural "foos" -msgstr[0] "bar" -msgstr[1] "bars" - -msgid "{0} no foos|one foo|%count% foos" -msgstr "{0} no bars|one bar|%count% bars" diff --git a/vendor/symfony/translation/Tests/fixtures/resname.xlf b/vendor/symfony/translation/Tests/fixtures/resname.xlf deleted file mode 100644 index 4fa5c00..0000000 --- a/vendor/symfony/translation/Tests/fixtures/resname.xlf +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2"> - <file source-language="en" datatype="plaintext" original="file.ext"> - <body> - <trans-unit id="1" resname="foo"> - <source></source> - <target>bar</target> - </trans-unit> - <trans-unit id="2" resname="bar"> - <source>bar source</source> - <target>baz</target> - </trans-unit> - <trans-unit id="3"> - <source>baz</source> - <target>foo</target> - </trans-unit> - <trans-unit id="4" resname="qux"> - <source>qux source</source> - </trans-unit> - </body> - </file> -</xliff> diff --git a/vendor/symfony/translation/Tests/fixtures/resourcebundle/corrupted/resources.dat b/vendor/symfony/translation/Tests/fixtures/resourcebundle/corrupted/resources.dat deleted file mode 100644 index 391250c..0000000 --- a/vendor/symfony/translation/Tests/fixtures/resourcebundle/corrupted/resources.dat +++ /dev/null @@ -1 +0,0 @@ -XXX \ No newline at end of file diff --git a/vendor/symfony/translation/Tests/fixtures/resourcebundle/dat/en.res b/vendor/symfony/translation/Tests/fixtures/resourcebundle/dat/en.res deleted file mode 100644 index 1fc1436d6641b7290ad5d9f4d331111e4a0419dd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 120 zcmY#jxTP+_00K-5L8-+~j7$s+j4WUQFaeZPU<0x^fmjTR8No6P48@hXY594T3_?JD sFheCnE<+kaK0_XmrNCeW#F-4mKr)@7h#{3Bk)Z^rYSk)61{ttf0N1AuGXMYp diff --git a/vendor/symfony/translation/Tests/fixtures/resourcebundle/dat/en.txt b/vendor/symfony/translation/Tests/fixtures/resourcebundle/dat/en.txt deleted file mode 100644 index 3d9e9ea..0000000 --- a/vendor/symfony/translation/Tests/fixtures/resourcebundle/dat/en.txt +++ /dev/null @@ -1,3 +0,0 @@ -en{ - symfony{"Symfony is great"} -} \ No newline at end of file diff --git a/vendor/symfony/translation/Tests/fixtures/resourcebundle/dat/fr.res b/vendor/symfony/translation/Tests/fixtures/resourcebundle/dat/fr.res deleted file mode 100644 index f58416094be89f5fb64f78f6c3b873c6458696d0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 124 zcmY#jxTP+_00K-5L8-+~j7$s+j4WUQFd@popuh%XaRRY86f=Tl7#NBxbJOzkDj7if wgBdCrav9PX@)`1gECmK5AWmf{W+(yD=?pJ{qL~bd3^_oRt5z{G$biiQ03-qri2wiq diff --git a/vendor/symfony/translation/Tests/fixtures/resourcebundle/dat/fr.txt b/vendor/symfony/translation/Tests/fixtures/resourcebundle/dat/fr.txt deleted file mode 100644 index 182d0a0..0000000 --- a/vendor/symfony/translation/Tests/fixtures/resourcebundle/dat/fr.txt +++ /dev/null @@ -1,3 +0,0 @@ -fr{ - symfony{"Symfony est génial"} -} \ No newline at end of file diff --git a/vendor/symfony/translation/Tests/fixtures/resourcebundle/dat/packagelist.txt b/vendor/symfony/translation/Tests/fixtures/resourcebundle/dat/packagelist.txt deleted file mode 100644 index c5783ed..0000000 --- a/vendor/symfony/translation/Tests/fixtures/resourcebundle/dat/packagelist.txt +++ /dev/null @@ -1,2 +0,0 @@ -en.res -fr.res diff --git a/vendor/symfony/translation/Tests/fixtures/resourcebundle/dat/resources.dat b/vendor/symfony/translation/Tests/fixtures/resourcebundle/dat/resources.dat deleted file mode 100644 index 563b0eaef2e5a0a6e9623bf7b93b44beb0a7dc27..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 352 zcmY#jxTP+_00K-5&bfImj6fDMm=7VCfD}mH0f<$B_y7<Wr55Lx7A2<^>!;@F0Xawl zX+>axRdAqyWPVU;u@fWEKt>jzAy5D`TY(M8<^*CfC<eI!1d1zj)AI8w8H9lBV1`PD zT!u7;e1<$AOM$@%h%*_Afn+*E5ko3NB0~vK)v8sD3^HJ|U=AQ;zbKOZ;y@EX7~Ou5 Y|FPMh3belj?1Gm-S7id-kb~g{0B1ft-T(jq diff --git a/vendor/symfony/translation/Tests/fixtures/resourcebundle/res/en.res b/vendor/symfony/translation/Tests/fixtures/resourcebundle/res/en.res deleted file mode 100644 index ad894a92be2d5392136de413bc2cb5ea8a94bfb1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 84 zcmY#jxTP+_00K-5L8-+~j7$s+j4WUQFu~2hpuh%XaR4zd6f=Tl7#Py>^BI_d>?DRn Nh9V%%$RGn&2LK231)%@{ diff --git a/vendor/symfony/translation/Tests/fixtures/resources-2.0-clean.xlf b/vendor/symfony/translation/Tests/fixtures/resources-2.0-clean.xlf deleted file mode 100644 index 06047dd..0000000 --- a/vendor/symfony/translation/Tests/fixtures/resources-2.0-clean.xlf +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.0" srcLang="fr-FR" trgLang="en-US"> - <file id="messages.en_US"> - <unit id="LCa0a2j"> - <segment> - <source>foo</source> - <target>bar</target> - </segment> - </unit> - <unit id="LHDhK3o"> - <segment> - <source>key</source> - <target order="1"></target> - </segment> - </unit> - <unit id="2DA_bnh"> - <segment> - <source>key.with.cdata</source> - <target><![CDATA[<source> & <target>]]></target> - </segment> - </unit> - </file> -</xliff> diff --git a/vendor/symfony/translation/Tests/fixtures/resources-2.0-multi-segment-unit.xlf b/vendor/symfony/translation/Tests/fixtures/resources-2.0-multi-segment-unit.xlf deleted file mode 100644 index d0dc2a8..0000000 --- a/vendor/symfony/translation/Tests/fixtures/resources-2.0-multi-segment-unit.xlf +++ /dev/null @@ -1,17 +0,0 @@ -<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.0" srcLang="en-US" trgLang="en-US"> - <file id="f1"> - <unit id="1"> - <notes> - <note category="processed">true</note> - </notes> - <segment id="id-foo"> - <source>foo</source> - <target>foo (translated)</target> - </segment> - <segment id="id-bar"> - <source>bar</source> - <target>bar (translated)</target> - </segment> - </unit> - </file> -</xliff> diff --git a/vendor/symfony/translation/Tests/fixtures/resources-2.0.xlf b/vendor/symfony/translation/Tests/fixtures/resources-2.0.xlf deleted file mode 100644 index 166172a..0000000 --- a/vendor/symfony/translation/Tests/fixtures/resources-2.0.xlf +++ /dev/null @@ -1,25 +0,0 @@ -<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.0" srcLang="en-US" trgLang="ja-JP"> - <file id="f1" original="Graphic Example.psd"> - <skeleton href="Graphic Example.psd.skl"/> - <unit id="1"> - <segment> - <source>Quetzal</source> - <target>Quetzal</target> - </segment> - </unit> - <group id="1"> - <unit id="2"> - <segment> - <source>foo</source> - <target>XLIFF 文書を編集、または処理 するアプリケーションです。</target> - </segment> - </unit> - <unit id="3"> - <segment> - <source>bar</source> - <target order="1">XLIFF データ・マネージャ</target> - </segment> - </unit> - </group> - </file> -</xliff> diff --git a/vendor/symfony/translation/Tests/fixtures/resources-clean.xlf b/vendor/symfony/translation/Tests/fixtures/resources-clean.xlf deleted file mode 100644 index 00c8a5c..0000000 --- a/vendor/symfony/translation/Tests/fixtures/resources-clean.xlf +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2"> - <file source-language="fr-FR" target-language="en-US" datatype="plaintext" original="file.ext"> - <header> - <tool tool-id="symfony" tool-name="Symfony"/> - </header> - <body> - <trans-unit id="LCa0a2j" resname="foo"> - <source>foo</source> - <target>bar</target> - <note priority="1" from="bar">baz</note> - </trans-unit> - <trans-unit id="LHDhK3o" resname="key"> - <source>key</source> - <target></target> - <note>baz</note> - <note>qux</note> - </trans-unit> - <trans-unit id="2DA_bnh" resname="key.with.cdata"> - <source>key.with.cdata</source> - <target><![CDATA[<source> & <target>]]></target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/vendor/symfony/translation/Tests/fixtures/resources-notes-meta.xlf b/vendor/symfony/translation/Tests/fixtures/resources-notes-meta.xlf deleted file mode 100644 index e9995fa..0000000 --- a/vendor/symfony/translation/Tests/fixtures/resources-notes-meta.xlf +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.0" srcLang="fr-FR" trgLang="en-US"> - <file id="messages.en_US"> - <unit id="LCa0a2j"> - <notes> - <note category="state">new</note> - <note category="approved">true</note> - <note category="section" priority="1">user login</note> - </notes> - <segment> - <source>foo</source> - <target>bar</target> - </segment> - </unit> - <unit id="uqWglk0"> - <notes> - <note id="x">x_content</note> - <note appliesTo="target" category="quality">Fuzzy</note> - </notes> - <segment> - <source>baz</source> - <target>biz</target> - </segment> - </unit> - </file> -</xliff> diff --git a/vendor/symfony/translation/Tests/fixtures/resources-target-attributes.xlf b/vendor/symfony/translation/Tests/fixtures/resources-target-attributes.xlf deleted file mode 100644 index 700d281..0000000 --- a/vendor/symfony/translation/Tests/fixtures/resources-target-attributes.xlf +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2"> - <file source-language="fr-FR" target-language="en-US" datatype="plaintext" original="file.ext"> - <header> - <tool tool-id="symfony" tool-name="Symfony"/> - </header> - <body> - <trans-unit id="LCa0a2j" resname="foo"> - <source>foo</source> - <target state="needs-translation">bar</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/vendor/symfony/translation/Tests/fixtures/resources-tool-info.xlf b/vendor/symfony/translation/Tests/fixtures/resources-tool-info.xlf deleted file mode 100644 index 1c2ae95..0000000 --- a/vendor/symfony/translation/Tests/fixtures/resources-tool-info.xlf +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2"> - <file source-language="en-US" target-language="en-US" datatype="plaintext" original="file.ext"> - <header> - <tool tool-id="foo" tool-name="foo" tool-version="0.0" tool-company="Foo"/> - </header> - <body> - <trans-unit id="LCa0a2j" resname="foo"> - <source>foo</source> - <target>bar</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/vendor/symfony/translation/Tests/fixtures/resources.csv b/vendor/symfony/translation/Tests/fixtures/resources.csv deleted file mode 100644 index 374b9eb..0000000 --- a/vendor/symfony/translation/Tests/fixtures/resources.csv +++ /dev/null @@ -1,4 +0,0 @@ -"foo"; "bar" -#"bar"; "foo" -"incorrect"; "number"; "columns"; "will"; "be"; "ignored" -"incorrect" \ No newline at end of file diff --git a/vendor/symfony/translation/Tests/fixtures/resources.dump.json b/vendor/symfony/translation/Tests/fixtures/resources.dump.json deleted file mode 100644 index 335965d..0000000 --- a/vendor/symfony/translation/Tests/fixtures/resources.dump.json +++ /dev/null @@ -1 +0,0 @@ -{"foo":"\u0022bar\u0022"} \ No newline at end of file diff --git a/vendor/symfony/translation/Tests/fixtures/resources.ini b/vendor/symfony/translation/Tests/fixtures/resources.ini deleted file mode 100644 index 4953062..0000000 --- a/vendor/symfony/translation/Tests/fixtures/resources.ini +++ /dev/null @@ -1 +0,0 @@ -foo="bar" diff --git a/vendor/symfony/translation/Tests/fixtures/resources.json b/vendor/symfony/translation/Tests/fixtures/resources.json deleted file mode 100644 index 8a79687..0000000 --- a/vendor/symfony/translation/Tests/fixtures/resources.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "foo": "bar" -} \ No newline at end of file diff --git a/vendor/symfony/translation/Tests/fixtures/resources.mo b/vendor/symfony/translation/Tests/fixtures/resources.mo deleted file mode 100644 index 0a9660257c07afef243a011d9806d6217e4f1379..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 52 pcmca7#4?ou2pEA_28dNa93apEVrC%Lh0=yVnjtMepCKu+2mox%1k?Zk diff --git a/vendor/symfony/translation/Tests/fixtures/resources.php b/vendor/symfony/translation/Tests/fixtures/resources.php deleted file mode 100644 index c291398..0000000 --- a/vendor/symfony/translation/Tests/fixtures/resources.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php - -return array ( - 'foo' => 'bar', -); diff --git a/vendor/symfony/translation/Tests/fixtures/resources.po b/vendor/symfony/translation/Tests/fixtures/resources.po deleted file mode 100644 index a20e619..0000000 --- a/vendor/symfony/translation/Tests/fixtures/resources.po +++ /dev/null @@ -1,11 +0,0 @@ -msgid "" -msgstr "" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: en\n" - -msgid "foo" -msgstr "bar" - -msgid "bar" -msgstr "foo" diff --git a/vendor/symfony/translation/Tests/fixtures/resources.ts b/vendor/symfony/translation/Tests/fixtures/resources.ts deleted file mode 100644 index 40e1852..0000000 --- a/vendor/symfony/translation/Tests/fixtures/resources.ts +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<TS> - <context> - <name>resources</name> - <message> - <source>foo</source> - <translation>bar</translation> - </message> - </context> -</TS> diff --git a/vendor/symfony/translation/Tests/fixtures/resources.xlf b/vendor/symfony/translation/Tests/fixtures/resources.xlf deleted file mode 100644 index b0e5988..0000000 --- a/vendor/symfony/translation/Tests/fixtures/resources.xlf +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2"> - <file source-language="en" datatype="plaintext" original="file.ext"> - <body> - <trans-unit id="1"> - <source>foo</source> - <target>bar</target> - </trans-unit> - <trans-unit id="2"> - <source>extra</source> - </trans-unit> - <trans-unit id="3"> - <source>key</source> - <target></target> - </trans-unit> - <trans-unit id="4"> - <source>test</source> - <target>with</target> - <note>note</note> - </trans-unit> - </body> - </file> -</xliff> diff --git a/vendor/symfony/translation/Tests/fixtures/resources.yml b/vendor/symfony/translation/Tests/fixtures/resources.yml deleted file mode 100644 index 20e9ff3..0000000 --- a/vendor/symfony/translation/Tests/fixtures/resources.yml +++ /dev/null @@ -1 +0,0 @@ -foo: bar diff --git a/vendor/symfony/translation/Tests/fixtures/valid.csv b/vendor/symfony/translation/Tests/fixtures/valid.csv deleted file mode 100644 index 59882e5..0000000 --- a/vendor/symfony/translation/Tests/fixtures/valid.csv +++ /dev/null @@ -1,4 +0,0 @@ -foo;bar -bar;"foo -foo" -"foo;foo";bar diff --git a/vendor/symfony/translation/Tests/fixtures/with-attributes.xlf b/vendor/symfony/translation/Tests/fixtures/with-attributes.xlf deleted file mode 100644 index 7873062..0000000 --- a/vendor/symfony/translation/Tests/fixtures/with-attributes.xlf +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2"> - <file source-language="en" datatype="plaintext" original="file.ext"> - <body> - <trans-unit id="1"> - <source>foo</source> - <target state="translated">bar</target> - </trans-unit> - <trans-unit id="2"> - <source>extra</source> - <target state="needs-translation">bar</target> - </trans-unit> - <trans-unit id="3"> - <source>key</source> - <target></target> - <note>baz</note> - <note priority="2" from="bar">qux</note> - </trans-unit> - </body> - </file> -</xliff> diff --git a/vendor/symfony/translation/Tests/fixtures/withdoctype.xlf b/vendor/symfony/translation/Tests/fixtures/withdoctype.xlf deleted file mode 100644 index f83e834..0000000 --- a/vendor/symfony/translation/Tests/fixtures/withdoctype.xlf +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0"?> -<!DOCTYPE foo> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file source-language="en" datatype="plaintext" original="file.ext"> - <body> - <trans-unit id="1"> - <source>foo</source> - <target>bar</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/vendor/symfony/translation/Tests/fixtures/withnote.xlf b/vendor/symfony/translation/Tests/fixtures/withnote.xlf deleted file mode 100644 index c045e21..0000000 --- a/vendor/symfony/translation/Tests/fixtures/withnote.xlf +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2"> - <file source-language="en" datatype="plaintext" original="file.ext"> - <body> - <trans-unit id="1"> - <source>foo</source> - <target>bar</target> - <note priority="1">foo</note> - </trans-unit> - <trans-unit id="2"> - <source>extra</source> - <note from="foo">bar</note> - </trans-unit> - <trans-unit id="123"> - <source>key</source> - <target></target> - <note>baz</note> - <note priority="2" from="bar">qux</note> - </trans-unit> - </body> - </file> -</xliff> diff --git a/vendor/symfony/translation/Translator.php b/vendor/symfony/translation/Translator.php index e72d20a..9876051 100644 --- a/vendor/symfony/translation/Translator.php +++ b/vendor/symfony/translation/Translator.php @@ -19,14 +19,17 @@ use Symfony\Component\Translation\Exception\LogicException; use Symfony\Component\Translation\Exception\NotFoundResourceException; use Symfony\Component\Translation\Exception\RuntimeException; use Symfony\Component\Translation\Formatter\ChoiceMessageFormatterInterface; +use Symfony\Component\Translation\Formatter\IntlFormatterInterface; use Symfony\Component\Translation\Formatter\MessageFormatter; use Symfony\Component\Translation\Formatter\MessageFormatterInterface; use Symfony\Component\Translation\Loader\LoaderInterface; +use Symfony\Component\Translation\TranslatorInterface as LegacyTranslatorInterface; +use Symfony\Contracts\Translation\TranslatorInterface; /** * @author Fabien Potencier <fabien@symfony.com> */ -class Translator implements TranslatorInterface, TranslatorBagInterface +class Translator implements LegacyTranslatorInterface, TranslatorInterface, TranslatorBagInterface { /** * @var MessageCatalogueInterface[] @@ -68,33 +71,40 @@ class Translator implements TranslatorInterface, TranslatorBagInterface */ private $debug; + private $cacheVary; + /** * @var ConfigCacheFactoryInterface|null */ private $configCacheFactory; /** - * @param string $locale The locale - * @param MessageFormatterInterface|null $formatter The message formatter - * @param string|null $cacheDir The directory to use for the cache - * @param bool $debug Use cache in debug mode ? - * + * @var array|null + */ + private $parentLocales; + + private $hasIntlFormatter; + + /** * @throws InvalidArgumentException If a locale contains invalid characters */ - public function __construct($locale, $formatter = null, $cacheDir = null, $debug = false) + public function __construct(?string $locale, MessageFormatterInterface $formatter = null, string $cacheDir = null, bool $debug = false, array $cacheVary = []) { - $this->setLocale($locale); + if (null === $locale) { + @trigger_error(sprintf('Passing "null" as the $locale argument to %s() is deprecated since Symfony 4.4.', __METHOD__), E_USER_DEPRECATED); + } - if ($formatter instanceof MessageSelector) { - $formatter = new MessageFormatter($formatter); - @trigger_error(sprintf('Passing a "%s" instance into the "%s()" method as a second argument is deprecated since Symfony 3.4 and will be removed in 4.0. Inject a "%s" implementation instead.', MessageSelector::class, __METHOD__, MessageFormatterInterface::class), E_USER_DEPRECATED); - } elseif (null === $formatter) { + $this->setLocale($locale, false); + + if (null === $formatter) { $formatter = new MessageFormatter(); } $this->formatter = $formatter; $this->cacheDir = $cacheDir; $this->debug = $debug; + $this->cacheVary = $cacheVary; + $this->hasIntlFormatter = $formatter instanceof IntlFormatterInterface; } public function setConfigCacheFactory(ConfigCacheFactoryInterface $configCacheFactory) @@ -105,8 +115,7 @@ class Translator implements TranslatorInterface, TranslatorBagInterface /** * Adds a Loader. * - * @param string $format The name of the loader (@see addResource()) - * @param LoaderInterface $loader A LoaderInterface instance + * @param string $format The name of the loader (@see addResource()) */ public function addLoader($format, LoaderInterface $loader) { @@ -129,6 +138,10 @@ class Translator implements TranslatorInterface, TranslatorBagInterface $domain = 'messages'; } + if (null === $locale) { + @trigger_error(sprintf('Passing "null" to the third argument of the "%s" method has been deprecated since Symfony 4.4 and will throw an error in 5.0.', __METHOD__), E_USER_DEPRECATED); + } + $this->assertValidLocale($locale); $this->resources[$locale][] = [$format, $resource, $domain]; @@ -145,6 +158,10 @@ class Translator implements TranslatorInterface, TranslatorBagInterface */ public function setLocale($locale) { + if (null === $locale && (2 > \func_num_args() || func_get_arg(1))) { + @trigger_error(sprintf('Passing "null" as the $locale argument to %s() is deprecated since Symfony 4.4.', __METHOD__), E_USER_DEPRECATED); + } + $this->assertValidLocale($locale); $this->locale = $locale; } @@ -170,15 +187,20 @@ class Translator implements TranslatorInterface, TranslatorBagInterface $this->catalogues = []; foreach ($locales as $locale) { + if (null === $locale) { + @trigger_error(sprintf('Passing "null" as the $locale argument to %s() is deprecated since Symfony 4.4.', __METHOD__), E_USER_DEPRECATED); + } $this->assertValidLocale($locale); } - $this->fallbackLocales = $locales; + $this->fallbackLocales = $this->cacheVary['fallback_locales'] = $locales; } /** * Gets the fallback locales. * + * @internal since Symfony 4.2 + * * @return array The fallback locales */ public function getFallbackLocales() @@ -191,18 +213,45 @@ class Translator implements TranslatorInterface, TranslatorBagInterface */ public function trans($id, array $parameters = [], $domain = null, $locale = null) { + if ('' === $id = (string) $id) { + return ''; + } + if (null === $domain) { $domain = 'messages'; } - return $this->formatter->format($this->getCatalogue($locale)->get((string) $id, $domain), $locale, $parameters); + $catalogue = $this->getCatalogue($locale); + $locale = $catalogue->getLocale(); + while (!$catalogue->defines($id, $domain)) { + if ($cat = $catalogue->getFallbackCatalogue()) { + $catalogue = $cat; + $locale = $catalogue->getLocale(); + } else { + break; + } + } + + if ($this->hasIntlFormatter && $catalogue->defines($id, $domain.MessageCatalogue::INTL_DOMAIN_SUFFIX)) { + return $this->formatter->formatIntl($catalogue->get($id, $domain), $locale, $parameters); + } + + return $this->formatter->format($catalogue->get($id, $domain), $locale, $parameters); } /** * {@inheritdoc} + * + * @deprecated since Symfony 4.2, use the trans() method instead with a %count% parameter */ public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null) { + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the trans() one instead with a "%%count%%" parameter.', __METHOD__), E_USER_DEPRECATED); + + if ('' === $id = (string) $id) { + return ''; + } + if (!$this->formatter instanceof ChoiceMessageFormatterInterface) { throw new LogicException(sprintf('The formatter "%s" does not support plural translations.', \get_class($this->formatter))); } @@ -211,7 +260,6 @@ class Translator implements TranslatorInterface, TranslatorBagInterface $domain = 'messages'; } - $id = (string) $id; $catalogue = $this->getCatalogue($locale); $locale = $catalogue->getLocale(); while (!$catalogue->defines($id, $domain)) { @@ -223,6 +271,10 @@ class Translator implements TranslatorInterface, TranslatorBagInterface } } + if ($this->hasIntlFormatter && $catalogue->defines($id, $domain.MessageCatalogue::INTL_DOMAIN_SUFFIX)) { + return $this->formatter->formatIntl($catalogue->get($id, $domain), $locale, ['%count%' => $number] + $parameters); + } + return $this->formatter->choiceFormat($catalogue->get($id, $domain), $number, $locale, $parameters); } @@ -283,10 +335,7 @@ class Translator implements TranslatorInterface, TranslatorBagInterface $this->loadFallbackCatalogues($locale); } - /** - * @param string $locale - */ - private function initializeCacheCatalogue($locale) + private function initializeCacheCatalogue(string $locale): void { if (isset($this->catalogues[$locale])) { /* Catalogue already initialized. */ @@ -309,7 +358,7 @@ class Translator implements TranslatorInterface, TranslatorBagInterface $this->catalogues[$locale] = include $cache->getPath(); } - private function dumpCatalogue($locale, ConfigCacheInterface $cache) + private function dumpCatalogue(string $locale, ConfigCacheInterface $cache): void { $this->initializeCatalogue($locale); $fallbackContent = $this->getFallbackContent($this->catalogues[$locale]); @@ -327,14 +376,14 @@ return \$catalogue; EOF , $locale, - var_export($this->catalogues[$locale]->all(), true), + var_export($this->getAllMessages($this->catalogues[$locale]), true), $fallbackContent ); $cache->write($content, $this->catalogues[$locale]->getResources()); } - private function getFallbackContent(MessageCatalogue $catalogue) + private function getFallbackContent(MessageCatalogue $catalogue): string { $fallbackContent = ''; $current = ''; @@ -353,7 +402,7 @@ EOF , $fallbackSuffix, $fallback, - var_export($fallbackCatalogue->all(), true), + var_export($this->getAllMessages($fallbackCatalogue), true), $currentSuffix, $fallbackSuffix ); @@ -364,12 +413,15 @@ EOF return $fallbackContent; } - private function getCatalogueCachePath($locale) + private function getCatalogueCachePath(string $locale): string { - return $this->cacheDir.'/catalogue.'.$locale.'.'.strtr(substr(base64_encode(hash('sha256', serialize($this->fallbackLocales), true)), 0, 7), '/', '_').'.php'; + return $this->cacheDir.'/catalogue.'.$locale.'.'.strtr(substr(base64_encode(hash('sha256', serialize($this->cacheVary), true)), 0, 7), '/', '_').'.php'; } - private function doLoadCatalogue($locale) + /** + * @internal + */ + protected function doLoadCatalogue(string $locale): void { $this->catalogues[$locale] = new MessageCatalogue($locale); @@ -383,7 +435,7 @@ EOF } } - private function loadFallbackCatalogues($locale) + private function loadFallbackCatalogues(string $locale): void { $current = $this->catalogues[$locale]; @@ -392,7 +444,7 @@ EOF $this->initializeCatalogue($fallback); } - $fallbackCatalogue = new MessageCatalogue($fallback, $this->catalogues[$fallback]->all()); + $fallbackCatalogue = new MessageCatalogue($fallback, $this->getAllMessages($this->catalogues[$fallback])); foreach ($this->catalogues[$fallback]->getResources() as $resource) { $fallbackCatalogue->addResource($resource); } @@ -403,6 +455,10 @@ EOF protected function computeFallbackLocales($locale) { + if (null === $this->parentLocales) { + $parentLocales = json_decode(file_get_contents(__DIR__.'/Resources/data/parents.json'), true); + } + $locales = []; foreach ($this->fallbackLocales as $fallback) { if ($fallback === $locale) { @@ -412,8 +468,27 @@ EOF $locales[] = $fallback; } - if (false !== strrchr($locale, '_')) { - array_unshift($locales, substr($locale, 0, -\strlen(strrchr($locale, '_')))); + while ($locale) { + $parent = $parentLocales[$locale] ?? null; + + if ($parent) { + $locale = 'root' !== $parent ? $parent : null; + } elseif (\function_exists('locale_parse')) { + $localeSubTags = locale_parse($locale); + $locale = null; + if (1 < \count($localeSubTags)) { + array_pop($localeSubTags); + $locale = locale_compose($localeSubTags) ?: null; + } + } elseif ($i = strrpos($locale, '_') ?: strrpos($locale, '-')) { + $locale = substr($locale, 0, $i); + } else { + $locale = null; + } + + if (null !== $locale) { + array_unshift($locales, $locale); + } } return array_unique($locales); @@ -436,10 +511,8 @@ EOF /** * Provides the ConfigCache factory implementation, falling back to a * default implementation if necessary. - * - * @return ConfigCacheFactoryInterface $configCacheFactory */ - private function getConfigCacheFactory() + private function getConfigCacheFactory(): ConfigCacheFactoryInterface { if (!$this->configCacheFactory) { $this->configCacheFactory = new ConfigCacheFactory($this->debug); @@ -447,4 +520,21 @@ EOF return $this->configCacheFactory; } + + private function getAllMessages(MessageCatalogueInterface $catalogue): array + { + $allMessages = []; + + foreach ($catalogue->all() as $domain => $messages) { + if ($intlMessages = $catalogue->all($domain.MessageCatalogue::INTL_DOMAIN_SUFFIX)) { + $allMessages[$domain.MessageCatalogue::INTL_DOMAIN_SUFFIX] = $intlMessages; + $messages = array_diff_key($messages, $intlMessages); + } + if ($messages) { + $allMessages[$domain] = $messages; + } + } + + return $allMessages; + } } diff --git a/vendor/symfony/translation/TranslatorInterface.php b/vendor/symfony/translation/TranslatorInterface.php index 4fbaedb..f677d24 100644 --- a/vendor/symfony/translation/TranslatorInterface.php +++ b/vendor/symfony/translation/TranslatorInterface.php @@ -12,13 +12,16 @@ namespace Symfony\Component\Translation; use Symfony\Component\Translation\Exception\InvalidArgumentException; +use Symfony\Contracts\Translation\LocaleAwareInterface; /** * TranslatorInterface. * * @author Fabien Potencier <fabien@symfony.com> + * + * @deprecated since Symfony 4.2, use Symfony\Contracts\Translation\TranslatorInterface instead */ -interface TranslatorInterface +interface TranslatorInterface extends LocaleAwareInterface { /** * Translates the given message. diff --git a/vendor/symfony/translation/Writer/TranslationWriter.php b/vendor/symfony/translation/Writer/TranslationWriter.php index aad6aad..d402443 100644 --- a/vendor/symfony/translation/Writer/TranslationWriter.php +++ b/vendor/symfony/translation/Writer/TranslationWriter.php @@ -28,8 +28,7 @@ class TranslationWriter implements TranslationWriterInterface /** * Adds a dumper to the writer. * - * @param string $format The format of the dumper - * @param DumperInterface $dumper The dumper + * @param string $format The format of the dumper */ public function addDumper($format, DumperInterface $dumper) { @@ -38,9 +37,13 @@ class TranslationWriter implements TranslationWriterInterface /** * Disables dumper backup. + * + * @deprecated since Symfony 4.1 */ public function disableBackup() { + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1.', __METHOD__), E_USER_DEPRECATED); + foreach ($this->dumpers as $dumper) { if (method_exists($dumper, 'setBackup')) { $dumper->setBackup(false); @@ -61,9 +64,8 @@ class TranslationWriter implements TranslationWriterInterface /** * Writes translation from the catalogue according to the selected format. * - * @param MessageCatalogue $catalogue The message catalogue to write - * @param string $format The format to use to dump the messages - * @param array $options Options that are passed to the dumper + * @param string $format The format to use to dump the messages + * @param array $options Options that are passed to the dumper * * @throws InvalidArgumentException */ @@ -83,21 +85,4 @@ class TranslationWriter implements TranslationWriterInterface // save $dumper->dump($catalogue, $options); } - - /** - * Writes translation from the catalogue according to the selected format. - * - * @param MessageCatalogue $catalogue The message catalogue to write - * @param string $format The format to use to dump the messages - * @param array $options Options that are passed to the dumper - * - * @throws InvalidArgumentException - * - * @deprecated since 3.4 will be removed in 4.0. Use write instead. - */ - public function writeTranslations(MessageCatalogue $catalogue, $format, $options = []) - { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0. Use write() instead.', __METHOD__), E_USER_DEPRECATED); - $this->write($catalogue, $format, $options); - } } diff --git a/vendor/symfony/translation/Writer/TranslationWriterInterface.php b/vendor/symfony/translation/Writer/TranslationWriterInterface.php index b07c08e..f7c56be 100644 --- a/vendor/symfony/translation/Writer/TranslationWriterInterface.php +++ b/vendor/symfony/translation/Writer/TranslationWriterInterface.php @@ -24,9 +24,8 @@ interface TranslationWriterInterface /** * Writes translation from the catalogue according to the selected format. * - * @param MessageCatalogue $catalogue The message catalogue to write - * @param string $format The format to use to dump the messages - * @param array $options Options that are passed to the dumper + * @param string $format The format to use to dump the messages + * @param array $options Options that are passed to the dumper * * @throws InvalidArgumentException */ diff --git a/vendor/symfony/translation/composer.json b/vendor/symfony/translation/composer.json index 93c1236..5b01b6d 100644 --- a/vendor/symfony/translation/composer.json +++ b/vendor/symfony/translation/composer.json @@ -16,24 +16,30 @@ } ], "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-mbstring": "~1.0" + "php": "^7.1.3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/translation-contracts": "^1.1.6|^2" }, "require-dev": { - "symfony/config": "~2.8|~3.0|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/http-kernel": "~3.4|~4.0", - "symfony/intl": "^2.8.18|^3.2.5|~4.0", - "symfony/var-dumper": "~3.4|~4.0", - "symfony/yaml": "~3.4|~4.0", - "symfony/finder": "~2.8|~3.0|~4.0", + "symfony/config": "^3.4|^4.0|^5.0", + "symfony/console": "^3.4|^4.0|^5.0", + "symfony/dependency-injection": "^3.4|^4.0|^5.0", + "symfony/http-kernel": "^4.4", + "symfony/intl": "^3.4|^4.0|^5.0", + "symfony/service-contracts": "^1.1.2|^2", + "symfony/yaml": "^3.4|^4.0|^5.0", + "symfony/finder": "~2.8|~3.0|~4.0|^5.0", "psr/log": "~1.0" }, "conflict": { - "symfony/config": "<2.8", + "symfony/config": "<3.4", "symfony/dependency-injection": "<3.4", + "symfony/http-kernel": "<4.4", "symfony/yaml": "<3.4" }, + "provide": { + "symfony/translation-implementation": "1.0" + }, "suggest": { "symfony/config": "", "symfony/yaml": "", @@ -48,7 +54,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.4-dev" } } } diff --git a/vendor/symfony/translation/phpunit.xml.dist b/vendor/symfony/translation/phpunit.xml.dist deleted file mode 100644 index 21d3246..0000000 --- a/vendor/symfony/translation/phpunit.xml.dist +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd" - backupGlobals="false" - colors="true" - bootstrap="vendor/autoload.php" - failOnRisky="true" - failOnWarning="true" -> - <php> - <ini name="error_reporting" value="-1" /> - </php> - - <testsuites> - <testsuite name="Symfony Translation Component Test Suite"> - <directory>./Tests/</directory> - </testsuite> - </testsuites> - - <filter> - <whitelist> - <directory>./</directory> - <exclude> - <directory>./Tests</directory> - <directory>./vendor</directory> - </exclude> - </whitelist> - </filter> -</phpunit> -- GitLab