Native search (sodo-search) is missing localization

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.

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

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 :slight_smile:

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?

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 :slightly_smiling_face:

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

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.