Skip to content
Snippets Groups Projects
Commit 1b94154b authored by Elliott Eggleston's avatar Elliott Eggleston Committed by totten
Browse files

translation#30 Move l10n resource dir under private files

Looks under [civicrm.private]/l10n if that exists, falling back to
[civicrm.root]/l10n.

Since I18n::getResourceDirectory needs to be called from GenCode,
where we don't have the base directory defined, we make the l10n
path factory function consult new #define CIVICRM_L10N_BASEDIR first.

In GenCode itself, keep using the old location for now, but make
it possible to change the location with an env var as soon as we
update buildkit.
parent b32a899c
No related branches found
No related tags found
No related merge requests found
......@@ -178,6 +178,7 @@ class CRM_Core_Config_MagicMerge {
// Option: `restrict` - auto-restrict remote access
'configAndLogDir' => ['path', 'civicrm.log', ['mkdir', 'restrict']],
'templateCompileDir' => ['path', 'civicrm.compile', ['mkdir', 'restrict']],
'l10nDir' => ['path', 'civicrm.l10n', ['mkdir', 'restrict']],
// "setting-path" properties are settings with special filtering
// to return normalized file paths.
......
......@@ -282,11 +282,7 @@ class CRM_Core_I18n {
* @return string
*/
public static function getResourceDir() {
static $dir = NULL;
if ($dir === NULL) {
$dir = dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'l10n' . DIRECTORY_SEPARATOR;
}
return $dir;
return \Civi::paths()->getPath('[civicrm.l10n]/.');
}
/**
......
......@@ -78,6 +78,12 @@ class Paths {
'path' => defined('CIVICRM_TEMPLATE_COMPILEDIR') ? CIVICRM_TEMPLATE_COMPILEDIR : \Civi::paths()->getPath('[civicrm.private]/templates_c'),
];
})
->register('civicrm.l10n', function () {
$dir = defined('CIVICRM_L10N_BASEDIR') ? CIVICRM_L10N_BASEDIR : \Civi::paths()->getPath('[civicrm.private]/l10n');
return [
'path' => is_dir($dir) ? $dir : \Civi::paths()->getPath('[civicrm.root]/l10n'),
];
})
->register('wp.frontend.base', function () {
return ['url' => rtrim(CIVICRM_UF_BASEURL, '/') . '/'];
})
......
......@@ -27,6 +27,7 @@ date_default_timezone_set('UTC');
define('CIVICRM_UF', 'Drupal');
define('CIVICRM_UF_BASEURL', '/');
define('CIVICRM_L10N_BASEDIR', getenv('CIVICRM_L10N_BASEDIR') ? getenv('CIVICRM_L10N_BASEDIR') : __DIR__ . '/../l10n');
require_once 'CRM/Core/ClassLoader.php';
CRM_Core_ClassLoader::singleton()->register();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment