Integration of DeepL API for Automatic Field Translation #4370
stephenhenckaerts
started this conversation in
Feature Requests & Ideas
Replies: 2 comments
-
Have you already seen this plugin? https://github.com/r1tsuu/payload-plugin-translator Maybe you can make a pull request to the plugin, to add DeepL. ChatGPT is also a big help to transform the function: export const createDeepLTranslateService = (authKey: string) => {
return async (
text: string,
targetLang: string,
sourceLang?: string,
context?: string
): Promise<string> => {
const apiUrl = 'https://api-free.deepl.com/v2/translate';
const requestBody = {
text: [text],
target_lang: targetLang,
source_lang: sourceLang,
context: context,
};
const response = await fetch(apiUrl, {
method: 'POST',
body: JSON.stringify(requestBody),
headers: {
'Authorization': `DeepL-Auth-Key ${authKey}`,
'Content-Type': 'application/json',
},
});
const { translations } = await response.json();
return translations[0].text as string;
};
}; |
Beta Was this translation helpful? Give feedback.
0 replies
-
@stephenhenckaerts apparently you can pass your own translation service in the plugin 🥳 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Feature Request: Integration of DeepL API for Automatic Field Translation
Hello Payload CMS Team,
I am writing to suggest an enhancement that I believe would significantly benefit many users of Payload CMS. As we operate in a global digital environment, the ability to present content in multiple languages is increasingly important. To this end, I propose the integration of the DeepL API for automatic translation of fields.
Feature Description
The idea is to allow Payload CMS to automatically translate content fields from a source language into multiple target languages using the DeepL API. This integration would enable seamless, high-quality translations, aiding users in creating multilingual content more efficiently.
Key Benefits
Possible Implementation
I believe this feature would be a valuable addition to Payload CMS, particularly for users looking to expand their reach to a global audience. I am excited to hear your thoughts on this proposal and how we might work towards implementing it.
Thank you for considering this feature request.
Best regards,
Stephen
Beta Was this translation helpful? Give feedback.
All reactions