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
649 stars 91 forks source link

Fixes for JSON export #66

Closed ahtinurme closed 9 months ago

ahtinurme commented 10 months ago

Decided to merge all 3 PRs into one as they are all related to JSON export:

  1. When using along with https://github.com/xiCO2k/laravel-vue-i18n which generates "php_*.json" files along for every locale, I can ignore those files, but the ignored files are still by default used for locales.

For example: If I have two locales, "et" and "ru", by default import is also trying to find locales for ignored files, and locales "php_et" and "php_ru" which do not exist.

  1. As per Laravel documentation (https://laravel.com/docs/10.x/localization#introduction), the locale JSON files always reside in the main translations folder, not in the specific locale folder.
  2. when exporting the JSON strings, dot in the keys are treated as start of a sub-translation, which is incorrect assumption.
  3. When exporting to JSON, slashes are escaped by default which is not expected behaviour, as translations from JSON files are stored/used unescaped.
MohmmedAshraf commented 9 months ago

Thanks @ahtinurme