genetic-orange
genetic-orange4mo ago

Custom translation of resource list page header

How can I control the translation of a resource list page header in terms of suffix (plural, singular)? I do get the header translated but it adds a 's' at the end for plural, but in my language the translation will be the same for singlar and plural in this case...
3 Replies
kapa.ai
kapa.ai4mo ago
Hi @Stevemachine. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- You can control the translation of a resource list page header by using the textTransformers option in the <Refine> component. This option allows you to transform the resource name displayed on the user interface (UI). By default, if you define a resource named posts, Refine will display it as Posts. If you wish to disable any transformation, you can set the textTransformers option as shown in the example below:
const App = () => (
<Refine
// ...
options={{
textTransformers: {
humanize: (text) => text,
plural: (text) => text,
singular: (text) => text,
},
}}
/>
);
const App = () => (
<Refine
// ...
options={{
textTransformers: {
humanize: (text) => text,
plural: (text) => text,
singular: (text) => text,
},
}}
/>
);
In this example, the humanize, plural, and singular functions are set to return the input text as is, effectively disabling any transformation. For more information, you can refer to the Refine documentation on textTransformers (https://refine.dev/docs/core/refine-component#texttransformers). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai4mo ago
<@1202622585238716420> kapa.ai is still learning and improving, please let us know how it did by reacting below
genetic-orange
genetic-orange4mo ago
Can you @kapa.ai help me with how to translate pagination for resource list pages?