Uniform with Kirby 2.5.latest

Hi,

I integrated a small contact form with the Uniform plugin. I have a multilang (de, en) site. For the labels and the submit button I use “<?php echo l::get('...') ?>”.
I need a little help how to switch the error messages, which I use from the controller example, because the above php command din’t work.

All the best
Andreas

Have you got language files for each language?

in the controller, the rules should be like:

'name' => [
    'rules' => ['required'],
    'message' => l::get('yourmessage'),
],

Thanks for your reply,

yes I have two language files in “plugins/uniform/language/”
If I set this:

‘message’ => [
‘rules’ => [‘required’],
‘message’ => l::get(‘messageerror’),

in the controller and this in the language file.

‘messageerror’ => ‘Bitte hier den Text eintragen’,

I get “message” instead of the the entry in the language file, as the output of the template, where I use this:

<?php if ($form->success()): ?> <?php echo l::get('success') ?> <?php else: ?> <?php snippet('uniform/errors', ['form' => $form]); ?> <?php endif; ?>

Any ideas, why Kirby didn’t use the text out of the language file?

Thanks
Andreas

You have. to put the lang files in /site/languages, not into the plugin folder

Thanks that works :slight_smile:

It is a bit confusing, because i did the other language customizations in the language files of the plugin. But the controller files are system files I assume.

I think those language files only work within the plugin because that’s where they are loaded. You can’t use them from controllers, templates, snippets etc. though. Also, it is not recommended to touch the plugin files, because your changes would be overwritten if you update the plugin.