-
-
Notifications
You must be signed in to change notification settings - Fork 830
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
RFC: i18n #419
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I'm trying to keep the discussion focused on a solution instead of hypotheticals so we don't get derailed. I feel like we're close and there have been some good suggestions in this thread. Please don't take me hiding comments personally. 💙 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Thanks again for all the discussions and ideas thus far. Trying to determine the best way to move forward with localization — without being too opinionated — has been an exhausting undertaking. This is one of the last remaining building blocks before a stable 2.0 can be released. Here's a summary of the approach I've decided to take based on feedback, discussions, and experimentations throughout the year. First, a few things need to be clearly identified:
Based on this:
Most of this doesn't matter to end users. What does matter to end users is how simple it is to load Shoelace in a specific language: <html lang="es">
<head>
<link rel="stylesheet" href="/shoelace/dist/themes/light.css">
<script type="module" src="/shoelace/dist/shoelace.js"></script>
<script type="module" src="/shoelace/dist/translations/es.js"></script>
</head>
<body>
...
</body>
</html> In most cases, That said, I've released 2.0 of Here's a Lit component localizing a term, date, and number: import { LitElement } from 'lit';
import { customElement } from 'lit/decorators.js';
import { LocalizeController } from '@shoelace-style/localize/dist/lit.js';
@customElement('my-element')
export class MyElement extends LitElement {
private localize = new LocalizeController(this);
@property() lang: string;
render() {
return html`
<!-- Term -->
${this.localize.term('hello')}
<!-- Date -->
${this.localize.date('2021-09-15 14:00:00 ET'), { month: 'long', day: 'numeric', year: 'numeric' }}
<!-- Number/currency -->
${this.localize.number(1000, { style: 'currency', currency: 'USD'})}
`;
}
} I've already implemented these changes in a local branch and I'm finishing up documentation before merging it into |
I'm closing this since localization has been implemented. There's still work to be done to support RTL languages, but the scope of this issue is complete finally. |
It's time to start thinking about i18n. This discussion will be scoped to localization, whereas #191 will focus on RTL support.
There is a need for common labels in components that need to be localized. An example is in dialog/drawer/tab/tag, which all feature a built-in close button. Currently, the buttons don't have a label so screen readers don't announce them properly.
Important: I don't expect there to be many terms, nor do I want users to rely on Shoelace to power their app's localization. At this point in the library's development, a simple solution is preferred over a robust one.
Updated to reflect new requirements and information.
The text was updated successfully, but these errors were encountered: