Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Tarjama Laravel Package

laravelarab/tarjama

Tarjama is a Laravel package from laravelarab for managing Arabic translations and localization files. It helps organize translation strings, streamline multilingual workflows, and keep Arabic language content consistent across your Laravel application.

View on GitHub
Deep Wiki
Context7

Getting Started

  • Install the release that includes Laravel 8 support: composer require laravelarab/<package>:^1.8 (confirm the exact Composer name in the README). v1.8.0 is the first line explicitly advertising Laravel 8 compatibility, so pin ^1.8 if you are on Laravel 8.
  • Check package discovery. Laravel 8 supports auto-discovery via extra.laravel.providers; if config or translations are not loading, inspect config/app.php and run php artisan package:discover.
  • Publish the package assets using the tags documented by the package, for example:
    • php artisan vendor:publish --tag=<package>-config
    • php artisan vendor:publish --tag=<package>-lang
    • php artisan vendor:publish --tag=<package>-views only if you need to override views.
  • Set the application locale to Arabic in config/app.php ('locale' => 'ar') or per request with App::setLocale('ar').
  • First use case: render a simple Arabic page and verify that __('...')/@lang('...') resolves, the HTML uses dir="rtl" lang="ar", and published language files are being read from lang/ar.

Implementation Patterns

  • Locale switching middleware: create a SetLocale middleware that reads the user preference or session value and calls App::setLocale($locale). Register it in the web middleware group so every request resolves the correct locale.
  • Blade usage: use __() or @lang() for strings, and set direction dynamically, e.g. <html lang="{{ str_replace('_', '-', app()->getLocale()) }}" dir="{{ app()->getLocale() === 'ar' ? 'rtl' : 'ltr' }}">. If the package exposes RTL/LTR Blade directives, prefer those to keep templates consistent.
  • Validation and attributes: publish and customize lang/ar/validation.php and lang/ar/attributes.php. Use localized attribute names so validation messages read naturally in Arabic.
  • Dates and numbers: if the package provides Hijri or Arabic numeral helpers, use them at the presentation layer. Otherwise use Carbon with ->locale('ar') and PHP’s NumberFormatter with an Arabic locale such as ar_EG.
  • Route organisation: apply the locale middleware to route groups rather than individual routes, and keep locale-prefixed URLs (/ar/..., /en/...) if the application supports multiple languages.
  • Testing: assert the active locale and translated output in feature tests, e.g. $this->get('/ar')->assertSee(__('messages.welcome', [], 'ar')); and $this->assertSame('ar', app()->getLocale());.
  • Production: run php artisan config:cache after changing default locale settings, and ensure published language files are deployed with the application.

Gotchas and Tips

  • Version constraints are the main risk: v1.8.0 only advertises Laravel 8 support. On Laravel 9 or 10, check for a newer release before upgrading; otherwise Composer may resolve an older version or fail. Laravel 8 itself requires PHP ^7.3|^8.0, so confirm your PHP version.
  • The release notes are minimal and indicate only Laravel 8 support. No breaking changes or new features are documented, so treat v1.8.0 as a compatibility release and regression-test locale switching after upgrading.
  • Config cache can hide changes: if published config or locale defaults appear ignored, run php artisan config:clear and then php artisan config:cache.
  • Locale fallback: set 'fallback_locale' => 'en' in config/app.php to avoid raw translation keys when an Arabic string is missing. Publish all language files rather than copying only one.
  • RTL is not automatic: translated strings do not flip layout. Add an RTL stylesheet or use logical CSS properties, and test with dir="rtl".
  • Debugging: use php artisan tinker to check app()->getLocale() and trans('...'), and inspect the published lang/ar path. Use vendor:publish --force only when you intend to overwrite customised language files.
  • Extension points: prefer publishing and editing language/config files over modifying vendor code. If the package exposes custom locale resolvers or view overrides, bind them in a service provider so upgrades remain straightforward.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode
jjsquady/round-robin