Resource names i18n translate
I saw that refine adds an S at the end of resource name, do you know a way i can change this ? we need to use a translation for the resource name in the sidebar menu.
6 Replies
Hi @kerolos.salib. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Yes, you can customize the label of a resource in the sidebar menu by using the
meta.label
property in the resources
array. Here's an example of how to set a custom label for a resource:
By setting the meta.label
property, you can override the default behavior of adding an "s" at the end of the resource name in the sidebar menu. You can use this property to provide translations or custom labels for your resources.
For more information, refer to the Resources documentation (https://refine.dev/docs/tutorial/understanding-resources/index/#what-is-resource).
----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon:
----------------------Resources | refine
In Unit 2.4, we defined a resource to create our CRUD pages with the Inferencer component but did not explain how it works. We will take care of that in this unit and thoroughly explain the resources prop of the `` component using mock components.
<@503618532991565835> kapa.ai is still learning and improving, please let us how it did by reacting below
afraid-scarlet•2y ago
If you use the
i18nProvider
, you can change the whole text of the screen by changing the translation key on translation json file.
https://refine.dev/docs/api-reference/core/providers/i18n-provider/rare-sapphireOP•2y ago
I actually use it but it does not working for the label of resources. resources={[
{
name: "dashboards",
list: "/",
meta: {
label: t("renewableEnergy.park"),
},
}]} It shoes the path to the translation but not the content. and if i use the same path in difrent compoents it shows the content. Maybe bcz it's in the App it self so the translation files doesn't ready yet ?
I actually use it but it does not working for the label of resources. resources={[
{
name: "dashboards",
list: "/",
meta: {
label: t("renewableEnergy.park"),
},
}]} It shoes the path to the translation but not the content. and if i use the same path in difrent compoents it shows the content. Maybe bcz it's in the App it self so the translation files doesn't ready yet ?
@salihozdemir can you give us some indication on this, please ?
afraid-scarlet•2y ago
Sorry for the late reply, we have discussed this with the core team and we created a ticket for solve this issue. We plan to release a feature on this topic this week. Please stay tuned 🙏
But if you don't want to wait, you can swizzle the
<Layout>
component and customize it yourself.
You can find more information here: https://refine.dev/docs/packages/documentation/cli/#swizzle