PHP-MySQL : addslashe() function for EN to FR translation ?

Discussion in 'Developers' Forum' started by Keoz, May 21, 2021.

  1. Keoz

    Keoz Member


    I am translating from English to French the contextual menu file of a web app written in PHP-MySQL.
    I downloaded the relevant PHP file, and I started the translation using text editor “Visual Studio Code“, but strings remaining to be translated gets colored in red to notify an inappropriated entry after that a single quote ( ‘ ) was entered, e.g :

    From english : This page no longer exists
    To french : Cette page n’existe plus

    From reading solutions proposals on the web, I understood that using the “addslash()“ function (or stripslash alternatively) may prevent display issues in the web app contextual menu, but this also seems to depend on MySQL configuration : something about handling or not such this “mysql_real_escape_string“ parameter.

    /// Q1 ///
    Is adding last string such as in the example below the correct way to apply the “addslash()“ function ?

    I am asking the question because even doing so, strings in the editor remains colored in red….
    Source :

    $data['147'] = 'Menu';
    $data['148'] = 'Vue';
    $data['149'] = 'profile de';
    $data['150’] = ‘Cette page n’existe plus';
    eval("echo '" . addslashes($str) . "';");
    A the end of the last string, ( ; ) was removed, so that only the single quote ( ' ) remains between the the double quotes.

    /// Q2 ///
    Do I have to check configuration of MySQL db and modify something ?
    If yes, can someone please tell what to modify, and how to do it ?

    Last edited: May 21, 2021
  2. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    Simply use a backslash, e.g. for Let's Encrypt:
    $wb['limit_ssl_letsencrypt_txt'] = 'Let\'s Encrypt available';
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    $data['150’] = ‘Cette page n’existe plus';
    The line you posted contains several wrong chars btw. after 150 the ’ must indeed be ' and before the word Cette, the ‘ must be '.
    In programming languages, it matters if you use ' or ´ or ` or ". Better use the builtin language editor in ISPConfig instead of Visual Studio to translate language files as the buitin editor ensures that everything is quoted correctly.
  4. Keoz

    Keoz Member

    I was not sure it was that simple... !

    How to access the ISP config editor ?
  5. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    It's language editor.
    ISPConfig Panel | System | Language Editor
  6. Keoz

    Keoz Member


Share This Page