feat: configureable DeepL client base URL - #5
Open
mvdhoek1 wants to merge 1 commit into
Open
Conversation
mvdhoek1
requested review from
Rovasch,
ShunLuk,
SimonvanWijhe,
dtakken,
ictbeheer and
rivanuff
July 31, 2026 14:50
There was a problem hiding this comment.
Pull request overview
Adds a configurable DeepL API endpoint URL to the plugin settings so the translation client can target alternative DeepL endpoints (e.g., the Free API domain) while keeping a default fallback.
Changes:
- Introduces a new “API base URL” setting field in the admin settings UI and passes it into the
DeeplClient. - Adds option accessors and sanitization/validation for the stored base URL, including preserving the previous value on invalid input.
- Updates documentation and translation catalogs to reflect the new setting.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Views/admin/partials/settings/settings-fields.php | Renders the new base URL input field on the settings page. |
| src/Singletons/SiteOptionsSingleton.php | Adds base_url() option accessor with default fallback. |
| src/Services/DeeplService.php | Passes the configured base URL into the DeepL client. |
| src/Providers/SettingsServiceProvider.php | Registers the new settings field in WordPress Settings API. |
| src/Controllers/SettingsController.php | Adds sanitization/validation and settings error handling for the base URL. |
| src/Clients/DeeplClient.php | Adds configurable base URL support with a default constant. |
| readme.txt | Documents the default base URL and the override use case. |
| README.md | Documents the default base URL and the override use case. |
| languages/yard-deepl.pot | Updates translation template for new strings. |
| languages/yard-deepl-nl_NL.po | Adds Dutch translations for new strings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+95
to
+112
| $base_url = trim( $settings['ydpl_base_url'] ); | ||
|
|
||
| if ( '' === $base_url || ! wp_http_validate_url( $base_url ) ) { | ||
| add_settings_error( | ||
| 'ydpl_options_group', | ||
| 'ydpl_base_url_invalid', | ||
| __( 'The Deepl API base url is not a valid url. The previous value has been kept.', 'yard-deepl' ) | ||
| ); | ||
|
|
||
| $previous_options = get_option( YDPL_SITE_OPTION_NAME, array() ); | ||
| $settings['ydpl_base_url'] = $previous_options['ydpl_base_url'] ?? ''; | ||
|
|
||
| return $settings; | ||
| } | ||
|
|
||
| $settings['ydpl_base_url'] = $base_url; | ||
|
|
||
| return $settings; |
| ?> | ||
|
|
||
| <?php if ( $settings_field_id === 'ydpl_base_url' ) : ?> | ||
| <input type="text" name="ydpl_options[ydpl_base_url]" value="<?php echo esc_attr( $base_url ); ?>" class="regular-text"> |
Comment on lines
+74
to
+80
| add_settings_field( | ||
| 'ydpl_base_url', | ||
| __( 'Deepl API base url', 'yard-deepl' ), | ||
| array( $this->controller, 'section_fields_render' ), | ||
| 'yard-deepl', | ||
| 'ydpl_section_general', | ||
| array( 'settings_field_id' => 'ydpl_base_url' ) |
| - **Privacy Policy:** [DeepL Privacy Policy](https://www.deepl.com/privacy) | ||
| - **Terms of Service:** [DeepL Terms of Service](https://www.deepl.com/pro-license) | ||
|
|
||
| The API base url defaults to `https://api.deepl.com/v2/translate` and can be overridden on the plugin's settings page, for example to use a DeepL Free API account (`https://api-free.deepl.com/v2/translate`). |
| - **Privacy Policy:** [DeepL Privacy Policy](https://www.deepl.com/privacy) | ||
| - **Terms of Service:** [DeepL Terms of Service](https://www.deepl.com/pro-license) | ||
|
|
||
| The API base url defaults to `https://api.deepl.com/v2/translate` and can be overridden on the plugin's settings page, for example to use a DeepL Free API account (`https://api-free.deepl.com/v2/translate`). |
Comment on lines
+98
to
+102
| add_settings_error( | ||
| 'ydpl_options_group', | ||
| 'ydpl_base_url_invalid', | ||
| __( 'The Deepl API base url is not a valid url. The previous value has been kept.', 'yard-deepl' ) | ||
| ); |
mvdhoek1
force-pushed
the
feat/configureable-deepl-client-base-url
branch
from
July 31, 2026 15:41
fe2850c to
6776476
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Voor @JasperS20, na akkoord zal ik de release doorvoeren naar WordPress.
Geldige URL opgeslagen:

Ongeldige URL opgeslagen:
