Forums

How to realy translate chronoforms

pjdevries 11 Feb, 2008
I have read various threads on this forum related to translating Chrono Forms. Many of the questions obviously came from European guests like myself. Thusfar the only answer I came across which sort of looked like a solution, was in this thread where Bob suggests to translate the few English phrases in 'components/com_chronocontact/js/validation.js'. Unfortunately Bob doesn't seem to realize that translation goes beyond just adjusting some text (no offense Bob). Validation of dates and currency amounts goes a bit further.

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?
GreyHead 12 Feb, 2008
Hi pjdevries,

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
pjdevries 12 Feb, 2008
Hi Bob. Thanks for your reply (also to the other thread).

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]
  • dates using dashes instead of slashes (dd-mm-yyyy)

  • numbers using a period as a thousands separator and the comma as a decimal point (1.000.000,00)

  • the € (euro sign) as a the currency symbol
  • [/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🙂
    GreyHead 12 Feb, 2008
    Hi pjdevries,

    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
    pjdevries 12 Feb, 2008
    Sounds great. If you send me the phrases, I'll translate them as quickly as I can.
    GreyHead 12 Feb, 2008
    Hi pjdevries,

    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 this
    var 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
    GreyHead 12 Feb, 2008
    Hi pjdevries,

    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
    pjdevries 13 Feb, 2008
    Thanx Bob. The new regular expression for date validation makes sense. If I interpret it correctly, one may now enter either slashes or dashes. In fact even a combination of both🙂

    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.
    GreyHead 13 Feb, 2008
    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})?)$/
    Bob
    Wicher 09 Sep, 2008

    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_admin 09 Sep, 2008
    Thanks Wicher!

    Max
    Max, ChronoForms developer
    ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
    ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
    Wicher 09 Sep, 2008
    You'r welcome! Glad I could do something :-)
    Bandbreed 22 Sep, 2008
    I just copied the translated text (with one or two minor adjustments) and placed them into the file mooValidation.js. if you paste the following test over the last function: Validation.addAllThese{[ rigth up until the last bracket (I know it is not the correct way...) and save it (try backing up your English file?) you get a nice Dutch translation. Works nicely, Max, could you check it if it is okay like this? I might have broken something without knowing. (for example: I had to change the "komma's" to "een komma" because the ' broke the script in half).

    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]
    Max_admin 22 Sep, 2008
    Hi BandBread,

    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
    Max, ChronoForms developer
    ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
    ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
    Wicher 25 Sep, 2008
    [quote="Bandbreed"]I just copied the translated text (with one or two minor adjustments) and placed them into the file mooValidation.js. if you paste the following test over the last function: Validation.addAllThese{[ rigth up until the last bracket (I know it is not the correct way...) and save it (try backing up your English file?) you get a nice Dutch translation.
    [/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.
    Janfri 18 Nov, 2008
    Hi everybody,
    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
    Max_admin 18 Nov, 2008
    Hi Janfri,

    I think this is a good idea you are sharing with the everybody here and not a question ?

    Regards,
    Max
    Max, ChronoForms developer
    ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
    ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
    Janfri 19 Nov, 2008
    Hi Max,
    yes, it's not a question, I just wanted to leave my 2 cents here, maybe somebody can use the workaround.
    Best
    Janfri
    Max_admin 19 Nov, 2008
    Thanks for this🙂

    Regards,
    Max
    Max, ChronoForms developer
    ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
    ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
    inspektor 09 Dec, 2008
    How can I use scandinavian characters - åäö - in modifying validation script?

    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
    inspektor 09 Dec, 2008

    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})?)$/
    Bob



    Hi,

    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
    Max_admin 09 Dec, 2008
    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
    Max, ChronoForms developer
    ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
    ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
    inspektor 09 Dec, 2008

    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
    GreyHead 09 Dec, 2008
    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
    Max_admin 09 Dec, 2008
    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
    Max, ChronoForms developer
    ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
    ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
    inspektor 11 Dec, 2008

    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
    inspektor 11 Dec, 2008

    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
    Max_admin 12 Dec, 2008
    Marko, in the title="" part add your custom Scandinavian validation message of this field!

    Regards
    Max
    Max, ChronoForms developer
    ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
    ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
    GreyHead 12 Dec, 2008
    Hi Marko,

    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
    almer 20 Dec, 2008
    How to allow Cyrillic letters in validate-alpha and validate-alphanum fields? How to place alphabet in regexp?
    GreyHead 20 Dec, 2008
    Hi almer,

    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
    almer 20 Dec, 2008
    It's not a free, unfortunately 😟
    almer 22 Dec, 2008

    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.
    almer 23 Dec, 2008

    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.
    Max_admin 23 Dec, 2008
    Ok, I will check this.

    Regards
    Max
    Max, ChronoForms developer
    ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
    ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
    DutchMan 15 Jan, 2009
    I'm a little confused, what do i have to do to translate ChronoForms in Dutch? Maybe someone has a Dutch translation and want to share it?

    Thanks,
    GreyHead 15 Jan, 2009
    Hi DutchMan,

    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
    Sweder 23 Jan, 2009
    Hi DutchMan,

    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
    niekoz 16 Mar, 2009
    Hi guys, i also translated the mooValidation.js to the dutch language but i still have a question.
    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.
    Max_admin 16 Mar, 2009
    Hi niekoz,

    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
    Max, ChronoForms developer
    ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
    ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
    niekoz 17 Mar, 2009
    Thanks, the first option worked for me🙂
    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 🤨
    Max_admin 17 Mar, 2009
    Hi, I guess the validation was turned OFF after you edited the form in the wizard, yes this is a bug, it should not have done this, will fix in RC3

    Cheers
    Max
    Max, ChronoForms developer
    ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
    ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
    niekoz 18 Mar, 2009
    I forgot to turn on the Email the results ? option
    But still... is it possible to change this form so it won't be able to send empty forms?
    GreyHead 18 Mar, 2009
    Hi niekoz,

    I've lost track of your thread here but if Validation is on and working correctly, and at least one field is set to be required then the form will not be sent empty.

    Bob
    This topic is locked and no more replies can be posted.