Support » Plugin: BulletProof Security » Frontend Login Messages Translation

  • Hello,
    the frontend login messages cannot be translated in the .po/.mo translation file because there is an error in the file /includes/login-security.php where they are defined. Although the translatable strings are wrapped in the internationalization function, but the text domain argument ‘bulletproof-security’ is missing in all instances! So WP cannot know where to search for translations.
    Stefan.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author AITpro

    (@aitpro)

    This WP function: __(); is used to find text and catalogue the text in a .pot file for translation apps like Poedit. As long as you have defined this function in the catalogue Properties of the app. I see that the bulletproof-security text domain tag is not included in the code in the login-security.php file, but I am not sure if that is supposed to be there or not for this particular code. I will need to look that up and see if that should be done or not. Thanks.

    #: includes/login-security.php:48 includes/login-security.php:251
    #: includes/login-security.php:381 includes/login-security.php:495
    msgid ""
    "<strong>ERROR</strong>: This user account has been locked until <strong>"
    msgstr ""
    • This reply was modified 3 years, 6 months ago by AITpro.
    Plugin Author AITpro

    (@aitpro)

    Hmm ok I checked the online WP Translation page and searched for this text: “This user account has been locked until” and it is not catalogued. So yep it looks like text domain tags need to be added for the code in the login-security.php file. I assume .pot, .mo and .po files apply to the frontend of a website, but maybe they are only supposed to be for the backend of a website. I will need to look that up.

    Plugin Author AITpro

    (@aitpro)

    Ok looks like yep you can load language translations for both the frontend and backend. So we will go ahead and add the bulletproof-security text domain tags in the login-security.php file. Thanks.

    Yes, I tested it by hacking the login-security.php file and adding the translation entries to the .po file manually and it works. A special attention has to be given to the above mentioned message which has to be devided into 2 strings (lines 48, 251, 381, 495) in login-security.php:

    $error->add('locked_account', __('<strong>ERROR</strong>: This user account has been locked until <strong>','bulletproof-security').date_i18n(get_option('date_format').' '.get_option('time_format'), $row->lockout_time + $gmt_offset). __('</strong> due to too many failed login attempts. You can login again after the Lockout Time above has expired.','bulletproof-security'));

    Note: there must be space character between the dot and the __(…) function of the second part.

    Plugin Author AITpro

    (@aitpro)

    Might as well clean up the text by moving HTML out of the text functions too by doing this below. Not sure why a space would be needed between $row->lockout_time + $gmt_offset). __('</strong> due to Dots (.) are used for concatenation and should not affect the __() function. I checked not using a space and it worked ok when using Poedit to catalogue the text. So let me know where you saw that it did not work and why you think that may have occurred.

    $error->add('locked_account', '<strong>'.__('ERROR:', 'bulletproof-security').'</strong>'.__(' This user account has been locked until ', 'bulletproof-security').'<strong>'.date_i18n(get_option('date_format').' '.get_option('time_format'), $row->lockout_time + $gmt_offset).'</strong>'.__(' due to too many failed login attempts. You can login again after the Lockout Time above has expired.', 'bulletproof-security') );

    #: includes/login-security.php:48
    msgid "ERROR:"
    msgstr ""
    
    #: includes/login-security.php:48
    msgid " This user account has been locked until "
    msgstr ""
    
    #: includes/login-security.php:48
    msgid ""
    " due to too many failed login attempts. You can login again after the "
    "Lockout Time above has expired."
    msgstr ""

    Well, during my testing yesterday, the second part string “due to…” was not getting translated when there was no space but was remaining in English. After I inserted the space it started to work well. Now I tried to remove the space and it keeps on working 🙂 Apparently, there must have been another fault, I don’t know what 🙂

    Plugin Author AITpro

    (@aitpro)

    Ok cool. Thanks for retesting. I just wanted to make sure I was not missing something. 😉 Thanks again for reporting this. Very much appreciated.

    You’re welcome and I thank you for your work.

    Plugin Author AITpro

    (@aitpro)

    Completed in BPS .54.3 released 1-25-2017

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Frontend Login Messages Translation’ is closed to new replies.