Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-19359

Fatal error when setting locale programmatically

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.7.11
    • Fix Version/s: 4.7.14
    • Component/s: None
    • Labels:
    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code

      Description

      Calling CRM_Core_I18n::singleton()->setLocale('es_MX'); gives me a fatal error about trying to access private property gettextResourceDir of the CRM_Core_Config object.

      I'm trying to use it from an extension to force a particular page to always be in Spanish. I'm not sure how/if core uses this method.

      I think this is the relevant part of the error message:

      $Fatal Error Details = array(3) {
        ["message"]=>
        string(71) "Cannot read unrecognized property CRM_Core_Config::$gettextResourceDir."
        ["code"]=>
        NULL
        ["exception"]=>
        object(CRM_Core_Exception)#790 (10) {
          ["errorData":"CRM_Core_Exception":private]=>
          array(1) {
            ["error_code"]=>
            int(0)
          }
          ["cause":protected]=>
          NULL
          ["_trace":"PEAR_Exception":private]=>
          NULL
          ["message":protected]=>
          string(71) "Cannot read unrecognized property CRM_Core_Config::$gettextResourceDir."
          ["string":"Exception":private]=>
          string(0) ""
          ["code":protected]=>
          int(0)
          ["file":protected]=>
          string(125) "/path/to/webroot/wp-content/plugins/civicrm/civicrm/CRM/Core/Config/MagicMerge.php"
          ["line":protected]=>
          int(209)
          ["trace":"Exception":private]=>
          array(18) {
            [0]=>
            array(6) {
              ["file"]=>
              string(112) "/path/to/webroot/wp-content/plugins/civicrm/civicrm/CRM/Core/I18n.php"
              ["line"]=>
              int(596)
              ["function"]=>
              string(5) "__get"
              ["class"]=>
              string(26) "CRM_Core_Config_MagicMerge"
              ["type"]=>
              string(2) "->"
              ["args"]=>
              array(1) {
                [0]=>
                string(18) "gettextResourceDir"
              }
            }
      

        Attachments

          Activity

            People

            • Assignee:
              pittstains Frank J. Gómez
              Reporter:
              pittstains Frank J. Gómez
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: