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

Translation files are not being loaded correctly

    Details

    • Type: Patch
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.4.0, 4.0.0, 4.0.7
    • Fix Version/s: None
    • Component/s: Internationalisation
    • Labels:
      None

      Description

      1. Introduction:
        The definition of the config variable $gettextResourceDir in /civicrm/CRM/Core/Config/Defaults.php looks like:

        $this->gettextResourceDir =
        $civicrm_root . DIRECTORY_SEPARATOR .
        'l10n' . DIRECTORY_SEPARATOR ;

        => Creates the following path: /civicrm/l10n/ (Note: with trailing slash)
      1. Problem description:
        The constructor of CRM_Core_I18n (in /civicrm/CRM/Core/I18n.php) uses an instance of a Filereader with the following path construction:

        $streamer = new FileReader(implode(DIRECTORY_SEPARATOR, array($config->gettextResourceDir, $locale, 'civicrm.mo')));

        => Creates the following path: /civicrm/l10n//de_DE/civicrm.mo (Note: double slashes because of the implode() and the trailing slash from $gettextResourceDir)
      1. The correct path sould be created like:

        $streamer = new FileReader($config->gettextResourceDir . $locale . DIRECTORY_SEPARATOR . 'civicrm.mo');

        => Creates the following path: /civicrm/l10n/de_DE/civicrm.mo (Note: without double slashes)

      Attached is a patch which will fix this issue. I guess it depends on the operating system (tested on CentOS and Debian)

      Best regards
      Uwe David

        Attachments

          Activity

            People

            • Assignee:
              lobo Donald A. Lobo
              Reporter:
              flash_ultra Uwe David
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1 hour
                1h
                Remaining:
                Remaining Estimate - 1 hour
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified