Closed NadhirBoukhenifra closed 7 years ago
This package is only tested with laravel projects (PHP).
I don't know how the vue-router
works, i've never used it.
But you can grab the current locale entity instead of its properties separately (name, native, direction ...).
You can also convert it to json and pass it as a props
in your vue app/components.
Hello @arcanedev-maroc thank you for replying. this is sample laravel app using vue-router: https://github.com/fagray/vuejs2-laravel53-starter
if you have time you can install it and try your package ... so you can improve it and adding new features.
this is a basic vue-router code:
<div class="row">
<div class="col-md-4">
<div class="list-group">
<router-link to="/" class="list-group-item ">Index</router-link>
<router-link to="/home" class="list-group-item ">Home</router-link>
<router-link to="/foo" class="list-group-item ">foo</router-link>
<router-link to="/bar" class="list-group-item ">Bar</router-link>
</div>
</div>
<router-view class="view"></router-view>
</div>
if you click the home the router-view load Home Component
to view without refreshing the page.
i have the same navigation using to="" option.
The Problem is: (using my router code above) like this:
i think the problem is from the router groupe?
Route::localizedGroup(function () {
Route::get('/{vue?}', function () {
return view('app');
})->where('vue', '[\/\w\.-]*')->name('app');
});
how i can pass the $locale before the link? in get. i will try again & again.
and thank you.
@NadhirBoukhenifra You can add current locale to html tag
<html lang="{{ app()->getLocale() }}">
Mind it you will need to reload the page if user change the language which should not be painful.
After selecting you can install this package martinlindhe/laravel-vue-i18n-generator
Use it in Vue . You can read docs in package.
Now you can try every thing according to i18n.
Hope it helps
Description:
how to use functions and the whole package with vue js 2 components like: this
public function getCurrentLocaleNative()
or this like this:
public function getCurrentLocaleDirection()
and im using vue-router and i want to localize my components ? and the v-router-link? my routes/web.php file content:
but its not work 100%
just i want to use this package with vue-router and use functions inside vue js components.
Steps To Reproduce: