Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I18n: support more than just english by replacing hard-coded labels. #236

Open
jguddas opened this issue Sep 27, 2022 · 3 comments
Open
Labels
enhancement New feature or request

Comments

@jguddas
Copy link

jguddas commented Sep 27, 2022

Is your feature request related to a problem? Please describe.
If you want to create a website that is not English, you need to overwrite those values by hand.

Example: <CloseButton aria-label="Schließen" />

props = mergeThemeProps(
"CloseButton",
{
"aria-label": "Close",
children: () => <XMarkIcon />,
},
props
);

Describe the solution you'd like
Example: <I18nProvider locale="DE-de" ><CloseButton/></I18nProvider>

 let strings = useLocalizedStringFormatter(intlMessages);
 props = mergeThemeProps( 
   "CloseButton", 
   { 
     "aria-label": strings.format('close'), 
     children: () => <XMarkIcon />, 
   }, 
   props 
 ); 

react-aria example

Describe alternatives you've considered
Ideally, we would add createCloseButton to solid-aria.

 let navProps = useCloseButton();
 props = mergeThemeProps( 
   "CloseButton", 
   { 
     ...navProps,
     children: () => <XMarkIcon />, 
   }, 
   props 
 ); 

Additional context

  • solid-aria is currently not used in this project but there are plans to implement it.
  • solid-aria has an I18nProvider but currently can't handle messages, something like useLocalizedStringFormatter would need to be added.
@fabien-ml
Copy link
Collaborator

Hi, thanks for reporting the issue. After consideration I will not use solid-aria in Hope UI but I can take inspiration from react-aria i18n to achieve the same feature.

@fabien-ml fabien-ml added the enhancement New feature or request label Sep 27, 2022
@jguddas
Copy link
Author

jguddas commented Sep 27, 2022

Ahh, okay, why is that I, would think this needlessly increases complexity?

@fabien-ml
Copy link
Collaborator

fabien-ml commented Sep 27, 2022

I've built solid-aria and I don't like the DX, also I don't have time to maintains both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants