freeCodeCamp / ui

freeCodeCamp's UI Component Library
BSD 3-Clause "New" or "Revised" License
12 stars 14 forks source link

Decide whether the component library should be localized #30

Open huyenltnguyen opened 5 months ago

huyenltnguyen commented 5 months ago

Description

We currently have English strings in our components as fallback text:

https://github.com/freeCodeCamp/ui/blob/1fe2aea4d8ed19714aeb81872b602b94f4b04ac1/src/close-button/close-button.tsx#L47

It is for convenience, as components such as CloseButton shouldn't have any label text other than "Close". However, supporting default text requires setting up a localization workflow as well as including the translations in the package bundle.

I'm opening this issue to discuss whether we should:

a2937 commented 5 months ago

I am all for localization. Though I wonder if it might be out of scope for a component library.

It also can be a bit of a hassle sometimes depending on how we go about implementing it.

a2937 commented 4 months ago

To elaborate further I personally wanna vote for option 2. This is a component library and I would rather leave the localization to the site level. Additionally when it comes to localization practices in React (that I am somewhat aware of), they would realistically store those localization in a separate file managed by their own website and use another component to switch the language.

I also fear any workflow we make could interfere with this and potentially bring bloat. It's probably best to just leave the localization to the library users.