I18n: add extract_messages_excluded_paths parameter

This commit is contained in:
Benjamin Renard 2023-11-22 12:46:07 +01:00
parent a3156d4d05
commit 93aeb32660
Signed by: bn8
GPG key ID: 3E2E1CE1907115BC
2 changed files with 11 additions and 4 deletions

View file

@ -39,11 +39,14 @@ App::init(
"$root_dir_path/static"
),
),
'i18n' => array(
'default_locale' => "en_US.UTF8",
'extract_messages_excluded_paths' => array(
"static/lib"
),
),
'default' => array(
'upload_max_filesize' => 10485760,
'i18n' => array(
'default_locale' => "en_US.UTF8",
),
),
),
$root_dir_path

View file

@ -44,6 +44,7 @@ class I18n {
array(
'root_directory' => '${root_directory_path}/locales',
'default_locale' => null,
'extract_messages_excluded_paths' => [],
)
);
@ -531,8 +532,11 @@ class I18n {
if (Cli::core_mode() && $static_directory != Tpl::$core_static_directory) continue;
if (!Cli::core_mode() && $static_directory == Tpl::$core_static_directory) continue;
// List JS files to parse
$cmd = array('find', escapeshellarg(basename($static_directory)), '-name', "'*.js'");
foreach (App::get('i18n.extract_messages_excluded_paths', null, 'array') as $path)
array_push($cmd, "-not", "-path", "./$path/*");
$result = run_external_command(
array('find', escapeshellarg(basename($static_directory)), '-name', "'*.js'"),
$cmd,
null, // no STDIN data
false, // do not escape command args (already done)
dirname($static_directory) // Run from parent directory