Skip to content
This repository has been archived by the owner on May 9, 2023. It is now read-only.

Translations: Fields on a form get untranslatable ' field' appended to validation errors #1135

Closed
tkuijer opened this issue Dec 1, 2016 · 5 comments

Comments

@tkuijer
Copy link

tkuijer commented Dec 1, 2016

Expected behaviour

When I add a new language and add translations for validation rules, I expect to see a translated text on the validation error message.

Actual behaviour

I see my translated validation message, but the field labels all have ' field' appended to them.

Steps to reproduce

  1. Set up statamic with a different locale
  2. Set up a Form (ie. a Contact form) with field validations
  3. Add translated validation messages
  4. Submit Form with data triggering validation errors

Server configuration

Operating system:
Linux Mint 17

Web server:
Apache 2.4

PHP version:
PHP 7.0

Statamic version:
Statamic 2.1.16

Updated from an older Statamic or fresh install:
Fresh install

Cause

This unexpected behavior is caused by the 'Submission' (core/Form/Submission.php) class appending ' field' (Line 218) to every form field.
Comment states this is to define a friendly name for form fields, but it also causes validation messages to not be properly translatable.

@tkuijer tkuijer changed the title Translations: Fields on a form get untranslatable ' field' appended to them Translations: Fields on a form get untranslatable ' field' appended to validation errors Dec 1, 2016
@jackmcdade jackmcdade added the bug label Jan 10, 2017
@patrikkernke
Copy link

I have the same bug. Is there a solution? My customer want quick a clean validation message :) my client site is already in production.

Thanks in advanced!

@patrikkernke
Copy link

Is this bug already solved? It shows really a bad validation message in other translations than english.

@jackmcdade jackmcdade added the l10n label Jun 5, 2018
@jasonvarga
Copy link
Member

Seems fine to me, maybe I'm missing a detail.

image

@patrikkernke
Copy link

patrikkernke commented Jun 6, 2018

But in your message ":attribute" is substituted with "Name field" ... and the word "field" is english language. I couldn't find another place to translate the word "field".

Normally it should only translate with "Name" instead of "Name field".

Excuse my rough and raw english (I don't speak and write english often). I appreciate your work and when something sounds impolite or ironic: THAT IS NOT INTENDED :)

@jasonvarga
Copy link
Member

jasonvarga commented Jun 6, 2018

Hah, yes it's obvious now. Got it! Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants