cakephp / localized

I18n and L10n related CakePHP code
Other
214 stars 179 forks source link

Can't install localized plugin on CakePHP 4.0.3 #193

Closed MiquelRoan closed 4 years ago

MiquelRoan commented 4 years ago

Hello, after creating a new project (4.0.3) and installing authentication and authorization plugins, I'm not being able to install the localization plugin. When I run: composer require cakephp/localized I get the following problem: ` Problem 1

acosatom commented 4 years ago

Hello MiquelRoan,

I am an absolute newbie with cake but I think the error you get is due to the requirements of the composer.json file in the Localized plugin folder.

In any case, i have managed to manually install the Localized plugin in the Plugins folder and it seems to work correctly in Cake 4.0.3.

The problem / doubt I have is how can I dynamically pass the provider.

In the documentation example the provider is loaded by passing the language directly:

$validator->setProvider('fr', 'Localized\Validation\FrValidation');

    `$validator->add('postalcode', 'myCustomRuleNameForPhone', [
        'rule' => 'phone',
        'provider' => 'fr',
        'message' => __('Bad phone number')
    ]);`

But, how can I write it so that it looks something like that:

$validator->setProvider($my_current_language, $path_to_my_current_language_validation);

    `$validator->add('postalcode', 'myCustomRuleNameForPhone', [
       'rule' => 'phone',
        'provider' => $my_current_language,
        'message' => __('Bad phone number')
    ]);`

Hope someone can help us.

Thanks

saeideng commented 4 years ago

no compatible version for cake 4, but will be soon

dereuromark commented 4 years ago

https://github.com/cakephp/localized/releases/tag/4.0.0-beta is now available.