strapi-plugin-meilisearch
strapi-plugin-meilisearch copied to clipboard
Handle multi languages plugin
Problem
For now the plugin only works in English as the text has been hard-coded inside the different components.
Solution
Strapi provided a very good way to handle multiple languages.
It has been tried in the header of the MeiliSearch plugin meilisearch/admin/src/containers/HomePage/index.js
<Header
title={{
label: formatMessage({ id: getTrad('plugin.name') })
}}
content={formatMessage({ id: getTrad('header.description') })}
/>
The text is imported from meilisearch/admin/src/translations
.
We should change all hard-coded
text with the same feature.
Example
'Indexed In MeiliSearch'
should become
// collections.js
formatMessage({ id: getTrad('collection.indexed') })
And the following should be added in at least en
//meilisearch/admin/src/translations
"collection.indexed": "Indexed in MeiliSearch"
Whats next
Once this is done, it will be very easy to add new languages to the plugin
@curquiza Is there list of files/file on which refactoring needs to be done? Also can you explain the last part in issue description like where should that be added ?
Hello @abhijeet007rocks8, I let @bidoubiwa explains this since it's her issue and she's the maintainer of the repo 🙂
hey @abhijeet007rocks8 ! I assign you to this issue :) If you want to find out how to do the translation system I advise to look at this plugin that uses it: https://github.com/alexzaganelli/strapi-plugin-email-designer/tree/main/admin/src/translations
Example:
/>
<Button onClick={saveDesign} color="success">
{formatMessage({ id: getTrad('designer.action.saveTemplate') })}
</Button>
Hello @abhijeet007rocks8 I have removed the assignement as we have no news from you! Feel free to open the PR anyway.
Hi, I have opened a new PR with the development for the plugin to handle multiple languages. (en
,es
)