solid-select icon indicating copy to clipboard operation
solid-select copied to clipboard

added customCreateLabel config property for i18n

Open bniwredyc opened this issue 1 year ago • 5 comments

Hi, I need to display the "Create" text in different languages, what do you think about this simple solution?

bniwredyc avatar May 10 '23 18:05 bniwredyc

Interesting. I'm not sure about adding an extra option for this as it raises the question of what else should be an option. I don't want a 100 line helper to become a config nightmare over time.

Some possible alternative approaches:

  1. Decompose more of the logic to make it easier to build your own helper. Perhaps overkill for a simple string change, but might help more in the longterm.
  2. Add a more generic control over label formatting. This could be making the getLabel private function overridable. Impacts key option potentially.
  3. Extend interface of createable function to allow returning custom label. Hard to differentiate from returning any value though.

I'm kinda leaning towards 1. but will think on it more. Happy to hear arguments for just adding the config option though!

martinpengellyphillips avatar May 14 '23 17:05 martinpengellyphillips

Hi! Totally understand your point. I'll think about how to implement a better solution. Argument for just adding the config option is it just works :) But, as you said, it's a little bit dirty and will potentially lead to an API change in the future.

bniwredyc avatar May 15 '23 09:05 bniwredyc

Yeah. One additional thought - the reason for this is translation but not all languages would be a simple prefix word change.

martinpengellyphillips avatar May 15 '23 21:05 martinpengellyphillips

@martinpengellyphillips so I thought about a better solution, but haven't found any yet :D Maybe use my simple solution for now? It makes solid-select i18n compatible for most cases. I promise to help if we find more complex case where it doesn't work. What do you think?

bniwredyc avatar Jan 09 '24 22:01 bniwredyc

It feels more appropriate to add the locale option, because this component actually has more than just Create text. An internal dictionary corresponding to the locale can be easily processed, what do you think?

Hentioe avatar Mar 22 '24 07:03 Hentioe

@Hentioe the thing is you can change all the labels now except Create, this is more flexible solution than internal dictionary imo

bniwredyc avatar May 15 '24 14:05 bniwredyc

This will be possible in the next release, but using a different approach so closing this PR now. See #58 to follow along.

martinpengellyphillips avatar Jul 06 '24 02:07 martinpengellyphillips