Skip to content

[Autocomplete] Translate "Add ..." text with remote data setup #2279

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Autocomplete/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG

## 2.21.0

- Translate the `option_create` option from TomSelect with remote data setup #2279
- Add one missing Dutch translation #2279

## 2.20.0

- Translate the `option_create` option from TomSelect #2108
Expand Down
2 changes: 1 addition & 1 deletion src/Autocomplete/assets/dist/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ _default_1_instances = new WeakSet(), _default_1_getCommonConfig = function _def
return `<div class="no-results">${this.noResultsFoundTextValue}</div>`;
},
option_create: (data, escapeData) => {
return `<div class="create">${this.createOptionTextValue} <strong>${escapeData(data.input)}</strong>&hellip;</div>`;
return `<div class="create">${this.createOptionTextValue.replace('%placeholder%', `<strong>${escapeData(data.input)}</strong>`)}</div>`;
},
},
preload: this.preload,
Expand Down
2 changes: 1 addition & 1 deletion src/Autocomplete/assets/src/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export default class extends Controller {
return `<div class="no-results">${this.noResultsFoundTextValue}</div>`;
},
option_create: (data: TomOption, escapeData: typeof escape_html): string => {
return `<div class="create">${this.createOptionTextValue} <strong>${escapeData(data.input)}</strong>&hellip;</div>`;
return `<div class="create">${this.createOptionTextValue.replace('%placeholder%', `<strong>${escapeData(data.input)}</strong>`)}</div>`;
},
},
preload: this.preload,
Expand Down
2 changes: 1 addition & 1 deletion src/Autocomplete/translations/AutocompleteBundle.nl.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
'Loading more results...' => 'Meer resultaten aan het laden...',
'No results found' => 'Geen resultaten gevonden…',
'No more results' => 'Niet meer resultaten gevonden…',
// 'Add %placeholder%...' => 'Add %placeholder%...',
'Add %placeholder%...' => 'Voeg %placeholder% toe...',
];