Translate form errors

Highlighted
Tourist
19 0 2

Hi everyone!

I'm setting up a French shop for my sister, and some of the very last items to translate are the form error messages, the contact form being the primary culprit.

No matter how much I trawl through code and shop/theme settings, I can't find where I can translate these messages, or in fact if it's at all possible.

I've even created a new French translation file just for this shop so we're in total control of the text, but the error messages aren't in there.

Anyone would have an idea?

Ideally, I'd rather avoid things like the replace filter all over the place. I've had to do this for days and months in dates, and that's rather tedious.

Thanks!

1 Like
New Member
5 0 0

The same problem

0 Likes
Shopify Staff
Shopify Staff
5826 0 252

You'll need to use the replace filter, on the output of the error messages tag.

http://wiki.shopify.com/Replace

Example of translation done with replace filter: http://support.shopify.com/customer/portal/articles/155560-how-do-i-translate-the-words-previous-and....

Caroline from http://11heavens.com ∴ mllegeorgesand AT gmail DOT com
0 Likes
New Member
5 0 0

Thanx, Caroline, but there are some parts of messages are still untranslated.
here  – <div class="error feedback accent-text">

        <p>Упс, видимо вы допустили {{ form.errors | size | pluralize: 'ошибку', 'несколько ошибочек' }}. Пожалуйста, скорректируйте данные и попробуйте отправить снова.</p>

        {% for field in form.errors %}

          <p>Поле {{ field | capitalize | replace: 'Body', 'Сообщение' }} {{ form.errors.messages[field] }}.</p>

        {% endfor %}

      </div>

 

http://daniyar.com/temp/Screen%20Shot%202013-02-23%20at%2022.13.59-vsHP2nnjQd.png

 

0 Likes
Shopify Staff
Shopify Staff
5826 0 252

Use the replace filter like so:

{{ form.errors.messages[field] | replace: "can't be blank", "YOUR TRANSLATION" }}
Caroline from http://11heavens.com ∴ mllegeorgesand AT gmail DOT com
0 Likes
Shopify Staff
Shopify Staff
5826 0 252

Or... looks like you could use:

<p>Поле {{ field | capitalize | replace: 'Body', 'Сообщение' }} YOUR TRANSLATION FOR "can't be blank" HERE.</p>
Caroline from http://11heavens.com ∴ mllegeorgesand AT gmail DOT com
0 Likes
New Member
5 0 0

Thanx, Caroline, it helped. I am dunce :)

0 Likes
Tourist
19 0 2

As I said in my original post, this is not what I wanted to do. I suspected this would be the "solution" but it really isn't pretty at all from a development and performance standpoint.

At the very least, do you know if there is a list of all possible error messages somewhere? Even though I don't like the replace filter which is essentially string manipulation, it seems the only solution so far, so let's go for it, hopefully the shopify platform can cope with the performance hit of applying plenty of regular expressions on generated code...

However, the main problem here is not knowing what to translate. That should really be done in the translations files available from the admin interface.

Shopify support? A hand on this please?

0 Likes
New Member
5 0 0

It's a very good solution for worldwide users. When I didn't find one in admin pane I was very upset. Hope in the future there will be some kind of language template in the admin panel

 

0 Likes
Tourist
19 0 2

I don't think it is, actually. While it is A solution, it's not an acceptable one as we don't know what to expect.

Publication of "new strings" is a general problem as far as I know. I created a new translation file for my website a couple of weekes back, but since then, new strings have been added and it doesn't seem there is any notification of it either. I noticed a few other posts around the topic, so we're not isolated cases.

Not knowing what to expect is not a great approach, even if there is a way to translate what is printed out.

As a developer, I want to know 100% what I can expect to be printed to my customers, and I want 100% of it to be translated when it reaches them. Anything less than this makes me look like a tool.

I'm happy to help on anything if I can, Shopify!

1 Like