d13r / laravel-breadcrumbs

Please see the Diglactic fork.
https://github.com/diglactic/laravel-breadcrumbs
2.34k stars 416 forks source link

How to show in Multilanguage? #12

Closed ranaanees closed 11 years ago

ranaanees commented 11 years ago

Hii,

Its a perfect package, I want to show it in two languages English and Arabic. I implemented in English successful but how to show in Arabic.

Regards,

d13r commented 11 years ago

I'm afraid I don't know - I've never dealt with multi-language sites myself. How do you do it for the rest of the site? I'm guessing you would call the translate function when you define the breadcrumbs. Going from the Laravel documentation, perhaps something like this?

Breadcrumbs::register('blog', function($breadcrumbs) {
    $breadcrumbs->parent('home');
    $breadcrumbs->push(trans('breadcrumbs.blog'), route('blog'));
});

If you think there's anything that can/should be changed in the package to make it easier I'm open to suggestions.

ranaanees commented 11 years ago

@davejamesmiller you are right. It works perfectly for me. What I did..

  1. I created two files lang\en\breadcrumb.php and lang\ar\breadcrumb.php .
  2. en: return array( 'home' => 'Home' )
  3. ar: return array( 'home' => 'الصفحة الرئيسية' )
  4. app\breadcrumbs.php

Breadcrumbs::register('home', function($breadcrumbs) { $breadcrumbs->push(trans('breadcrumb.home'), route('home')); });

  1. To test it in your app\config\app.php For English: 'locale' => 'en', For Arabic: 'locale' => 'ar',

Perfect package for multilingual...

d13r commented 11 years ago

:smiley:

Burnett01 commented 11 years ago

:+1: