basic form block: Where's the code for error messages?

Permalink
Hi,
using latest v of concrete, can someone please help me with this:
I need to translate every single part of the basic form block to German.

What I couldn't find so far: Where to edit the error messages you get when you haven't filled all required fields ...

in plain words I want to replace the "The field Name is required." with the German equivalent

can anyone help me with this please?

Thxs a lot, appreciate the time

rritz
 
rritz replied on at Permalink Reply
rritz
Bumping this up ... please can someone help me there?
mnakalay replied on at Permalink Reply
mnakalay
Hello,
The basic form doesn't have the string "the field name is required", that's in the express form so I am not sure if that's what you want but here goes.

For the basic form: all strings used on form submission are in concrete/blocks/form/controller.php, inside the function action_submit_form(). For instance, line 423, you have the string "Complete required fields *"

For the express form (block with handle express_form) you can't translate strings like that because the Express form uses attributes and each attribute is responsible for its own error messages.

One thing I don't understand is why you need to do that? Concrete5 is fully translated to German. All you need to do is switch C5 to German and all those strings will already be in German without you having to do anything.
rritz replied on at Permalink Reply 1 Attachment
rritz
Hello @mnakalay!

Thank you for the answer! Much appreciated
I have no idea what the difference between basic form and express form is. I have a site in c5 8.4.2 and I use the form block that comes with it.
Page source shows :
<div class="ccm-block-express-form">
<div class="ccm-form">
<a name="form1269"></a>

so I guess this IS the express form.

It is the German installation of c5.
I attach a screenshot of what happens when I try to submit the empty form. The error messages are in English. If they are supposed to be in German, then this is a bug. The attribute pulls English error mesages

So how do I change this to German then?
mnakalay replied on at Permalink Best Answer Reply
mnakalay
ok I see. Actually something weird is on my test website, the form button and the "required" text are also not translated but on your screenshot, they are correctly translated.

Anyway, here's a quick fix.

Copy the file concrete/blocks/express_form/view.php and use it to create a template.
Put it in application/blocks/express_form/templates/my_template.php

Call it my_template.php or anything you want.

At the top of the file, right after
<?php defined('C5_EXECUTE') or die("Access Denied."); ?>

add
<?php
$loc = Localization::getInstance();
$loc->pushActiveContext(Localization::CONTEXT_UI);
?>

Then apply your template to your form and it should fix the problem.
rritz replied on at Permalink Reply
rritz
Oh great, thanks a lot! This did the trick!

BTW The rest of the form was already translated on my page because I found the references in the code an translated by hand.
mnakalay replied on at Permalink Reply
mnakalay
oh well if you also have translation problems elsewhere, I would suggest that, instead of putting that bit of code in a form template as suggested, you put it directly in your theme. Put it just before you opening body tag and it will impact all your site's content.
rritz replied on at Permalink Reply
rritz
As this is a very simple site, I have not come across any translation problems elsewhere yet. But I'll mark this down for future use.

Again, thank you very much for taking the time and helping me. Much appreciated
mnakalay replied on at Permalink Reply
mnakalay
body
mnakalay replied on at Permalink Reply
mnakalay
testing don't mind me
<body>
mnakalay replied on at Permalink Reply
mnakalay
testing don't mind me
<body>