Skip to content

Commit 0eeccbc

Browse files
committed
Look for i18n using absolute path
Makes the glob for i18n files use __DIR__ so that the script can be run from other places than the working directory.
1 parent dfb8a8c commit 0eeccbc

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

DCAT.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,11 @@ function makeDataBlob( $config ) {
110110

111111
// identify existing i18n files and load into array
112112
$langs = array();
113-
foreach ( glob( 'i18n/*.json' ) as $filename ) {
114-
if ( $filename !== 'i18n/qqq.json' ) {
115-
$langcode = substr( $filename, strlen( 'i18n/' ), -strlen( '.json' ) );
113+
foreach ( glob( __DIR__ . '/i18n/*.json' ) as $filename ) {
114+
if ( $filename !== __DIR__ . '/i18n/qqq.json' ) {
115+
$langcode = substr( $filename,
116+
strlen( __DIR__ . '/i18n/' ),
117+
-strlen( '.json' ) );
116118
$langs[$langcode] = $filename;
117119
}
118120
}

0 commit comments

Comments
 (0)