Closed genox closed 1 month ago
Hi @genox,
this sounds nice. We are doing a store front with qwik and have troubles especially with single words. Feel free to create a PR. I can add it as well, but this and next week I'm very full in my job and on side projects.
Let me know if anything is odd, as this project is not my finest one 😄
Tobi
I will see what I can do :)
There you go: https://github.com/tzdesign/deepl-localize/pull/9
Hi,
Not really an issue, more of a topic to explore. DeepL offers a context parameter. It is still considered beta but I've had good results with translations that only consist of a few words for another project where I use it to translate single word strings and such.
The way I implemented it is basically using a sort of context buffer that contains the last 8000 characters of requested translations in the original language. It is not watertight, but the quality of translations improved greatly. This might be especially helpful for UI strings and technical definitions that are very much depending on context.
As an example, using no context, deepL insisted that "TypeScript" is "TypScript" in German, which is not what it is supposed to translate to. With additional context from preceding original strings, it eventually started to correctly use the original.
I have this issue with this library and some e-commerce specific strings and short call to actions on buttons etc. that deepl insists on literal translations. There is a big chance that this would immediately be resolved with translation context.
The buffer method is not perfect, especially if there is not much in terms of preceding context available, but all in all, there is a very notable quality improvement.
Maybe something to consider as an optional parameter. I could try to implement this.