Skip to content

Commit 259fb95

Browse files
committed
Ability to modify names of the translation helper methods in the config file.
1 parent 3967d58 commit 259fb95

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/Command/TranslationHelperCommand.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ private function getTranslationKeysFromDir(&$keys, $dirPath, $fileExt = 'php')
8585
foreach ($files as $file) {
8686
$content = $this->getSanitizedContent($file);
8787

88-
$this->getTranslationKeysFromFunction($keys, 'lang', $content);
89-
$this->getTranslationKeysFromFunction($keys, '__', $content);
88+
foreach (config('translation-helper.translation_methods') as $translationMethod) {
89+
$this->getTranslationKeysFromFunction($keys, $translationMethod, $content);
90+
}
9091
}
9192
}
9293

src/config/translation-helper.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,13 @@
2323
* Directory where your JSON translation files are located.
2424
*/
2525
'output_directory' => resource_path('lang'),
26+
27+
/**
28+
* Translation helper methods to scan
29+
* for in your application's code.
30+
*/
31+
'translation_methods' => [
32+
'lang',
33+
'__',
34+
],
2635
];

0 commit comments

Comments
 (0)