Results 1 to 5 of 5
Like Tree1Likes
  • 1 Post By rayraven

Thread: translating javascript alert string in tpl-login.php & tpl-registration.php

  1. #1
    Thread Starter
    Veteran almightyeric's Avatar
    Join Date
    Aug 2011
    Location
    Nothern CA, USA
    Posts
    416
    Thanks
    56
    Thanked 19 Times in 16 Posts

    translating javascript alert string in tpl-login.php & tpl-registration.php

    This JavaScript function is defined at the top of tpl-login.php:

    HTML Code:
    <script type="text/javascript">
    function CheckLength(name) {
        var password = document.getElementById(name).value;
        if (password.length < 6)
            alert('Your password should have miniumum 6 characters');
    }
    </script>
    It contains a typo ("miniumum").

    I don't think non-English language users will be able to translate it via .mo files.

    One way someone can re-implement that so it is translatable via .mo files is to embed PHP inside the JavaScript function.

    For example:

    PHP Code:
    <script type="text/javascript">
    function CheckLength(name) {
        var password = document.getElementById(name).value;
        if (password.length < 6)
            alert('<?php echo _'Your password should have miniumum 6 characters' ?>');
    }
    </script>
    On a side note, the minimum password length value is hard-coded here. It may be incompatible with plugins that control minimum password length (e.g. user may submit a password with length 5, see this client-side alert telling them the minimum length is 6, re-submit password with length 7; then see an HTML alert saying the minimum length on the server-side is 8).

  2. #2
    talent's Avatar
    Join Date
    Jul 2011
    Location
    London UK
    Posts
    3,499
    Thanks
    75
    Thanked 556 Times in 504 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    $function ('CUSTOMIZATION'); } else { .DESIGN { display: awesome; }
    If you require any additional functionality or design customization, just ask. Afterall... anything is possible! However, I may not know how to implement your particular request, but if you don't ask, you don't get

    If you build it, they will come...


  3. #3
    Expired Customer june172014's Avatar
    Join Date
    Jun 2014
    Location
    New Zealand
    Posts
    272
    Thanks
    87
    Thanked 4 Times in 4 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  4. #4
    rayraven's Avatar
    Join Date
    Jan 2014
    Location
    Nottingham, UK
    Posts
    508
    Thanks
    12
    Thanked 29 Times in 26 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    june172014 likes this.

  5. The Following User Says Thank You to rayraven For This Useful Post:

    june172014 (May 8th, 2017)

  6. #5
    Expired Customer june172014's Avatar
    Join Date
    Jun 2014
    Location
    New Zealand
    Posts
    272
    Thanks
    87
    Thanked 4 Times in 4 Posts

    Activate User Registration

    You must be an AppThemes customer and logged in to view this response. Join today!
    Last edited by june172014; May 8th, 2017 at 02:44 AM. Reason: Added Thanks

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. translate register message
    By thk1976 in forum Ultra Classifieds
    Replies: 5
    Last Post: November 27th, 2013, 04:38 PM
  2. Jomark Job alert
    By sssdornier in forum Help Using JobRoller
    Replies: 1
    Last Post: June 24th, 2013, 10:43 AM
  3. Jomark How to have this job alert box?
    By sssdornier in forum Report JobRoller Bugs
    Replies: 3
    Last Post: January 29th, 2013, 09:10 AM
  4. Warning alert
    By putin in forum ClassiPress General Discussion
    Replies: 3
    Last Post: October 11th, 2012, 09:33 AM
  5. Job Alert not working
    By jonaustin in forum Report JobRoller Bugs
    Replies: 1
    Last Post: May 24th, 2012, 12:53 AM