Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-9867

Adjust the implementation of error messages localization

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.1.0-a1
    • 3.1.0-dev
    • Other
    • None

      We use the trick to localize error messages similar to

      // Replace "error" strings with their real, localised form
      $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
      

      in the following files:
      acp_users.php - for 5 times;
      ucp_prefs.php - for 2 times;
      ucp_profile.php - for 4 times;
      ucp_register.php - for 1 time.

      After the IRC discussion the better implementation seems to be using the scheme

      // Replace "error" strings with their real, localised form
      $error = array_map(array($user, 'lang'), $error);

            rxu rxu
            rxu rxu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: