I'm working on an Angular application which is not just localizable, but 
needs to support different locales for different parts of the page. For 
instance, one <div> will be in the language of the administrator's choice, 
and another <div> will be in the language of the user's choice, and both 
divs are displayed on the page at the same time.

The initial challenge this creates is that everything built in appears to 
assume there is a single locale. So, it's pretty clear we need to manage 
multiple locales, and that's what my question centers around.

Our original plan was to put locale on the scope, and override it on areas 
of the page which need to change the locale. This works well enough for 
directives, but due to a recent change to filters, we can't get access to 
the local scope directly 
(https://github.com/angular/angular.js/commit/8863b9d04c722b278fa93c5d66ad1e578ad6eb1f).
 
Passing the locale on every filter invocation is something we would like to 
avoid if possible as well.

We have a similar problem for the API calls as well, as they need to pass 
the correct Accept-Language header to the server based on the current 
locale. It would also be nice not to have to pass the locale on every API 
call and have that taken care of transparently.

The only idea I have for handling multiple locales transparently is to 
create multiple angular applications. Each one can have its own locale, and 
any services loaded via that application can share the same locale 
automatically.

I'm not sure what the drawbacks of splitting the page into multiple 
applications is, though. The two areas are pretty separate, and I expect 
communication between them to be minimal. At first glance it looks like a 
reasonable trade-off, but I'm not sure what problems might be lurking.

Any opinions or advice?

Thanks,

Chris

-- 
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 angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to