How should 3rd-party Shoelace component developers handle i18n? #302
Replies: 1 comment 1 reply
-
Right now, there aren't any components that require i18n in Shoelace (with the possible exception of A few components already use
Since localization is offloaded to the browser, these components are very lightweight. The default locale is whatever the browser is set to, but it can be customized using the There are only two components on my backlog that look like they'll require i18n:
So I suspect I'll revisit this when that time comes. One option might be a prop like Duet's Date Picker uses: picker.localization = {
buttonLabel: "Valitse päivämäärä",
placeholder: "pp.kk.vvvv",
selectedDateMessage: "Valittu päivämäärä on",
prevMonthLabel: "Edellinen kuukausi",
nextMonthLabel: "Seuraava kuukausi",
// ...
} Since the number of Shoelace components that require localization will be few, I don't think we should force an opinion on how it should be handled in users' apps. There are many good libraries, particularly i18next, but what if you're using Rails or PHP? Or what if your app already has an established solution? In that case, a prop is the most flexible since it can be set from any language and doesn't lock users into a specific i18n solution. Of course, I'm open to other ideas as well. |
Beta Was this translation helpful? Give feedback.
-
If you are developing an app based on Shoelace, it's more or less up to you how to handle i18n.
But if you are writing a component library with additional Shoelace stylish components (like for example a date range picker etc.), it would be great if your components and other 3rd party Shoelace components handle i18n the same way, so that using different 3rd-party Shoelace components at the same time will still be fun, even regarding i18n.
How do you think this could and should be achieved (what about using Intl ... what about translation etc.)?
I would be happy to hear some comments and suggestions from the SL community regarding this subject 😃.
Beta Was this translation helpful? Give feedback.
All reactions