Enhance ioBroker plugin translation with DeepL API support #178
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for using the DeepL API as an alternative translation service in the ioBroker plugin, while maintaining full backward compatibility with the existing ioBroker translator service.
Problem
The ioBroker plugin currently uses the ioBroker translator service exclusively for translating changelog entries into multiple languages. Users requested the ability to use DeepL's API for potentially higher quality translations.
Solution
Added environment variable-based DeepL API integration with intelligent fallback:
Key Features
DEEPL_API_KEY
to enable DeepL translation:fx
suffix) vs Pro API keysUsage
Implementation Details
The enhancement modifies the
translateText
function inpackages/plugin-iobroker/src/translate.ts
to:DEEPL_API_KEY
environment variableError Handling
Testing
Added comprehensive test suite covering:
All existing tests continue to pass, ensuring no regressions.
Files Changed
packages/plugin-iobroker/src/translate.ts
- Core DeepL integration logicpackages/plugin-iobroker/src/translate.test.ts
- Comprehensive test coverageREADME.md
- Documentation for setup and usageThis enhancement provides ioBroker developers with access to DeepL's high-quality translation API while maintaining the reliability and backward compatibility of the existing system.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
translator.iobroker.in
const axios = require('axios');
const qs = require('querystring');
async function testIoBrokerTranslator() {
try {
const data = qs.stringify({
text: 'Added new feature',
together: true,
});
} catch (error) {
console.log('Error testing ioBroker translator:', error.message);
}
}
testIoBrokerTranslator();` (dns block)
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.