ngx-translate / core

The internationalization (i18n) library for Angular
MIT License
4.5k stars 572 forks source link

Discussion: future of the library #783

Open ocombe opened 6 years ago

ocombe commented 6 years ago

Hello everyone, I'd like to discuss about the future of this library and get your opinion on my plans.

(Long) history

You can skip that part if you don't care about how this library came to life

When I started this library 3 years ago, I wanted to learn Angular and I thought that working on an open source project would be the best way to do that. It had worked for me on AngularJS with my library ocLazyLoad that was a huge success (2600 stars) and whose core principles were finally integrated into the framework in v1.6.7.

At the time I was looking for a way to translate my Angular apps and found out that there was nothing in Angular to do that (i18n wasn't even existing in the framework). I asked my good friend Pascal Precht if he was interested in porting angular-translate from AngularJS to Angular but he wasn't and told me that I should do it.

My library quickly became popular for various reasons (no real alternative, I had a good reputation from my work on ocLazyLoad, my appearances in Angular Air and my talks at conferences). And I guess that the code was good enough and easy to start with. It was also a time where the framework was still in beta, and there were no real guidelines for publishing libraries for Angular, it was so hard to do it that not a lot of people were trying and I didn't have any real competition on i18n for a long time.

Some time later, the library ecosystem started to settle and Angular was stable, they decided to drop the name Angular 2/4/... in favor of just "Angular". I decided to rename this library ngx-translate and to use npm scopes in order to deliver a modular experience. I rewrote the whole library and made it possible to replace some parts (loader, parser, compiler, ...). It was still a side project for me, but I was using it at work because we had finally started using Angular in production and needed to translate the app in multiple locales.

The official i18n implementation was super complicated (and still is), it didn't support json, code translation, changing the locale without reloading the app, and you needed multiple app bundles (one per locale). My library was so popular that I wanted to work on it full time because I could see that it was a necessity for the Angular community. It solved a lot of use cases, and was simple enough to be usable in a few minutes.

I decided to quit my job and see if I could make a living out my open source work. I knew that it was possible because ag-grid had done it and they were very successful. It was in December 2016, I had 2 months left at work before I was free, and I went to the conference NG-BE where Igor Minar from the core team was present. I wanted to ask him some advices on how to turn this into a profitable OSS project, but before I could tell him about my plans, he told me: "Ah Olivier, I wanted to talk to you, you've got to stop working on your library [ngx-translate], Companies come to us and want to do i18n, but they only talk about your library, we want them to use our solution [Angular i18n] because it's more efficient".

I was a bit speechless, I was there about to tell him that I had quit my job and wanted to work full time on my lib, and he was asking me to stop working on it. So I did what anyone with a bit of common sense would have done, I told him that Angular i18n sucked, that it failed to deliver the promise of easy-to-use-yet-powerful that they wanted Angular to be. I probably didn't use those words, but he agreed with me that it still needed some work, but they didn't have enough resources to work on it (Victor Savkin and Jeff Cross had just left the team to create Nrwl). I jumped on the occasion and told him that I would love to work with them to improve Angular i18n. He told me that he would consider it, and we left it at that.

A few weeks later, and recontacted me, and told me that they were ok to hire me as a contractor to work on i18n. It was like Christmas for me (actually it was around Christmas, so that might explain it) because working for Google is a once in a lifetime opportunity and a dream job. But working on open source, from home, for Angular, it was even better and I didn't even thought that it was possible for me to do that.

I joined the team in February 2017 (almost a year ago), and started working on i18n. There was a lot of work to do, but I was confident that I could make a difference. It was clear to me at the time that it would take a few months to make i18n easier to use for everyone, with the features that people wanted, and that I could deprecate my library after that.

It turns out that working on a framework like Angular is super complicated. The codebase is huge, not highly documented, with a lot of different packages. The development process is complicated (it doesn't even work on Windows yet), and whenever you make a change you have to be extra careful not to break anyone. We even write tests, like a lot of tests! It was a big shift for me, because I had always worked on projects that needed to ship fast, and tests were clearly not the priority, you fixed bugs instead. But working on a library like Angular is totally different. Millions of people depend on your code, when you make a mistake you can break applications that loose thousands or hundred of thousands of dollars because of you. The responsibility is overwhelming and that's why it is much more complicated to release new features. I also wasn't the one deciding the priorities for the framework. Any change that you want to make has to work with Google applications, and it's not like you can duplicate functionalities to make it work for everyone (who said forms and http?).

Anyway it was complicated to change the way i18n worked in Angular. I learned a lot and I feel like we're going in the right direction now. I understand the choices that they made for Angular i18n, it's the most efficient and stable way to translate applications. It works very well for huge companies like Google, but it just isn't what most developers need/want.

During this year, I haven't really worked on ngx-translate. The issues are pilling up, I've only merged a few PRs and some of them have been waiting there for a long time without any activity because of me. There are some long term issues that I haven't taken the time to fix (code splitting / lazy loading, testing, ICU expressions, bugs with ionic...).

But before we get to that, let's quickly compare my library with the native implementation.

Angular

In Angular, you translate your templates using an extraction tool that generates xmb or xliff files, which are well defined formats that have been battle-tested. Those files are translated using professional tools, by real translators. At the end you merge the translations at build time and get a translated bundle.

Advantages:

Issues:

ngx-translate

With ngx-translate you load the module and configure it, you then load the json files containing your translations. You need to manually define keys for your translations and to write them in your json files that you will probably translate yourself, or transform into other formats that you'll send to your translators. But it's ok because json is easy to manipulate and generate.

Advantages:

Issues:

Changes in Angular

Like I said, I've been working on Angular i18n for almost a year now. I've actually worked on a lot of other things as well, and the changes in i18n were clearly not the priority for the framework. A lot of internal changes were also necessary before we could do the changes that we wanted.

I've greatly improved the documentation (i18n guide), I've created demo projects with and without the cli to help people get started. I've worked on bugs, and made a few changes, but we've not released anything major for translations.

Finally for v6 the big changes are coming, translating will be done at runtime. Having access to the internals of the framework means that it will be way more efficient than what ngx-translate does. You shouldn't experience the FOC effect, and it won't take any resource during change detection. You'll be able to do code translations, at last! There will only be one bundle per application for all of the locales (or multiple, if you prefer). And libraries should be translatable.

What will not change:

So what about ngx-translate future?

This has been a long post, and we're finally getting to the part where we talk about the future of ngx-translate. The way I see it there are 2 solutions:

1/ we continue like it has been for the past year, only merging a few PRs, not working on new features and not improving the workflow. I keep working on making Angular i18n better and hopefully people will stop using this library because the native solution will be better. Or maybe a real alternative will emerge (like https://github.com/robisim74/angular-l10n).

2/ I change the way I work and decide to spend more time on the library (at least 1 day/week) to improve it: fixing lazy loading, code splitting, adding functions to help with testing, support ICU expressions, create well documented and maintained examples, finally tackle ionic and other mobile issues, ... I focus on making sure that the library stays a viable alternative to Angular i18n by providing solutions to the "problems" that Angular i18n will not fix. I write better tooling, maybe even an editor for the translations. I rewrite the documentation, on a real website with shiny examples.

To do all of that, I would need to make this library profitable somehow. I was thinking about changing the license to require companies to pay for the library (while keeping it free for open source and personal projects) in exchange for priority support (for bugs fixing, and for working on the features that they want the most). Obviously the current version would remain free and MIT-licensed, since there's no legal way to retroactively change a license, and it would be stupid to do that anyway. But new versions would be using this new license.

This library is downloaded ~350 000 times / month on npm now, if you compare that to the ~2 400 000 downloads of @angular/core, it means that my library is used in 1 out of 7 Angular projects! That's crazy, and it gives me confidence that this is viable.

What do you guys think? Would your companies be willing to pay for a better ngx-translate? Do you see any other alternative?

bnymncoskuner commented 6 years ago

Hello,

I've been using your library as long as I've been using Angular (4+). Last year, around this time I'd been using AngularJs for a while and since Angular 2 was finally released, I decided to give it a try. It seemed a lot more complicated than AngularJs, and i18n was almost impossible for me to use. At that time, I had other projects to work on so I stopped using Angular 2.

Few months passed, I had a chance to join the Ng-Conf. At the conference, I found John Papa at a hall and asked him about i18n in Angular. He said there is a built-in solution. I checked it out and it was too complicated. Extracting files, dealing with xml .... Also, we'd been using a tool for i18n, and we've put all of our translations into a json file. So, built in i18n was not an ideal solution for me. Then, I kept digging and came across your library (as it was named ng2-translate then). I, immediately, fell in love with it. It was super easy to include, configure and use. And, it used JSON! Since then, I've been using it for all of my angular projects (plus I just started using Ionic, and I included ngx-translate into that project as well).

You listed some of the issues with ngx-translate. I think the most important one is that if, somehow, a user cannot download translation file or there is an exception somewhere, you could end up with messed up screen. Other issues, for me, are not so important.

Also, another feature of ngx-translate I really like, is code translation. I could use TranslateService within my code to get any translation I want which I always need to do so.

Long story short, I'd love to see you to keep maintaining this library even if you spend little time on it. I don't think angular built-in i18n solution should be the only one. I think having alternatives is always better.

For license, I think companies would stop using it if you start charging new versions or they'll just use an old version which works just fine. It is because, purchasing a licence in a company is a painful process and I think most people would just avoid it and go for other solutions. Also, I have to mention that if a company buys a license, they expect 24/7 pro support. At least, mine does :) So, that would be hard to deal with. For other alternative, you could get funding through donations or at least try it for a while and then go for paid license.

davidefavia commented 6 years ago

Hi @ocombe, first of all thanks for your hard work and for this open discussion. I'm fine with option number 1 (few PRs merging, no new features), projects I'm working on don't present any critical issue within your library, so a maintenance mode could be fine. The company I work for could probably afford a paid license but we have a lot of JavaScript stuff (vanilla, jQuery, Vue.js), it could be difficult to justify expenses just for few projects (~5%) using Angular. I found difficult to use official i18n solution because of:

If my personal issues could be addressed by the official i18n solution, I could switch without any problem.

stefangrossmann commented 6 years ago

We started using “ngx-translate” at the company because it delivers exactly what we need:

But if we would need to buy a license, I think we would stop using it. It would be hard to argue to pay for it, if Angular itself has something for free. And I can confirm that the process of purchasing a license in a big company is a painful process.

I am not sure if you can make your project profitable with a paid license for commercial usage. Other models I know are, that there is a limited free version of a product and a commercial one with support, extended features and extended documentation. But because “ngx-translate” is easy to use and does exactly what it should, there is no need for us to pay for additional stuff ;-) :-/.

vivainio commented 6 years ago

+1 for option 1. In the end everyone wants to be on the official solution, esp. since v6 seems to fix the biggest limitations (and that they wanted to fix those in the first place, i.e. it's not going to pursue "wrong" direction forever.

peterpeterparker commented 6 years ago

First of all, thx @ocombe for your library and amazing work. I use ngx-translate in every single frontend development project I do, one of the first dependency I inject ;)

Furthermore to the simplicity of implementation, I use ngx-translate because supporting multi-languages is a must for all my projects.

My major concern, because my main app is a Ionic/Cordova app, is having the abilility to have only one bundle and to boot the app in the right language. If that would be possible in the future with i18n, well I might be open to the idea to migrate to it . If that will not be possible, there is no way that I gonna migrate to i18n, I can't boot for example an app in english, then switch to french and restart the mobile app, that would be a crazy user behavior.

About your question itself, I'm not a big company, just a single developper, so I could not tells you if they would be or not be open to a licence fee.

But maybe a third option, just throwing that idea out of loud, to the two you listed above would be a donation model or even maybe better to start a kickstarter? Like "I need xx'xxx euros for the next x years in which I gonna implement these and these features and perform support and bug fixes etc.".

ocombe commented 6 years ago

Solution 1 is not "ditching it", just making sure it still runs on the current Angular and merging PRs that seem interesting or fix bugs. That's how it's been working for the past year.

vivainio commented 6 years ago

@DenisVuyka The projects is already hosted under ngx-translate github team. There wouldn't need to be "transfer of ownership", just assign PR merge rights to some trusted lieutenants.

Truth be told, resources would still be better assigned as third party improvements to angular-i18n ecosystem (tools, hooks, what have you). That would provide some freedom of innovation outside Angular's strict quality policy while not diverging from the core offering

bnymncoskuner commented 6 years ago

What about proposing to angular team to make this an official alternative to angular i18n? Angular team may offer two different solutions for i18n. Would this not be better?

ocombe commented 6 years ago

This is not an option no.

bnymncoskuner commented 6 years ago

Then, I think option 1 is the one. People don't expect much out of this library, because, most of the apps just need something as simple as ngx-translate to support i18n. Angular solution may be powerful and better, but often it is overkill and may be harder to manage.

Bil0 commented 6 years ago

attract more contributors and leveraging the community would be a good idea for making this lib live longer and keep it maintained, encouraging others to share ownership of the project can greatly reduce your own workload since you don't have enough time to review all PRs and issues. Maybe it'll take some times to do so but here's my suggestions:

About:

I would need to make this library profitable somehow

I read an interesting article a few weeks ago about Why Funding Open Source is Hard, so if you want to make this lib a business, changing the license is often the most suitable approach. Companies that rely only on open source projects and libraries are not willing to pay for a license, they'll seek for alternatives.

ocombe commented 6 years ago

licensing a Pipe and a Service is a bit too much

If you think that it's the only thing that this library offers, sure. Not counting the time it takes to work on issues, edge cases and such. The time it took to research stuff, to create the library, bundle it, distribute it. The time it takes to write the tests, the plugins, to maintain the website, to write the documentation, the examples and to reply to people asking for help. And my offering was more than just what exists right now, it was helpers for tests, better docs, better examples, taking care of the existing bugs, probably creating a forum for support (because github issues is not ideal for that), adding new functionalities, new tooling, and premium support.

If the license was for example 500$, how much time do you think that writing that library + its ecosystem of plugins would take you? Only a day? Maybe a week? How much are you paid for your job? If you work in the US, probably at least 500$/day. For me that's a cheap bargain, you're getting the work done, and support if needed, and in exchange of a small fee you get to focus on the real value of your business instead of spending time reinventing the wheel.

The bugs that made you "loose so much time" could have been resolved by me instead of your team.

web-dave commented 6 years ago

Love this project, @ocombe keep on maintaining. plz. I'm fine with both options, but option 1 would be more community like. anyway, great important valuable job

bnymncoskuner commented 6 years ago

If you think that it's the only thing that this library offers, sure.

I don't think he actually sees it that way, but I can see his point of view. Think of this way, consumers of this library are your customers, you are doing a great job and tremendous amount of work in order to deliver it but all they see is a service and a pipe. They don't really see what's going on under the hood. They never see the part of maintaining a library and keeping it stable. That's why people would think this way, and if you start charging for it, they'll just fork the library and make it a part of their project. Since, current version works for almost every app as is, they won't need to add new feature or fix some bugs. I think finding some collaborators and going with slow pace is the best option here.

davidefavia commented 6 years ago

I can see lot of negativity and little respect for the work of @ocombe in this discussion. I really would like to see people saying today "I'm not gonna pay, I'll fork it", forking and maintaining their own version of the library, it's just a simple Pipe+Service, right? Please, do it, meanwhile I'm going to buy some popcorn to watch the show. 🍿 Probably the only thing people can do is just click on GitHub "Fork" button and stop then. If we are not able or comfortable to pay to use his library (as it seems), just suggest to adopt option 1: whenever he will have time to merge PRs he will do it and many many thanks for his hard work in advance. Meanwhile he can concentrate on i18n for Angular core getting paid for it!

ocombe commented 6 years ago

Thanks. I'm not against taking some other maintainers, but from experience people start "playing" maintainer but give up really fast when they see the amount of work for no reward. If anyone is interested, let me know and I'll add you to the project.

Maistho commented 6 years ago

I'd prefer it if Angular i18n would work better. I've been using both ngx-translate and official Angular i18n in two different large-scale projects, and in my experience it's actually been somewhat easier to get started with the official plugin. The main drawback has been no code translations, but it's coming soon! :heart:

If you feel like you would get more out of working on this project and related offerings I might pay for a license, but it really depends on the cost. If I can spend a couple of hours to convert a project to use Angular i18n instead I might do that instead of paying some monthly license cost. It's difficult to compete with "free", sadly.

It feels to me like Angular i18n is more geared towards larger more "enterprisey" businesses, while ngx-translate is geared more towards smaller projects. And, unfortunately for you, I also think that the larger businesses are more likely to pay for licenses than the smaller ones.

It really depends on your extra tooling and such in that case. I'd definitely pay for a good tool that integrates really well with our git-based workflow and makes it easier to send off our JSON (or whatever format) translation files to translators.

Lastly, great job on both ngx-translate and Angular i18n. I hope that you'll be happy whichever way you choose.

rowdyrabouw commented 6 years ago

@Maistho this might be an interesting tool for your translators: https://www.codeandweb.com/babeledit

rowdyrabouw commented 6 years ago

@ocombe I love what you're doing with this project.

A big plus is the run-time change of language.

I use it in NativeScript projects so my users can switch the language easily. With multiple bundles (Angular i18n) I would have to distribute multiple apps to the stores, "just" because the language is different.

loicsalou commented 6 years ago

@ocombe ngx-translate is cool and efficient, it's pragmatic and I really like it. IMO companies can pay for the service if they have a guarantee that the library will always be maintained. If you have several applications in production which use a library you don't want to be forced to change a library... unless you facilitate migration from ngx-translate to angular's implementation maybe ? if I know I can easily migrate from ngx-translate to Angular's solution I think I'll keep ngx-translate for some time, because it's perfect for what I'm doing and I know I can switch easily in case the lib disappears. In case of doubt I guess a big company will probably choose "security" of a standard, which would in this case be @angular's implementation. As you are working for google it also seems to me that some kind of conflict may help you choose not to maintain the library eternally... Personally after what you wrote above I must admit that Angular team seems to be taking seriously i18n topic for big companies (delegating translations to professional translator is a real concern) though I'm a bit disappointed that switching locale implies reloading the app. OK I do not expect a lot of our users to switch locale several times a day (a user in front office, discussing with end clients, might need this however).

As a developer I think I'll use ngx-translate for my personal projects as long as it's maintained. Regarding professional projects I think that, the day Angular's solution with i18n is OK for my needs I'll switch.

Hope this helps. Good luck and thanks for your great work !

Matmo10 commented 6 years ago

Maybe you could start an OpenCollective or some way for people to donate individually to the project. Maybe something like a Kickstarter where each threshold unlocks a new feature to be implemented or issue to be resolved. I feel like ngx-translate is already 90% done, it just needs a few final touches.

I'd like to use the official i18n solution, but it simply isn't flexible enough for me yet, and I'll keep using ngx-translate until it is. I don't see that being anytime soon, to be honest.

I would donate personally. Having to go through a corporate process of purchasing and dealing with licensing though (dealing with procurement teams, legal teams, etc) - I would probably just stay on the current free version rather than deal with that to be honest.

lephyrus commented 6 years ago

Bit late, but here's my feedback: We have a fairly large app at work which was written in AngularJS. When we started the migration to Angular 2, internationalization turned out to be a big challenge. We were using angular-translate with JSON files, runtime language switching, in-code translations, and ICU syntax. To make the long (and ongoing) migration to Angular feasible, we need all of this to work seamlessly across our hybrid app, so Angular's official solution was a long way off the mark. The only thing missing from ngx-translate, on the other hand, was the ICU syntax. Talking to Pascal Precht at a conference last year, he encouraged me to contribute to this library to add that feature, which I have done. ngx-translate was and continues to be crucial for the development of our app. Thanks again, @ocombe.

About the future:

CodeAndWeb commented 6 years ago

I am currently trying to help @ocombe with ngx-translate, getting the issues cleaned up, fixing smaller things. I don't want to see ngx-translate rot and die...

Shot information about me: My name is Andreas Löw, owner of CodeAndWeb GmbH. We create tools for developers - main focus is game development (TexturePacker) but we've recently created a JSON editor called BabelEdit which works with ngx-translate.

I'm a developer for quite a long time - started programming when I was 10... which means that I've 34 years of experience ;) My usual work is in C++, PHP for webpages and Javascript/Typescript.

I've been working on an Angular project for the last year - but I must admit this does not make me an expert. As I said: I have good knowledge in coding - but not about Angular in depth.

@ocombe Why don't you go to https://www.patreon.com ? It should be easy to setup and collect some money from donations.

hamzapoly commented 6 years ago

Well I have one question, is there a way on Angulari18n for angular 5 to load .json source files ? In my case we don't need to generate neither to extract as all the translations are pre-configured in a json file. Thanks in advance

DenysVuika commented 6 years ago

If anyone interested, I've started working on an alternative solution: https://www.npmjs.com/package/@ngstack/translate.

Not trying to make a framework out of a library, and keeping things very simple and small. Should cover most of the real-life scenarios as well as addressing the most common issues my team has been struggling with when using ngx-translate/core during the last year.

Live demos:

tnicola commented 6 years ago

Hi @ocombe . First of all, congratulations for you success story and the awesome work you've done till now. I think ngx-translate it's a great library and I'd like if you didn't stop to mantain it. My company is thinking to move on and migrate to i18n but we didn't take a decision yet both for the migration effort that will take and for the missing features on i18n like code translation. I would like to ask you if it's worth to change for a big and already started project. If so, is there a guide to facilitate the process? Have you already decided a future for your library, will it be deprecated if i18n will fill the gap with the missing features?

admir86 commented 6 years ago

Hi @ocombe, what is the final result of this discussion? what's gonna happening with ngx-translate, once ivy is released and the official i18n is updated with features like translation in code?

ocombe commented 6 years ago

I'll keep it alive (updating for new versions of Angular) since it'll still be the only way to change the language without reloading the app, and also because a lot of people who are using it probably don't want to refactor their code to replace that lib as long as it works for them.

peterpeterparker commented 6 years ago

@ocombe not all heroes wear capes, merci ❤️

vivainio commented 6 years ago

Seems there is no real documentation for js-driven i18n in Angular 6 docs. What's the best place to look?

rowdyrabouw commented 6 years ago

Merci beaucoup @ocombe ! ❤️👍🍾

jesujcastillom commented 6 years ago

Seems like I'm late to the discussion, yet I would like to add that in my case, i18n doesn't cover my company needs, we handle versions of every language by client processes, so they dictate what texts they get to see, we're currently working with angular-translate done we're on angularjs still, but migrating to angular is on our roadmap, and this library would make the migration smoother, yet, I don't see my company paying for a license since we're still a small business.. That's IMO, I would be contributing either with donations or helping maintaining the library (as much as I could, I could be considered a Jr but with a will to help)

simonv3 commented 6 years ago

I'm having the same issue with @vivainio, I'm seeing references here and there to translation in the typescript, but can't see any documentation for it at all. The Angular 6 docs documentation doesn't have anything, and the changelog doesn't seem to mention it for 6.x?

ocombe commented 6 years ago

it's not in 6.x, it'll be with ivy (v7)

kolkov commented 6 years ago

Hi! Will there be support for the translation of libraries in the Angular i18n? Or until it is implemented? And thank you for your work!

ocombe commented 6 years ago

it's on the roadmap yes

ngehlert commented 6 years ago

@ocombe I think both options are valid and I think there would be enough people to buy the license. For this to happen I think you need to clarify the advantages of ngx-translate over angulars solution. To this day there are still a couple of pretty important things missing in angulars i18n

The list probably goes on. I know couple of things probably are personal preference (or regional differences), but the big dealbreaker for me is the file formats. When I evaluated i18n possibilities for a big project I'm working on (I used ngx-translate in a couple of private projects before), I decided against ngx-translate and for Angulars i18n because it was not clear if this project will be forever maintained and Angular claimed to add the missing functionality. I didn't want to refactor everything later so I started to use Angulars i18n (also I think if there is a proper native solution it makes sense to use it). Now half a year later, I'm actually considering switching to ngx-translate and refactor everything, because I'm completely unsatisfied with Angulars i18n. So many troubles, problems and issues. And for most of them it is still not in sight that they might get tackled in the future.

I know that you work on the Angular i18n implementation, maybe you can shed some light on a couple of issues. Is it planned to support different file types or is it still "up for internal discussion" like mentioned on of their github issues? Is it planned to support loading translation files async over http? (Or maybe this is already possible and I just didn't found the proper solution)

This should be by no mean a rant or critic towards you or your work here or at Angular. I know you are doing a great job over there and i18n has gotten a lot better, it is just nowhere near the state I expect it to be from Angular. And I just have the feeling it does not have a high priority on their roadmap - and that probably is what boggles me the most. To me this is just such a core and important functionality.

Thanks for your great work at this library, and I hope it will continue to being maintained :)

ocombe commented 6 years ago

Is it planned to support different file types or is it still "up for internal discussion" like mentioned on of their github issues

We won't be adding new file types, but the API will probably be open with the big refactor for ivy, meaning that anyone can write a new parser and use it with Angular i18n (I say probably because we aren't at that part in the refactor yet, and I don't have the final vote on the question). The extraction won't be supported for new formats, but that's also something that can be written externally. I'll try to push for an open API there also because honestly I think that people prefer to be able to do things, even if we do breaking changes from time to time instead of locking everything up.

Is it planned to support loading translation files async over http

yes, the loading part should be let to the user's appreciation (bundle, http, ...), the important thing is that you will need tp have the translations loaded when the app bootstraps

I just have the feeling it does not have a high priority on their roadmap

I agree, Google has its own solution internally (closure) and that's why it's not very important for them... We have limited resources and clearly this is not the top priority.

ngehlert commented 6 years ago

thanks for your reply.

We won't be adding new file types, but the API will probably be open with the big refactor for ivy, meaning that anyone can write a new parser and use it with Angular i18n (I say probably because we aren't at that part in the refactor yet, and I don't have the final vote on the question)

Well but then there is the question what is the advantage of using the Angulars i18n in the first place if you need a separate parser, separate extractor and maybe even a separate loader depending on the prefered behavior. To me it sounds easier to just use one external lib (e.g. ngx-translate) that handles everything instead of plugging couple of external libs into the native behavior.

ocombe commented 6 years ago

For one main reason: it's integrated into the framework and it's a lot more efficient (I know the codebase of both, and there's no comparison). But if ngx translate works for you, then it's perfect, don't change something that works. But there are limitations (like lazy loading per module) that will most likely not be fixed.

mischkl commented 5 years ago

I'm a ngx-translate user. For me the things missing for i18n are the flexibility of being able to dynamically switch languages without a full page refresh, and the JSON format. If those things were available I'd switch.

The only thing I really miss from ngx-translate is an easy way to avoid the Flash-Of-Content problem on initial load (this is using dynamically-loaded translations). IMHO it makes the initial load seem less professional - but I haven't figured out a good solution. Not sure if ngx-translate itself can help there.

peterpeterparker commented 5 years ago

@mischkl maybe you will find some inspirations in the following topic for your glitch -> https://github.com/ngx-translate/core/issues/754

mischkl commented 5 years ago

@peterpeterparker unfortunately I'm not using Angular Universal, so it's not that helpful in my case

peterpeterparker commented 5 years ago

@mischkl even my very last post in the topic where json are imported without http loader?

mischkl commented 5 years ago

@peterpeterparker there are a couple of issues with that approach. First, all of the languages must be bundled, which creates a lot of bloat beyond a couple of languages. Second, some (approx half) of our translations are purposefully fetched from the server at runtime rather than being part of the Frontend, since we want to be able to update them in the backend without changing the Frontend. For these reasons simply importing the JSONs is not an option.

peterpeterparker commented 5 years ago

@mischkl makes sense, good luck

fetis commented 5 years ago

I'm personally waiting for a proper solution from Angular since v4 (it was promised in v5 back days). ~If promises will fail again in v7, I think I'll never trust Angular team in this question.~ Looks like this happend Ivy is not planned to v7, so real i18n solution will come around v8. And the current situation tears me apart. I really like the extraction part of the official implementation, it's the way how it should be. But the unfished state of code translations makes me feel pain.

I see a lot of complaints about missed JSON format, but XLIFF is an open XML format. Write a converter is probably a 1-2 days task. Probably, your translation tool already does it out of the box.

Regarding the initial question, I think @ocombe is better to focus on the official solution with some mitigation of current pain like it was done with ngx-translate/i18n-polyfill

ocombe commented 5 years ago

@fetis my hope is that we'll be able to use any format with angular runtime i18n (with ivy) by using a custom formatter lib. If I can make it happen the way I want, then I'll write a JSON formatter lib.

fetis commented 5 years ago

@ocombe to make it clear, this will happen only after new i18n runtime, which happens only after Ivy official release (after v7 according to this https://github.com/angular/angular/issues/21706#issuecomment-425183461). Correct?

ocombe commented 5 years ago

Yes to both. The team leads had a meeting yesterday to try to accelerate things up by pulling all our resources (including the cli and material teams) onto ivy until it gets released because we've deviated a lot from our initial estimate (which was to have a beta last summer, during the v7 beta) and it's the thing that everyone is waiting for right now (inside and outside google). It's the item named "Ivy Focus Plan" that you can see on https://docs.google.com/document/d/1rC5dz7AkCZP813daT_bccbS-20OLmXgBVi50CSKx148/pub