typebytes / angular-checklist

🔥 Curated list of common mistakes made when developing Angular applications
https://angular-checklist.dev
MIT License
316 stars 66 forks source link

feat: ability to generate content.json in multiple languages #48

Open MSakamaki opened 5 years ago

MSakamaki commented 5 years ago

45 step 1

d3lm commented 4 years ago

Hey there! I would really like to come back to i18n and I appologize for not showing up for so long. I was quite busy with work.

So this is step 1 of getting translations in.

Can you please rebase this branch on latest master? Right now it has conflicts and to continue with this we need to resolve these conflicts.

For step 2 I would also suggest to use transloco instead of ngx-translate as it appears to be not maintained anymore and there are too many open and unresolved issues.

Do you have experience with transloco already or would you mind divining into it? Otherwise I'd pull in @maartentibau for the transloco part. He's interested as well in contributing.

Does this PR work for transloco as well?

MSakamaki commented 4 years ago

@d3lm Thank you for your reply! I am interested in this task and willing to continue.

Unfortunately I don't have transloco experience, but now I will learn and challenge transloco! https://github.com/ngneat/transloco

We will update step1 in the next few days, please wait.

maartentibau commented 4 years ago

Hi @MSakamaki this might maybe help you.

https://gist.github.com/maartentibau/8f2c1c7bd64831520bb63028bba314ca

It is more or less the basic setup of Transloco when using a custom loader. In this case all the language files are located in the ./assets/i18n/ folder, but of course you can change that.

For starters, if you have ever worked with ngx-translate then Transloco will feel very familiar, the only difference is that Transloco has some nice extra features and is actively maintained.

Docs can be found here: https://netbasal.gitbook.io/transloco/

If you need Transloco as a dependency for your unit tests, in 99% of the cases it's enough to just add TranslocoTestingModule to you imports array and you're good to go.

d3lm commented 4 years ago

Yay! Super happy to hear you wanna continue with this PR. Thanks so much. This will be a great addition.

MSakamaki commented 4 years ago

@d3lm @maartentibau I rebased this branch on latest master, and tried translating and building templates using transloco.

Since we confirmed that this could be integrated without problems, we will update the procedure to suit transloco. In accordance with the use of transloco, some transration guidelines and issues #45 steps were updated. Please let me know if you have any questions or mistakes.

Thanks!