[I18N] Refactor since rfc/use-static-function is not implemented

As the above mentioned RFC is not implemented, `_m` needs to be
outside of the I18n class, otherwise it would have to always be called
with `I18n::_m`.
This commit is contained in:
Hugo Sales
2020-06-04 21:53:34 +00:00
committed by Hugo Sales
parent 186b9e7683
commit f283613443
5 changed files with 136 additions and 98 deletions

View File

@@ -33,7 +33,7 @@ namespace App\Controller;
// use App\Core\GSEvent as Event;
// use App\Util\Common;
use App\Core\DB\DefaultSettings;
use App\Core\I18n;
use function App\Core\I18n\_m;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
@@ -48,14 +48,14 @@ class AdminConfigController extends AbstractController
foreach (DefaultSettings::$defaults as $key => $inner) {
$options[$key] = [];
foreach (array_keys($inner) as $inner_key) {
$options[I18n::_m($key)][I18n::_m($inner_key)] = "{$key}:{$inner_key}";
$options[_m($key)][_m($inner_key)] = "{$key}:{$inner_key}";
}
}
$form = $this->createFormBuilder()
->add(I18n::_m('Setting'), ChoiceType::class, ['choices' => $options])
->add(I18n::_m('Value'), TextType::class)
->add('save', SubmitType::class, ['label' => I18n::_m('Set site setting')])
$form = $this->createFormBuilder(null, ['translation_domain' => false])
->add(_m('Setting'), ChoiceType::class, ['choices' => $options])
->add(_m('Value'), TextType::class)
->add('save', SubmitType::class, ['label' => _m('Set site setting')])
->getForm();
$form->handleRequest($request);