I have been poking around in several places in an attempt to solve this minor issue, but I haven't been able to get a few additional validations rules to work, because in fact, that is what's needed. Unfortunateley I don't seem to be skilled and experienced enough to get the job done.
Bob, do you have a few suggestions for this as well?
Ah well, in English translate means translate, and Jos who did the Spanish version seemed happy enough.
What exactly do you need? Dates other than dd/mm/yyyy and currency amount with more than two decimal places? Or are you talking about date parsing and currency with comma separators?
Bob
I stand corrected. The missing features I mentioned have nothing to do with translation indeed. I guess localization would be a better term.
That in fact is probably also the answer to your question. What I'm looking for is a localized (or localizable) version of Chrono Forms for my Dutch audience.
This means translated texts (front end at least) and proper validation routines for Dutch (and many other European) formats:
[list]
Can that be achieved within a reasonable short period of time? I'm willing to throw a couple of dollars (or euro's if yo so desire) your way🙂
I can't do the Dutch; If I send you a list of phrases presumably you can translate those. I'll take a look at the punctuation tomorrow?
Bob
Here's the first test for the currency and date validation. For the currency, replace line 268 in validation.js with this
return Validation.get('IsEmpty').test(v) || /^[$£€]?\-?([1-9]{1}[0-9]{0,2}([, ][0-9]{3})*([.,][0-9]{0,2})?|[1-9]{1}\d*([, ][0-9]{0,2})?|0([.,][0-9]{0,2})?|([.,][0-9]{1,2})?)$/.test(v)
and for the date replace line 256 with thisvar regex = /^(\d{2})[\-\/](\d{2})[\-\/](\d{4})$/;
The existing lines look very similar.
Bob
Post edited by: GreyHead, at: 2008/02/12 18:02<br><br>Post edited by: GreyHead, at: 2008/02/12 22:54
The error messages to be translated are these:
'This is a required field.'
'Please enter a valid number in this field.'
'Please use numbers only in this field. please avoid spaces or other characters such as dots or commas.'
'Please use letters only (a-z) in this field.'
'Please use only letters (a-z) or numbers (0-9) only in this field. No spaces or other characters are allowed.'
'Please enter a valid date.'
'Please enter a valid email address. For example [email]fred@domain.com[/email] .'
'Please enter a valid URL.'
'Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.' (Note dd-mm-yyyy is now also OK)
'Please enter a valid $ amount. For example $100.00 .' (Note £ & € leaders are now OK so are , & space punctuations, trailing € is not!)
'Please make a selection'
'Please select one of the above options.'
Bob
The currency regex is another story though. The one you posted is exactly the same as the orginial one.
Maybe you should take another aproach and leave the currency symbol out of the validation all together. Just let the application decide which currency is expected. You then just have to do a similar trick as with the dates, by allowing either a period or a comma for both thousands separator and decimal sign.
For a future version you may consider to add specific localized validations, preferably based on Joomla!'s locale settings.
By the way, the Dutch translations are on there way. I'm rather busy at the moment, so it will probably be tomorrow. At this moment I can't use them anyway, because I'm still having problems with validations in general.
Sorry, posted the wrong regex string in there - I've corrected it. Her is the revised line
/^[$£€]?\-?([1-9]{1}[0-9]{0,2}([, ][0-9]{3})*([.,][0-9]{0,2})?|[1-9]{1}\d*([, ][0-9]{0,2})?|0([.,][0-9]{0,2})?|([.,][0-9]{1,2})?)$/
Bob
Hi pjdevries,
The error messages to be translated are these:
'This is a required field.'
Dit is een verplicht veld
'Please enter a valid number in this field.'
Vul in dit veld alstublieft een geldig nummer in.
'Please use numbers only in this field. please avoid spaces or other characters such as dots or commas.'
Gebruik in dit veld alstublieft alleen nummers, voorkom spaties of andere karakters als punten of komma's.
'Please use letters only (a-z) in this field.'
Gebruik in dit veld alstublieft alleen letters (a-z) in.
'Please use only letters (a-z) or numbers (0-9) only in this field. No spaces or other characters are allowed.'
Gebruik in dit veld alstublieft alleen letters (a-z) of nummers (0-9). Spaties of andere karakters zijn niet toegestaan.
'Please enter a valid date.'
Vul in dit veld alstublieft een geldige datum in.
'Please enter a valid email address. For example [email]fred@domain.com[/email] .'
Vul in dit veld alstublieft een geldig email adres in. Bijvoorbeeld [email]fred@domain.nl[/email] .
'Please enter a valid URL.'
Vul alstublieft een geldig webadres in.
'Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.' (Note dd-mm-yyyy is now also OK)
Gebruik alstublieft de volgende datum notatie: dd/mm/yyyy. Bijvoorbeeld 17/03/2006 voor 17 Maart, 2006.
'Please enter a valid $ amount. For example $100.00 .' (Note £ & € leaders are now OK so are , & space punctuations, trailing € is not!)
Vul alstublieft een geldig € bedrag in. Bijvoorbeeld €100.00 .
'Please make a selection'
Maak hier alstublieft een keuze
'Please select one of the above options.'
Kies alstublieft een van de bovenstaande opties
Bob
I am a Dutch guy myself looking for a translation "pack" to get the validation messages in Dutch. I see that since february 2008 there was no reply on this, and as I could not find (maybe not looking good enough) a language pack anywhere I guess you never received a reply on this?
Anyway see my translation in GREEN in the quote. Hope this helps.
I have tried to attach the translation validation.js file but the forum doesn't allow me to.
Best regards,
Wicher Koetsier
Max
On another note, Where could I find the CSS code that formats the warings? I would like to give them a bit more... warning-ish feel to them. I hardly see them now, blue on blue.
[code]Validation.addAllThese([
['required', 'Dit is een verplicht veld.', function(v) {
return !Validation.get('IsEmpty').test(v);
}],
['validate-number', 'Vul in dit veld alstublieft een geldig nummer in.', function(v) {
return Validation.get('IsEmpty').test(v) || (!isNaN(v) && !/^\s+$/.test(v));
}],
['validate-digits', 'Gebruik in dit veld alstublieft alleen nummers, voorkom spaties of andere karakters zoals een punt of komma.', function(v) {
return Validation.get('IsEmpty').test(v) || !/[^\d]/.test(v);
}],
['validate-alpha', 'Gebruik in dit veld alstublieft alleen letters (a-z) in.', function (v) {
return Validation.get('IsEmpty').test(v) || /^[a-zA-Z]+$/.test(v)
}],
['validate-alphanum', 'Gebruik in dit veld alstublieft alleen letters (a-z) of nummers (0-9). Spaties of andere karakters zijn niet toegestaan.', function(v) {
return Validation.get('IsEmpty').test(v) || !/\W/.test(v)
}],
['validate-date', 'Vul in dit veld alstublieft een geldige datum in.', function(v) {
var test = new Date(v);
return Validation.get('IsEmpty').test(v) || !isNaN(test);
}],
['validate-email', 'Vul in dit veld alstublieft een geldig email adres in. Bijvoorbeeld fred@domein.nl', function (v) {
return Validation.get('IsEmpty').test(v) || /\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/.test(v)
}],
['validate-url', 'Vul alstublieft een geldig webadres in.', function (v) {
return Validation.get('IsEmpty').test(v) || /^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i.test(v)
}],
['validate-date-au', 'Gebruik alstublieft de volgende datum notatie: dd/mm/yyyy. Bijvoorbeeld 17/03/2006 voor 17 Maart 2006', function(v) {
if(Validation.get('IsEmpty').test(v)) return true;
var regex = /^(\d{2})\/(\d{2})\/(\d{4})$/;
if(!regex.test(v)) return false;
var d = new Date(v.replace(regex, '$2/$1/$3'));
return ( parseInt(RegExp.$2, 10) == (1+d.getMonth()) ) &&
(parseInt(RegExp.$1, 10) == d.getDate()) &&
(parseInt(RegExp.$3, 10) == d.getFullYear() );
}],
['validate-currency-dollar', 'Vul alstublieft een geldig € bedrag in. Bijvoorbeeld €100.00', function(v) {
// [$]1[##][,###]+[.##]
// [$]1###+[.##]
// [$]0.##
// [$].##
return Validation.get('IsEmpty').test(v) || /^\$?\-?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}\d*(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$/.test(v)
}],
['validate-selection', 'Maak hier alstublieft een keuze.', function(v,elm){
return elm.options ? elm.selectedIndex > 0 : !Validation.get('IsEmpty').test(v);
}],
['validate-one-required', 'Kies alstublieft een van de bovenstaande opties.', function (v,elm) {
var p = elm.parentNode;
var options = p.getElementsByTagName('INPUT');
for(i=0; i<options.length; i++){
if(options[i].checked == true) {
return true;
}
}
}]
]);[/code]
for me the code looks fine!
to change the style of messages you need to use Firefox with Firebug to check the messages classes and change it in your CSS file by adding extra classes for them OR search the forums here and you will find many posts on how to do this with the CSS code as I remember!
Regards
Max
[/quote]
Aaah nice! I did copy paste replace the text manually. Next time I can just use this. I don't understand I didn't think of putting this up for others.
as I am not a php coder, I am using an easy workaround. I just copy the original form, let's say in English, translate it and save it with a new name. Then I put the mambot code in an article {chronocontact}FormnameexampleEnglish{/chronocontact} and then "translate" just the code with joomfish, putting in the form name in the other languages I created before, e.g. {chronocontact}FormnameexampleSpanish{/chronocontact}, {chronocontact}FormnameexampleFrench{/chronocontact} etc. That's all.
Best
Janfri
I think this is a good idea you are sharing with the everybody here and not a question ?
Regards,
Max
yes, it's not a question, I just wanted to leave my 2 cents here, maybe somebody can use the workaround.
Best
Janfri
Regards,
Max
I have been trying f.ex. both ä and ä. Translation is not succesfull.
Unfortunately Finnish is not so flexible I could use some roundabout way on every sentence.
Any help or solutions would be very higly appreciated.
Marko
Hi pjdevries,
Sorry, posted the wrong regex string in there - I've corrected it. Her is the revised line
/^[$£€]?\-?([1-9]{1}[0-9]{0,2}([, ][0-9]{3})*([.,][0-9]{0,2})?|[1-9]{1}\d*([, ][0-9]{0,2})?|0([.,][0-9]{0,2})?|([.,][0-9]{1,2})?)$/
BobHi,
How to put it european format(s) so that currency sign follows the amount like:
100.000,00 €
1.000,00 €
100,00 €
Thanks in advance!
Marko
is this V3.0 stable ? if so then you can fix the language issue, don't edit that file and add title="your finish error text here" at any field tag with error!
no idea about the expression question!
Regards
Max
Hi,
is this V3.0 stable ? if so then you can fix the language issue, don't edit that file and add title="your finish error text here" at any field tag with error!
no idea about the expression question!
Regards
Max
Hi, If you are replying to my two previous messages, yes it is V3.0 stable... I purchased full license and got all necessary files directly from you.
I'm sorry I don't get it - how can I fix the language issue? I feel a bit simple. Can't find any other files to modify. This issue is only for mooValidation.js -file.
Marko
Please try
/^\-?([1-9]{1}[0-9]{0,2}([., ][0-9]{3})*([.,][0-9]{0,2})?|[1-9]{1}\d*([, ][0-9]{0,2})?|0([.,][0-9]{0,2})?|([.,][0-9]{1,2})?) ?[$£€€]?$/
Bob
for example this is a field you have in your form:
<input type="text" name="somename">
make it :
<input type="text" name="somename" title="add name here">
let me know!
regards
Max
Hi Marko,
Please try
/^\-?([1-9]{1}[0-9]{0,2}([., ][0-9]{3})*([.,][0-9]{0,2})?|[1-9]{1}\d*([, ][0-9]{0,2})?|0([.,][0-9]{0,2})?|([.,][0-9]{1,2})?) ?[$£€€]?$/
Bob
This works smoothly. Big thanks!🙂
Marko
Marko,
for example this is a field you have in your form:
<input type="text" name="somename">
make it :
<input type="text" name="somename" title="add name here">
let me know!
regards
Max
Hi Max,
Thanks, but this is not a problem. Forms in itself works very fine and I'm very satisfied with all nice functions.
The problems is in validation (mooValidation.js)... I can't use scnadinavian characters in validation messages.
Marko
Regards
Max
What Max is saying is that an entry in the 'title' attribute will over-ride the error text in moo-validation. So try putting put your Scandinavian message there.
Bob
You need a JavaScript/RegExp reference for this. I recommend RegEx Buddy for developing scripts. From their help file: it may be possible to use Unicode Blocks like \p{inCyrillic} which matches nearly all the Cyrillic characters.
Bob
Regex Coach is donation ware (though IMHO not so good). And RegEx Buddy has free tutorials that include a lot of information. See the Unicode page in particular.
Bob
Hi almer,
Regex Coach is donation ware (though IMHO not so good). And RegEx Buddy has free tutorials that include a lot of information. See the Unicode page in particular.
Bob
Thank you, Bob, but it doesn't help me. I don't understand regexp completely 😟
Could anybody provide line of code and were to put it exactly? I need to use UTF-8 (Russian and German) characters it the fields.
Hi almer,
Regex Coach is donation ware (though IMHO not so good). And RegEx Buddy has free tutorials that include a lot of information. See the Unicode page in particular.
Bob
Thank you, Bob, but it doesn't help me. I don't understand regexp completely 😟
Could anybody provide line of code and were to put it exactly? I need to use UTF-8 (Russian and German) characters it the fields.
May be in a future releases make validation for all UTF characters? For now I just validate no empty.
Regards
Max
Thanks,
There is no way of translating ChronoForms at the moment except to edit all the files :-(
But none of the ChronoForms code is visible to the user in the front-end so this usually isn't a problem.
Bob
I translated all messages in 'components/com_chronocontact/js/mooValidation.js'. These are the validationmessages. I think these are the only messages the user will see in the front-end.
On the fly I changed the validation rules for numbers (1,000.00 no longer allowed, use 1.000,00 instead) and changed '$' into '€' or '€ '.
Send me your e-mail if you want me to send this file. Don't forget to add your e-mail address!
(Nick from Roermond, please provide your e-mail address)
regards,
Houdoe,
Sweder
If i have a dropdownmenu in my form and the text Choose option is given but i want to translate this text to Dutch but i searched through all the files and couldn't find this text. I found something in de elements.php in the themes folder and changed it, but it didn't work out.
you will need to do this in 1 of 3 ways :
#1- re edit the form in wizard then re save it so the form code i recreated!
#2- open the form "edit" page and go to "Form code > HTML code" and edit the text there!
#3- wait for RC3
Regards
Max
but now the This field is required text doesn't show when someone forgets a field
and when i press the submit button it goes to the thank you page, even if i didn't fill in all the fields 🤨
Cheers
Max
But still... is it possible to change this form so it won't be able to send empty forms?