diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2017-06-09 11:42:04 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2017-06-09 11:42:09 +0200 |
commit | 80e49ba7b0320a5c4278c01f3d7851a9218e0919 (patch) | |
tree | 8e4c19b2ce46908b2409485a2f77f2a6c2d2fd62 | |
parent | 42f3bb2c6346e04d2837f980bf685f7e32a61a21 (diff) | |
download | wallabag-80e49ba7b0320a5c4278c01f3d7851a9218e0919.tar.gz wallabag-80e49ba7b0320a5c4278c01f3d7851a9218e0919.tar.zst wallabag-80e49ba7b0320a5c4278c01f3d7851a9218e0919.zip |
Convert - to _ in language
Mostly to increase language supports
3 files changed, 13 insertions, 5 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php index e4e7fb31..0c971863 100644 --- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php +++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php | |||
@@ -174,6 +174,10 @@ class ContentProxy | |||
174 | */ | 174 | */ |
175 | private function validateAndSetLanguage($entry, $value) | 175 | private function validateAndSetLanguage($entry, $value) |
176 | { | 176 | { |
177 | // some lang are defined as fr-FR, es-ES. | ||
178 | // replacing - by _ might increase language support | ||
179 | $value = str_replace('-', '_', $value); | ||
180 | |||
177 | $errors = $this->validator->validate( | 181 | $errors = $this->validator->validate( |
178 | $value, | 182 | $value, |
179 | (new LocaleConstraint()) | 183 | (new LocaleConstraint()) |
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index b77e5ec1..84faf8d4 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php | |||
@@ -1252,9 +1252,9 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
1252 | 'https://www.pravda.ru/world/09-06-2017/1337283-qatar-0/', | 1252 | 'https://www.pravda.ru/world/09-06-2017/1337283-qatar-0/', |
1253 | 'ru', | 1253 | 'ru', |
1254 | ], | 1254 | ], |
1255 | 'wrong fr-FR' => [ | 1255 | 'fr-FR' => [ |
1256 | 'http://www.zataz.com/fff-darknet/axzz4jUg2QJjH', | 1256 | 'http://www.zataz.com/90-des-dossiers-medicaux-des-coreens-du-sud-vendus-a-des-entreprises-privees/', |
1257 | '', | 1257 | 'fr_FR', |
1258 | ], | 1258 | ], |
1259 | 'de' => [ | 1259 | 'de' => [ |
1260 | 'http://www.bild.de/politik/ausland/theresa-may/wahlbeben-grossbritannien-analyse-52108924.bild.html', | 1260 | 'http://www.bild.de/politik/ausland/theresa-may/wahlbeben-grossbritannien-analyse-52108924.bild.html', |
@@ -1280,10 +1280,14 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
1280 | 'http://precodoscombustiveis.com.br/postos/cidade/4121/pr/maringa', | 1280 | 'http://precodoscombustiveis.com.br/postos/cidade/4121/pr/maringa', |
1281 | 'pt_BR', | 1281 | 'pt_BR', |
1282 | ], | 1282 | ], |
1283 | 'fucked list of languages' => [ | 1283 | 'fucked_list_of_languages' => [ |
1284 | 'http://geocatalog.webservice-energy.org/geonetwork/srv/eng/main.home', | 1284 | 'http://geocatalog.webservice-energy.org/geonetwork/srv/eng/main.home', |
1285 | '', | 1285 | '', |
1286 | ], | 1286 | ], |
1287 | 'es-ES' => [ | ||
1288 | 'http://www.muylinux.com/2015/04/17/odf-reino-unido-microsoft-google', | ||
1289 | 'es_ES', | ||
1290 | ], | ||
1287 | ]; | 1291 | ]; |
1288 | } | 1292 | } |
1289 | 1293 | ||
diff --git a/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php index 01decb23..bde0a600 100644 --- a/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php | |||
@@ -120,7 +120,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase | |||
120 | 120 | ||
121 | $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.zataz.com is ok'); | 121 | $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.zataz.com is ok'); |
122 | $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.zataz.com is ok'); | 122 | $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.zataz.com is ok'); |
123 | $this->assertEmpty($content->getLanguage(), 'Language for http://www.zataz.com is empty because not valid (fr-FR)'); | 123 | $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.zataz.com is ok'); |
124 | 124 | ||
125 | $tags = $content->getTags(); | 125 | $tags = $content->getTags(); |
126 | $this->assertContains('foot', $tags, 'It includes the "foot" tag'); | 126 | $this->assertContains('foot', $tags, 'It includes the "foot" tag'); |