I am using $stateProvider for routing and angular-translate for translations. What i would like to achieve is having the selected language bind to the URL and make Language optional with [default=en]. like so:
www.mydomain.com/home
www.mydomain.com/en/home
www.mydomain.com/ar/home
and make it respond accordingly.
I used this code
$urlRouterProvider.otherwise("/home");
$stateProvider
// Homepage:
.state("app", {
url: "/:lang?",
abstract: true,
template: '<ui-view/>'
})
.state("app.home", {
url: "/home",
templateUrl: "common/views/main.html"
});
i want to go to home page with language parameter like
www.mydomain.com/en/home
or without it like
www.mydomain.com/home
Thanks