Skip to content

Commit 98c68b1

Browse files
committed
fix array helper function
1 parent d7284c5 commit 98c68b1

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/Manager.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Illuminate\Support\Facades\App;
1313
use Illuminate\Support\Facades\Cache;
1414
use Illuminate\Support\Facades\Gate;
15+
use Illuminate\Support\Arr;
1516
use Illuminate\Support\Str;
1617
use Symfony\Component\Finder\Finder;
1718
use Vsch\TranslationManager\Classes\PathTemplateResolver;
@@ -1265,7 +1266,7 @@ function importTranslations($replace, $groups = null)
12651266
// just update the locale with translations, keys are already LTM keys here
12661267
$translations = $jsonTranslations[$locale];
12671268
} else {
1268-
$translations = array_dot(include($langFile));
1269+
$translations = Arr::dot(include($langFile));
12691270
}
12701271
$this->importTranslationFile($locale, $db_group, $translations, $replace);
12711272
}
@@ -1652,7 +1653,7 @@ function makeTree($translations)
16521653
{
16531654
$array = array();
16541655
foreach ($translations as $translation) {
1655-
array_set($array[$translation->locale][$translation->group], $translation->key, $translation->value);
1656+
Arr::set($array[$translation->locale][$translation->group], $translation->key, $translation->value);
16561657
}
16571658
return $array;
16581659
}
@@ -1666,7 +1667,7 @@ function getLostDotTranslation($translations, $tree)
16661667
$group = $translation->group;
16671668
$key = $translation->key;
16681669
if (!array_key_exists($key, $nonArrays)) {
1669-
$value = array_get($tree[$translation->locale][$translation->group], $translation->key);
1670+
$value = Arr::get($tree[$translation->locale][$translation->group], $translation->key);
16701671

16711672
if (is_array($value)) {
16721673
// this one is an array while it is a translation in the source

src/Translator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Illuminate\Support\Facades\Cookie;
1010
use Illuminate\Support\Facades\Gate;
1111
use Illuminate\Support\Facades\URL;
12+
use Illuminate\Support\Arr;
1213
use Illuminate\Translation\Translator as LaravelTranslator;
1314

1415
class Translator extends LaravelTranslator
@@ -789,6 +790,6 @@ public function getLocales()
789790
if (!is_array($configLocales)) $configLocales = array($configLocales);
790791

791792
$locales = array_merge(array($currentLocale), $configLocales, $locales);
792-
return array_flatten(array_unique($locales));
793+
return Arr::flatten(array_unique($locales));
793794
}
794795
}

0 commit comments

Comments
 (0)