segmentio / evergreen

🌲 Evergreen React UI Framework by Segment
https://evergreen.segment.com
MIT License
12.39k stars 832 forks source link

Extract localizable strings so they can be customized #1459

Closed evantrimboli closed 2 years ago

evantrimboli commented 2 years ago

As an example, in the file picker control, the following strings are hard coded:

<Text color={disabled ? colors.gray500 : colors.blue400}>Browse </Text>
const orDragCopy = `or drag ${maxFiles === 1 ? 'a file' : 'files'} here`

It would be good if both were extracted to props:

The result would look something like this:

<FileUploader
  browseText={t('browse')}
  dragText={(count) => t('fileCount', { count })}
/>

The same should apply to other strings.

brandongregoryscott commented 2 years ago

I don't think it would be a huge lift (aside from this internal copy, I feel like most of the components are controlled), but I'd want to sit down and audit existing areas with internal/hard-coded copy before going full steam ahead on it.

We haven't really prioritized i18ning our own app, which would require a much larger lift than just tweaking the Evergreen versions.

Edit: After taking a cursory look through the repo, I'm not really seeing any hard-coded content strings like this. Feel free to open a PR if you've got the change queued up!