-
Notifications
You must be signed in to change notification settings - Fork 387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Cloud service providers & Translation.io #1107
Conversation
…ock, and add specific Translation.io sync process
…ivalent to sync_and_purge)
…anslation.io "source" segments and using context to deal with existing ID
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/lingui-js/js-lingui/CeXcqRhFV4WrVe1B1q2EXCr8Ytbb |
I'll review the pull request along the week (have been on holiday for a time, had to disconnect) Michael and I'll release a new version with this feature introduced next Tuesday. |
Thanks a lot @semoal ! Please let me know if you have any feedback or things that I could do to improve this PR. |
Codecov Report
@@ Coverage Diff @@
## main #1107 +/- ##
==========================================
- Coverage 82.28% 82.08% -0.21%
==========================================
Files 56 56
Lines 1677 1686 +9
Branches 458 462 +4
==========================================
+ Hits 1380 1384 +4
- Misses 173 177 +4
- Partials 124 125 +1
Continue to review full report at Codecov.
|
I fixed the Linter warnings. Actually, I have no idea where it comes from, or how to fix it (except using Actually, I'm sorry but there is still a warning when executing
I don't know how to fix this, I did some changes here but that doesn't seem to have any effect.
What would be the correct way for me to improve this? |
Also, another question after re-reading the code. Does your service only work with .po files? .json (aka minimal on Lingui) doesn't work? If they don't work we should add an error clause where only allow running a given service for a given |
You can replace About the warning, I'm not sure how are you testing it but usually, it's a bit tricky (I have to improve that asap), what I do is publishing the whole library to Verdaccio and install that published library on my projects to test that everything runs fine, on CONTRIBUTING.md there's a guide. Be careful about pending changes without committing because when releases it's like a real release and will change something that you must discard.
Also, not sure If you have enough time to write a small piece of documentation about this, but would be pretty cool. (If you don't have time don't worry we can ship docs at other time and another pull request much better.) |
It's only working with traditional PO files (not the
I'll do that directly inside the Translation.io service file, since other cloud providers may need another default format, or maybe be compatible with several of them. I'll keep you updated!
Done :-)
First I used Verdaccio, but now I'm requiring local dependencies directly in my test app to speed up the process. I'll try again Verdaccio to have a cleaner environment and remove the warning.
Ok, great 😄
I already added this on my TODO list a few hours ago. If it's ok with you, I'll do that after the first release at the same time as the docs on Translation.io, it will be easier. I noticed that the docs generate automatically. It's great so we won't need to wait for another release. Thanks again! |
I added the error when the Translation.io service was configured with a format different than I can also confirm that the warnings disappeared with Verdaccio 😄 |
There we go mate, I'll release a new version with this feature and all these bug fixes #1128 in a few hours |
Thanks a lot for your help @semoal! I really hope this feature will benefit both Lingui and Translation.io, and that other cloud providers will be able to add their synchronization processes in the future. For big applications with lots of evolving text in dozens of target languages, it's a must-have. |
@MichaelHoste thank you for this feature and your SaaS product! I just came across this new feature reading the linguijs doc, will definitely play with it! |
@JSteunou I'm glad that people are interested in this integration 😉 Feel free to contact me directly if you need some help or if you find any issues with it. |
Hello LinguiJS team,
This is a PR proposal that is open for suggestions.
Context
I'm the founder of Translation.io, a cloud service provider that helps localize applications and smooth the syncing process with translators. We decided to push best practices to keep developers and translators happy in the long run. We already support the Ruby on Rails and Laravel stacks with a decent success.
We tried several times to support JS/React but we didn't like the existing solutions back then. Then we found LinguiJS, and it was exactly what we were looking for all that time: GetText-like easy syntax with simple source code extraction and PO format.
You really did an amazing job! 😄
Proposal
We have decided to add Lingui as a supported framework. After a quick proof-of-concept demo and a discussion with @semoal, we thought it would be a good idea to create a new configuration option in Lingui for it to be able to work with any cloud service provider, and not only Translation.io
So the idea is to add something like this in the
.linguirc
:A new
services
folder has been created for the provider specific workflows.I created a hook in the
lingui-extract.ts
process to be able to import the service by its name, it will be cleaner when there will be multiple services.How it works
After a
lingui extract
, the service sends the content of all the PO files to Translation.io (or any other provider).The idea would be to just focus on your code, and never edit your PO files again!
Source text (usually English) will evolve in your code, and your translations will evolve on Translation.io and pushed back into your code at each
extract
(it works without conflict even if you work on multiple branches, with a process similar toobsolete
and--clean
).Big advantages of a cloud provider is auto-translation, interpolation and HTML highlighting, (+ warning if missing), fine-grained collaboration roles, history of changes, automatic notification of translators, or ICU plural management (see below).
Demo
Here is a small demo where you can see the initialization process, the sync process and the translation interface with:
lingui-test.mp4
Final notes
I'm convinced that a better symbiosis between LinguiJS and cloud solutions would be beneficial for the library popularity, for LinguiJS users, and of course for cloud solutions themselves.
If you want to test this PR, feel free to:
https://github.com/lingui/js-lingui
as link, it will provide you with a free unlimited access like any other open-source projects using Translation.io.Any feedback would be of course greatly appreciated 🙂