strapi-plugin-meilisearch icon indicating copy to clipboard operation
strapi-plugin-meilisearch copied to clipboard

Handle multi languages plugin

Open bidoubiwa opened this issue 3 years ago • 4 comments

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

bidoubiwa avatar Mar 25 '21 12:03 bidoubiwa

@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 ?

abhijeet007rocks8 avatar Oct 02 '21 05:10 abhijeet007rocks8

Hello @abhijeet007rocks8, I let @bidoubiwa explains this since it's her issue and she's the maintainer of the repo 🙂

curquiza avatar Oct 02 '21 14:10 curquiza

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>

bidoubiwa avatar Oct 04 '21 08:10 bidoubiwa

Hello @abhijeet007rocks8 I have removed the assignement as we have no news from you! Feel free to open the PR anyway.

bidoubiwa avatar Apr 27 '22 12:04 bidoubiwa

Hi, I have opened a new PR with the development for the plugin to handle multiple languages. (en,es)

Captura de pantalla 2024-04-04 a las 2 54 19 Captura de pantalla 2024-04-04 a las 2 50 12 Captura de pantalla 2024-04-04 a las 2 54 37

mimartinez avatar Apr 04 '24 02:04 mimartinez