Can we call API in real time to translate the website? #3121
Replies: 3 comments 1 reply
-
Thanks for the feedback. The API you mentioned, and specifically That being said, even if the premise that AI can translate better in a specific context is debatable, personally I don't think it would make sense to have such support of calling an external API for translations being built into Starlight. It's a lot of extra complexity to handle and maintain on the long term, considering Starlight only care about the data, not how it is generated. Translations are also not something that change often, so having that feature being built into Starlight vs an external tool doing it only when needed would not provide any real benefit. I personally think a better approach could be to have an external script running before Starlight that check for untranslated keys and then use an AI translation API to fill them in and write the results to the filesystem so that Starlight can pick them up. |
Beta Was this translation helpful? Give feedback.
-
This is a good idea, and then we could use useTranslations to handle it, but this is for an existing document. If dynamic content could use a translator API, and don't write to the filesystem, maybe memory, maybe this is beyond Starlight, I just want to make my CMS site support multilingual. |
Beta Was this translation helpful? Give feedback.
-
I’ll add that machine translation is a subject that has come up before in discussions around the translation of Astro’s docs and we definitely concluded that it would be unwise to publish machine translations given the risk for errors in the automated output. In cases where an organization is not able to verify translations itself, it is much better to leave the machine translation to user choice. This is pretty easy these days, for example, a website visitor can use browser plugins or built-in tools like Firefox’s local translation capability or Chrome’s use of Google Translate. This allows the user to clearly understand that the translation they requested was done by a machine and can better evaluate the risks associated with it. Publishing a machine translation without at least having it reviewed by a speaker of that language is likely to give a reader a false impression that the text can be trusted (they don’t know it was done by a machine). And it exposes you to the risk of publishing incorrect or unprofessional text under your name. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
What version of
starlight
are you using?0.33
What is your idea?
I noticed recently Starlight supported New i18n APIs for plugins, but this API(useTranslations) seems only to call key, use t() to get existing translated text. I want to call a translation API to do this.
Why is this feature necessary?
Not every document needs to be translated by people, sometimes, the AI can translate better!
Do you have examples of this feature in other projects?
No response
Participation
Beta Was this translation helpful? Give feedback.
All reactions