Skip to content

Commit

Permalink
Merge pull request #30 from kenepa/include_directory_in_group
Browse files Browse the repository at this point in the history
Prepend dir path to groupname
  • Loading branch information
Jehizkia authored Nov 23, 2023
2 parents d2d175a + 75f8822 commit 12b80ee
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
13 changes: 13 additions & 0 deletions config/translation-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
];
9 changes: 8 additions & 1 deletion src/Helpers/TranslationScanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected function getActions(): array
->url(LanguageLineResource::getUrl('quick-translate')),

SynchronizeAction::make('synchronize')
->action('synchronize')->tooltip('oke'),
->action('synchronize'),
];
}
}

0 comments on commit 12b80ee

Please sign in to comment.