New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

Comments

Projects
None yet
5 participants
@tkuijer

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 from Translations: Fields on a form get untranslatable ' field' appended to them to 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

This comment has been minimized.

patrikkernke commented Feb 27, 2018

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

This comment has been minimized.

patrikkernke commented May 24, 2018

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

This comment has been minimized.

Member

jasonvarga commented Jun 5, 2018

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

image

@patrikkernke

This comment has been minimized.

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

This comment has been minimized.

Member

jasonvarga commented Jun 6, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment