diff --git a/config/translation-manager.php b/config/translation-manager.php index 8c87c9c..405a58b 100644 --- a/config/translation-manager.php +++ b/config/translation-manager.php @@ -102,4 +102,17 @@ */ 'show_flags' => true, + + /* + |-------------------------------------------------------------------------- + | Prepend directory path to group name + |-------------------------------------------------------------------------- + | + | Control whether to append the directory path to the group name. + | ex. If the translation file for settings is in directory lang/en/settings/user.php + | The group name will be settings/user + | + */ + + 'prepend_directory_path_to_group_name' => false, ]; diff --git a/src/Helpers/TranslationScanner.php b/src/Helpers/TranslationScanner.php index d589111..5b41e7a 100644 --- a/src/Helpers/TranslationScanner.php +++ b/src/Helpers/TranslationScanner.php @@ -36,8 +36,15 @@ public static function scan(): array continue; } + $groupName = $file->getFilenameWithoutExtension(); + + if (config('translation-manager.prepend_directory_path_to_group_name')) { + //if the file is in a directory, append the path to the groupname + $groupName = implode('/', array_slice($nameParts, 1)); + } + // Load the data from the file - self::parseTranslation(require $file, $nameParts[0], $file->getFilenameWithoutExtension()); + self::parseTranslation(require $file, $nameParts[0], $groupName); } return self::$allGroupsAndKeys; diff --git a/src/Resources/LanguageLineResource/Pages/ListLanguageLines.php b/src/Resources/LanguageLineResource/Pages/ListLanguageLines.php index 3f3b9bd..7f311ac 100644 --- a/src/Resources/LanguageLineResource/Pages/ListLanguageLines.php +++ b/src/Resources/LanguageLineResource/Pages/ListLanguageLines.php @@ -37,7 +37,7 @@ protected function getActions(): array ->url(LanguageLineResource::getUrl('quick-translate')), SynchronizeAction::make('synchronize') - ->action('synchronize')->tooltip('oke'), + ->action('synchronize'), ]; } }