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

Localization support #398

Closed
muratcorlu opened this issue Feb 2, 2023 · 3 comments · Fixed by #787
Closed

Localization support #398

muratcorlu opened this issue Feb 2, 2023 · 3 comments · Fixed by #787
Labels
Milestone

Comments

@muratcorlu
Copy link
Contributor

For some components, we'll need to provide a solution to set some labels in multi-language. Some examples:

  • Month/day names in a calendar or date-picker component.
  • Labels of some internal fields. For example reveal button of password input or "Go" button in pagination (currently we use attributes for that but it's not practical since you need to set them every time.
  • Error messages for inputs. Currently we use native browser error messages and there is no easy way to set them globally

For that kind of very common use cases it's unavoidable to provide a localization solution.

In my opinion requirements are like:

  • We should respect HTML's "lang" attribute to set a language.
  • It should be easy to set translations globally
  • Translations should accept variables or maybe functions
  • There should be a solution for pluralization as well

Maybe we can consider using a small library like shoelace's localize that is proven works smoothly and is lightweight enough.

Any opinions are very welcome.

@muratcorlu muratcorlu added the enhancement New feature or request label Feb 2, 2023
@muratcorlu muratcorlu added this to the 2023 Q2 milestone Mar 28, 2023
@muratcorlu muratcorlu modified the milestones: 2023 Q2, 2023 Q3 Jul 14, 2023
@leventozen leventozen removed this from the 2023 Q3 milestone Nov 30, 2023
@leventozen leventozen added this to the Q2/2024 milestone Dec 27, 2023
leventozen pushed a commit that referenced this issue Feb 5, 2024
* Uses `@lit/localize-tools` and `@lit/localize`
* This adds localization support for Lit components.
* Added storybook document.
* Listens for `html` element's `lang` attribute with mutation observer.
* Not initialized by default, instructions added to storybook.
* Output mode is set to **runtime**, meaning that it has to be capable
of changing runtime by rerendering components.
* Added localization support for:
  * Select
  * Pagination

Closes #398

---------

Co-authored-by: Aykut Saraç <aykut.sarac@trendyol.com>
Copy link

github-actions bot commented Feb 5, 2024

🎉 This issue has been resolved in version 3.0.0-beta.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@muratcorlu
Copy link
Contributor Author

Nice job @AykutSarac 🚀

Only thing is, there is an issue about releases. You already released v3.0.0 but this feature released as v.3.0.0-beta.2. The reason is main branch should be merged to next branch after stable version is done. Otherwise v3.0.0 tag is not present in next branch. I think #784 was for that but maybe it's forgotten. Please have a look.

Copy link

github-actions bot commented May 2, 2024

🎉 This issue has been resolved in version 3.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants