Skip to content

Commit

Permalink
[Autocomplete] Translate "Add ..." text with remote data setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas De Keukelaere authored and kbond committed Oct 21, 2024
1 parent c9bf5ee commit d2b26d3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
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...',
];

0 comments on commit d2b26d3

Please sign in to comment.