Jump to content

How to translate Edge / Frozen V Information / Error Messages

Recommended Posts

How to translate Edge / Frozen V Information / Error Messages

For example, "Please, fill out this field."

On previous version a file language.php contain a translation but not is Edge/Frozen edition.

Thank you.



Share this post

Link to post
Share on other sites

Contact_us.php for example.

Create_account.php when forgeting gender information, male or female, "Please, select one of these options."

Share this post

Link to post
Share on other sites
I am testing on two languages, english and portuguese.
When switching the language on the language boxe the error message should change.
In this case I have to change the required title to "Por favor, preencha este campo."
Is it?
61 down vote accepted

setCustomValidity's purpose is not just to set the validation message, it itself marks the field as invalid. It allows you to write custom validation checks which aren't natively supported.

You have two possible ways to set a custom message, an easy one that does not involve Javascript and one that does.

The easiest way is to simply use the title attribute on the input element - its content is displayed together with the standard browser message.

<input type="text" required title="Lütfen işaretli yerleri doldurunuz" />

enter image description here

If you want only your custom message to be displayed, a bit of Javascript is required. I have provided both examples for you in this fiddle.

Share this post

Link to post
Share on other sites

If this message is indeed coming from the browser itself, it will depend on the language that the browser is configured for. For most people, it will still be English, and messages will be in English. You can try some of the techniques in the referenced StackOverflow thread to add some PT text to the message. You may even be able to do some Javascript that replaces the English message with PT, but there's no guarantee that it will work on all browsers.

I'll assume that you've scanned through the English language text files to check whether this text is supplied by osCommerce. If it is, you should be able to come up with a PT language file equivalent, if it doesn't already exist.

If you are running the "official" osC 2.3.4 or download, your installation is obsolete! Get (stable) Frozenpatches or (unstable) Edge. See also the naming convention and the latest community-supported responsive "Edge" release

Share this post

Link to post
Share on other sites

I found a quite elegant way to tailor/translate the message. I added this code at the end of template.top, after footer.php:

$("input[required], select[required]").on('change', function() {
$("input[required], select[required]").on('invalid', function() {
    this.setCustomValidity("<?php echo FORM_INPUT_VALUE_MISSING; ?>");

Define the constant in

define('FORM_INPUT_VALUE_MISSING','This value is required');

and includes/languages/yourlanguage.php

e.g. in finnish.php
define('FORM_INPUT_VALUE_MISSING','Tämä on pakollinen tieto');

I've tested this in Windows 10 Chrome and Firefox, and in Android Firefox and Brave.


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now