MohmmedAshraf / laravel-translations

Laravel Translations UI package provides a user-friendly interface for managing translations in your Laravel application. It simplifies tasks such as adding, editing, deleting, and exporting translations. The package also includes a handy search feature and the ability to invite collaborators for easy translation management
MIT License
648 stars 91 forks source link

Translation Strings as Keys support and adding file name in key option #49

Closed benaja closed 10 months ago

benaja commented 10 months ago

Enhanced Support for Translation Strings as Keys

Previously, the ability to translate files using the "Using Translation Strings as Keys" method was unavailable. These files are typically stored like "lang/en.json," as opposed to the "lang/en/*" directory. I have now implemented functionality to enable the translation of these files as well.

Integration of File Name in Translation Keys

In Laravel, short keys are usually accessed via __("filename.key"). However, this package previously disregarded the filename in the key, leading to inconsistencies. For example, if there's a translation key in a Laravel application like "validation.attributes.name," it should be possible to locate this exact string using the Translation UI search bar. To address this, I have introduced a config option that allows for the inclusion of the filename in the translation key, enhancing searchability and consistency in key naming.

Exclude files pattern

It is now also possible to use pattern matching for the exclude_files option. For example you can use "*.php" to exclude all php files and then only be able to translate all json files.

MohmmedAshraf commented 10 months ago

Hey @benaja,

Appreciate your PR! I'll check it out in a few days. Planning to release a new version with some breaking changes as I've moved from Livewire to Inertia and some new features has been added as well.

After the release, let's tackle this together if that works for you.

Best, Mohamed

MohmmedAshraf commented 10 months ago

Thanks @benaja