1
0
mirror of https://github.com/flarum/core.git synced 2025-07-20 08:11:27 +02:00

Use more precise regex to prevent some translations being compiled unnecessarily

This commit is contained in:
Toby Zerner
2016-03-29 17:31:13 +10:30
parent ebde47fe3b
commit 36cf744e2a
3 changed files with 3 additions and 5 deletions

View File

@@ -32,7 +32,7 @@ class ClientController extends BaseClientController
/**
* {@inheritdoc}
*/
protected $translations = '/[^\.]\.(admin|lib)\.*+/';
protected $translations = '/^[^\.]+\.(?:admin|lib)\./';
/**
* @var ExtensionManager

View File

@@ -29,7 +29,7 @@ class ClientController extends AbstractClientController
/**
* {@inheritdoc}
*/
protected $translations = '/[^\.]\.(forum|lib)\.*+/';
protected $translations = '/^[^\.]+\.(?:forum|lib)\./';
/**
* @var Formatter

View File

@@ -308,9 +308,7 @@ abstract class AbstractClientController extends AbstractHtmlController
}
$filtered = array_filter(array_keys($translations), function ($id) {
if (preg_match($this->translations, $id)) {
return true;
}
return preg_match($this->translations, $id);
});
return array_only($translations, $filtered);