Size: a a a

2020 July 18

T

TradersVE in Yii Framework 3
Work only setDefaultLocale()
источник

T

TradersVE in Yii Framework 3
and it should work without any default settings it should be english.
источник

АН

Александр Некрасов... in Yii Framework 3
TradersVE
and it should work without any default settings it should be english.
it does not find the translation in 'en-US', and tries to get from defaultLocale
источник

T

TradersVE in Yii Framework 3
umm
источник

T

TradersVE in Yii Framework 3
if you don't have a translation you shouldn't throw any exceptions.
источник

T

TradersVE in Yii Framework 3
for example my app is in english, and by default this is setting the translatorinterface will throw error.
источник

АН

Александр Некрасов... in Yii Framework 3
for example, if I have a Russian version by default, where the translation is 100%, and there is another language, where 50%, and if I only use setLocale, then 50% of the site will not be translated, and so I set setDefaultLocale to Russian and then already you can use setLocale Kazakh or another language, and which does not have a translation, it will be displayed in Russian
источник

АН

Александр Некрасов... in Yii Framework 3
when configuring, you need to use setDefaultLocale, in applications you need to use setLocale
источник

T

TradersVE in Yii Framework 3
You don't understand me, for example if I configure TranslatorInterface and I don't have any translations because the Validator is going to throw an exception it doesn't make sense to me, so I have configured it.
источник

T

TradersVE in Yii Framework 3
It is like configuring the logger and if I don't use it it will throw an exception.
источник

АН

Александр Некрасов... in Yii Framework 3
$container->set(
           TranslatorInterface::class,
           function (ContainerInterface $container) {
               $translator = new Translator(
                   $container->get(EventDispatcherInterface::class),
                   new MessageTranslator([]),
                   null
               );

               $translator->setDefaultLocale('en-US');

               return $translator;
           }
       );
and when you need to change to another language in middleware or controller or somewhere else, use setLocale
источник

АН

Александр Некрасов... in Yii Framework 3
TradersVE
You don't understand me, for example if I configure TranslatorInterface and I don't have any translations because the Validator is going to throw an exception it doesn't make sense to me, so I have configured it.
maybe I don't understand the essence of the problem, you are not using a translator, but it throws an error?
источник

T

TradersVE in Yii Framework 3
Александр Некрасов
maybe I don't understand the essence of the problem, you are not using a translator, but it throws an error?
yes
источник

T

TradersVE in Yii Framework 3
setting translatorinterface and validator throw error
источник

АН

Александр Некрасов... in Yii Framework 3
if you pass the translator to ValidateFactory, then it will try to translate and take defaultLocale if the locale is not set or there is no translation for it, since defaultLocale is not valid, it throws an exception, it is strange why the system Locale returns an invalid locale, or the regexp  is not correct...
источник

T

TradersVE in Yii Framework 3
Александр Некрасов
if you pass the translator to ValidateFactory, then it will try to translate and take defaultLocale if the locale is not set or there is no translation for it, since defaultLocale is not valid, it throws an exception, it is strange why the system Locale returns an invalid locale, or the regexp  is not correct...
I think it should be reviewed
источник

АН

Александр Некрасов... in Yii Framework 3
TradersVE
I think it should be reviewed
what exactly ?, the logic of the translator?
источник

T

TradersVE in Yii Framework 3
Александр Некрасов
what exactly ?, the logic of the translator?
If the locale part, more evidence should be added when no locale exists.
источник

T

TradersVE in Yii Framework 3
Because if I don't configure any, it takes the one from the machine.
источник

T

TradersVE in Yii Framework 3
And I think it should be English by default.
источник