Issue Summary
Native search (sodo-search) lacks localisation.
For example, see the code from the official sodo-search
repo below. Notice that the placeholder text is hardcoded in English.
dispatch('update', {
searchValue: e.target.value
});
}}
onKeyDown={(e) => {
if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
e.preventDefault();
}
}}
className='grow -my-5 py-5 -ml-3 pl-3 text-[1.65rem] focus-visible:outline-none placeholder:text-gray-400 outline-none truncate'
placeholder='Search posts, tags and authors'
/>
<Loading />
<CancelButton />
</div>
);
}
function SearchClearIcon() {
const {searchValue = '', dispatch} = useContext(AppContext);
if (!searchValue) {
There are other things that are not localized such as labels in the search results like Posts
, Authors
, etc.
I believe localisation can be achieved by passing localized strings to the data-ghost-search
element like this:
<button
class="gh-search"
data-ghost-search
data-placeholder="My custom search placeholder"
data-posts-label="My custom posts label">
{{> "icons/search"}}
</button>
There might be other techniques to pass localized strings to sodo-search
, but this is the one that came into my mind quickly.
Any ideas?
2 Likes
Hannah
August 11, 2022, 12:51pm
2
There is currently no way to localise our drop-in widgets, like Portal or Search, but we’re working on a plan for how to solve this across all the missing places.
If you’re interested in helping - then the right place for this would be contributing. If you’re asking for the feature then you can vote in ideas, but this is deliberately not available yet, not a bug
2 Likes
Thanks for the reply @Hannah
Hi, Hannah!
Thank you for the reply.
I would like to help with this feature. Is there a GitHub issue for this feature?
Hannah
August 17, 2022, 2:21pm
5
Hey, not yet! We’re still working on a plan for how to approach this. Once it’s ready I’ll share in the contributing section of the forum
4 Likes
In the meantime, if anyone is looking for a quick & mostly functional solution (that is sure to give any self-respecting programmer an instant migraine)…
https://forum.ghost.org/t/translation-of-ghost-native-search/31512/6
1 Like
system
Closed
December 15, 2022, 10:28pm
8
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.