Skip to content

Commit

Permalink
minor #2279 [Autocomplete] Translate "Add ..." text with remote data …
Browse files Browse the repository at this point in the history
…setup (Jonas De Keukelaere)

This PR was squashed before being merged into the 2.x branch.

Discussion
----------

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

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Issues        | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT

In #2108 the "Add..." translation has been added. But this only worked for non remote data setups. This PR makes it work for remote data setup too.

Also add translation for Dutch.

Commits
-------

d2b26d3 [Autocomplete] Translate "Add ..." text with remote data setup
  • Loading branch information
kbond committed Oct 21, 2024
2 parents 9ac73e0 + d2b26d3 commit 7803fba
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 7803fba

Please sign in to comment.