Thank you. I've actually managed to answer most it myself, but there's still two issues:
1. I can't inject TRANSLATIONS after bootstrap. Not sure why, but it seems I might need to provide it twice and parse it twice. 2. There's an open issue on ng-xi18n not parsing code or anything which is not templates. I'm going to fool it by creating a component that won't be used only for translations. On Monday, November 28, 2016 at 9:02:17 PM UTC+2, Tito wrote: > > How do you determine the current locale selected? > > 1. From what I am reading here ( > https://angular.io/docs/ts/latest/cookbook/i18n.html) it seems what is > parsed is what you define you want to be translated using <h1 i18n> > 2. I guess you could take your json files and somehow inject them into > each locale file needed by Angular 2 translation as part of your build? > locale/messages.fr.xlf. But then you cannot leverage dynamic changes which > leads me to recommend using some database backend to store yoru translated > files. Depends I guess > > > > On Thursday, November 24, 2016 at 4:21:27 AM UTC-8, Yoav Luft @ Matific > wrote: >> >> I'm examining different ways to support translations in our hybrid >> angular 1 + angular 2 app. >> In our current code base using Angular 1.2 we load a JSON file with keys >> to translations that we inject using our own service/directive/filter. This >> approach requires from us to update the source JSON file manually. >> >> I've tried using the internationalization method described in the angular >> 2 docs, but it raises a number of questions: >> >> 1. What resources are being parsed? All templates? >> 2. Can I add messages manually somehow? Can I add collect messages >> from JSON files or code? >> 3. How can I access the loaded messages through a service? I tried >> getting it using the TRANSLATIONS OpaqueToken but it didn't work. >> 4. If 2 or 3 are impossible, how else can I translate text that does >> not originate from a template? >> >> >> -- You received this message because you are subscribed to the Google Groups "Angular" 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 https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
