Pharaonic
Loading...

# Basic Usage

It is very easy to use Localziation, just you need to use localized method in your routes file like this :

1Route::localized(function() {
2 Route::get('/page', function() {
3 return 'Pharaonic';
4 });
5});
6 
7// domain.com/ar/page sub-directory
8// ar.domain.com/page sub-domain
9// domain.com.eg/page ccTLD

# Available Methods, Attributes

1locale()->current // Getting current locale
2locale()->default // Getting default locale
3locale()->supported // Getting supported locales list
4locale()->list // Getting list of all locales (supported or not)
5 
6locale()->isSupportedLocale('ar') // Checking if locale has been supported
7locale()->isSupportedccTLD('eg') // Checking if ccTLD has been supported
8 
9locale()->getName() // Getting current locale name
10locale()->getNativeName() // Getting current locale native name
11locale()->getLanguage() // Getting current language code
12locale()->getRegion() // Getting current region code if exists
13locale()->isRTL() // Checking if locale is rtl direction
14locale()->getDirection() // Getting current locale direction (rtl, ltr)
15 
16// Getting current route with different locale
17locale('en')->current()
18 
19// Getting localized url with the current locale
20locale()->route('article.show', $article->id)
21 
22// Getting localized url with specified locale
23locale('fr')->route('article.show', ['article' => $article->id])
24 
25// Getting un-localized url
26locale()->unLocalizedRoute('article.show', $article->id)