Hi, I've recently written a blog post on the matter: http://fadeit.dk/post/angular-translate-ui-router-seo
On Saturday, 31 May 2014 20:17:13 UTC+2, Mahmoud Abdel-Fattah wrote: > > Thank you guys, I'll look into your suggestions. > ᐧ > > > On Tue, May 27, 2014 at 1:55 PM, Raul Vieira <[email protected] > <javascript:>> wrote: > >> ngRoute allows you to specify path params as Daphne described minus the >> abstract state business. To get at the params you would use $routeParams. >> >> Sent from my iPad >> >> On May 26, 2014, at 11:53 PM, Daphne Maddox <[email protected] >> <javascript:>> wrote: >> >> I don't know ngRoute so I can't help you with that. >> >> In ui-router you can use a url pattern like '/:lang' in an abstract root >> state. By defining it that way, you can have a high-level controller that >> reads from $params.lang and sets the value for angular-translate, so that >> all of your pages are rendered to the specified state for you. It is my >> suspicion that ngRoute doesn't give you this capability, so I'm not sure >> how it would best be done. >> >> >> >> On Monday, May 26, 2014 6:14:24 PM UTC-7, Joberto Diniz wrote: >>> >>> Hi, we also have to implement this feature. >>> We're using angular-translate and ngRoute. >>> >>> How would be the best way to change the language specified in the route? >>> Maybe listen to routeChange and then call the angular-translate to change >>> the language, is that the a reasonable way to deal with this? >>> Why do I have to deal this in the controller, like you suggested? >>> >>> On Sunday, May 25, 2014 3:07:45 AM UTC-3, Daphne Maddox wrote: >>>> >>>> I'm going to sound like a broken record here, but this seems like a >>>> perfect use case for a combination of ui-router and angular-translate. >>>> (Maybe you can do this with ngRoute, I don't know, never used it). I do >>>> know that in ui-router it's really easy to set up the path segment that >>>> represents the language as a parameter in the url matcher (e.g. >>>> '/mypath/:lang/mypage'. From there, you have the chosen language >>>> available >>>> in your controller as a value of the $params service, and can easily set >>>> the preferred language for angular-translate to provide the correct text... >>>> >>>> >>>> On Friday, May 23, 2014 3:51:20 PM UTC-7, Mahmoud Abdel-Fattah wrote: >>>>> >>>>> Hey Adrian, it is almost one year but I could not find any resource >>>>> online for the same question. So, may I ask how did you solve this issue? >>>>> >>>>> On Friday, August 30, 2013 5:00:41 PM UTC+2, Adrian wrote: >>>>>> >>>>>> Thanks! Will check it out >>>>>> >>>>>> Den fredagen den 30:e augusti 2013 kl. 16:58:23 UTC+2 skrev Martin >>>>>> Alix: >>>>>>> >>>>>>> BTW, with Node, I use https://github.com/jeresig/i18n-node-2 to >>>>>>> manage my translations... >>>>>>> >>>>>>> On Friday, August 30, 2013 10:55:48 AM UTC-4, Adrian wrote: >>>>>>>> >>>>>>>> Thank you everyone. Server side seems like a good way to go. Not >>>>>>>> the least to be able to bootstrap angular with the language files >>>>>>>> already >>>>>>>> loaded (as they are retrieved from a backend). >>>>>>>> >>>>>>>> Best >>>>>>>> Adrian >>>>>>>> >>>>>>>> >>>>>>>> Den onsdagen den 28:e augusti 2013 kl. 09:07:03 UTC+2 skrev Adrian: >>>>>>>>> >>>>>>>>> Hello, >>>>>>>>> >>>>>>>>> I am trying to figure out how to setup the Angular routing for a >>>>>>>>> multi language webpage/app. In this app different languages should be >>>>>>>>> accessible with a language prefix such as /en /fr etc. >>>>>>>>> >>>>>>>>> Examples: >>>>>>>>> www.myapp.com/en <--- welcome page in English >>>>>>>>> www.myapp.com/fr <-- welcome page in French >>>>>>>>> www.myapp.com <-- should redirect to the appropriate language >>>>>>>>> (/en or /fr) according to some logic in a controller >>>>>>>>> >>>>>>>>> www.myapp.com/en/some-content <-- a sub page in English >>>>>>>>> www.myapp.com/fr/some-content <-- the same subpage in French >>>>>>>>> www.myapp.com/some-content <-- should redirect to the appropriate >>>>>>>>> language (/en/some-content or /fr/some-content) according to some >>>>>>>>> logic in >>>>>>>>> a controller >>>>>>>>> >>>>>>>>> I guess I could do the routing this way >>>>>>>>> >>>>>>>>> $routeProvider. >>>>>>>>> when('/', { >>>>>>>>> controller: 'MyController', >>>>>>>>> templateUrl: '/views/welcome.html' >>>>>>>>> }). >>>>>>>>> when('/en', { >>>>>>>>> controller: 'MyController', >>>>>>>>> templateUrl: '/views/welcome.html' >>>>>>>>> }). >>>>>>>>> when('/fr', { >>>>>>>>> controller: 'MyController', >>>>>>>>> templateUrl: '/views/welcome.html' >>>>>>>>> }). >>>>>>>>> when('/:language/some-content, { >>>>>>>>> controller: 'MyController', >>>>>>>>> templateUrl: '/views/some-content.html' >>>>>>>>> }). >>>>>>>>> when('/some-content', { >>>>>>>>> controller: 'MyController', >>>>>>>>> templateUrl: '/views/some-content.html' >>>>>>>>> }). >>>>>>>>> ... >>>>>>>>> >>>>>>>>> Where :language is extracted with $routeParams in MyController and >>>>>>>>> used as parameter for some translation directive. But this routing >>>>>>>>> doesn't >>>>>>>>> feel right and gets very ugly when the number of languages and sub >>>>>>>>> pages >>>>>>>>> grow. How can I setup the routing in another better way? >>>>>>>>> >>>>>>>>> >>>>>>>>> -- >> You received this message because you are subscribed to the Google Groups >> "AngularJS" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at http://groups.google.com/group/angular. >> For more options, visit https://groups.google.com/d/optout. >> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "AngularJS" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/angular/wSOHrGk9a7w/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at http://groups.google.com/group/angular. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Best, > Mahmoud M. Abdel-Fattah > http://about.me/mabdelfattah > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
