Hi,
Polaris has a date picker component:
I couldn’t find a way to localize its content (translate month names and days names). Any idea?
Thanks
Hi,
Polaris has a date picker component:
I couldn’t find a way to localize its content (translate month names and days names). Any idea?
Thanks
Hey @Soufiane_Ghzal
- I did a bit of digging into this on my end and from what I can tell looking at the Props here, it doesn’t seem like it’s possible to handle localization externally:
https://polaris.shopify.com/components/selection-and-input/date-picker#props
Localization is handled on our end by the Date Picker component itself though (more info here in the code if you’re interested))
Hope this helps - let me know if I can clarify anything on our end here ![]()
@Alan_G I’m not sure to understand whether it’s possible to actually translate it?
Hey @Soufiane_Ghzal
- Just clarifying that it is possible for the date picker to show translated content, but the component handles this internally (using the useI18n seen in the code). In practice, this means it should automatically use the locale provided by the surrounding environment in the browser.
There’s not a way to pass any specific translation props for the months/days yourself at the moment; but the component itself should take care of it based on that broader context of the user’s browsing environment.
Hope this helps clarify! ![]()
@Alan_G thanks for your answer. So I understand that it’s using the browser’s locale. Are you working with the polaris dev team? Just want to give the feedback that it’s inconsistent with how embedded apps in Shopify work as we use the locale passed to the iframe’s url locale query param. It would be nice to be able to set a custom locale at the minimum rather than using the one from the browser.
Thanks
Hey @Soufiane_Ghzal
- Thanks for the follow-up and for sharing the feedback!
I’ll do some more digging into this and loop back with you here once I have more information. I do get how having the ability to set a custom locale would be needed here - I’ll see if I can confirm/at least pass along the feed back for you
Speak soon!
Hi @Alan_G
Just coming back to this one, but for another component. I noticed that the IndexFilters component
also does not receive translations in some places.
For example the “add filters” label here:
The clear button here:
That’s also an issue with the resource picker
Thanks for flagging @Soufiane_Ghzal
- since we’re focused on the unified Polaris framework, I still can’t guarantee if/when this would get looked at for Polaris-React, but I’ll get in touch with the Polaris team on my end here just so we have your feedback recorded, definitely agree that the localization could be more encompassing here though for sure.
I’ll loop back with you here when I have some more info to share. ![]()
Hey @Soufiane_Ghzal
- just closing the loop on this again with you. I spoke with a teammate on the Polaris product team and just wanted to confirm that our priority is with the new Polaris framework, but we are aiming to make translation features complete within the new Unified Polaris.
I can’t guarantee specifics, but just wanted to share that this is part of our plan for the new unified framework.
Hope this helps and thanks again for flagging this, it’s really appreciated.