0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00
logto/packages/elements
renovate[bot] 0c777c10f2
chore(deps): update dependency @lit/localize-tools to ^0.8.0 (#6402)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-04 10:59:38 +08:00
..
src/account feat(elements): add logto-account-center element (#6737) 2024-10-25 09:39:15 +00:00
.gitignore feat(elements): init i18n 2024-07-15 19:00:18 +08:00
index.html feat(elements): add logto-account-center element (#6737) 2024-10-25 09:39:15 +00:00
package.json chore(deps): update dependency @lit/localize-tools to ^0.8.0 (#6402) 2024-11-04 10:59:38 +08:00
README.md feat(elements): init modal and input 2024-07-22 11:36:44 +08:00
tsconfig.json
tsup.config.ts refactor: reorg elements project (#6708) 2024-10-22 15:29:21 +08:00
web-dev-server.config.js feat(elements): init modal and input 2024-07-22 11:36:44 +08:00
web-test-runner.config.js feat(elements): introduce basic logto-account-provider (#6685) 2024-10-22 07:43:27 +00:00

Logto elements

A collection of Web Components for building better applications with Logto.

Warning

This package is still under development and not yet published to npm.

Development

  • The standard dev script is useful for testing the Logto integration when you are working with the workspace's dev script. How ever, the dev integration has some issues like duplicate registration and stale element cache. It's not easy to overcome them at the moment.
  • Run the start script to start a quick development server that serves the elements via index.html.

Internationalization

The elements are using @lit/localize for internationalization. The translations are stored in the xliff directory. There's no need to update that directory for new phrases, unless you can add the translations at the same time. See Localization for more information.

Update translations

  1. Run lit-localize extract to extract and sync the translations from the source code to the xliff directory.
  2. Translate the phrases in the xliff directory.
  3. Run lit-localize build to build the translations into the src/generated directory.

Important

lit-localize build is required to build the bundle with the translations.

Convention

Although @lit/localize gives us the flexibility to write localized strings in a casual way, we should follow a convention to keep the translations consistent.

When using msg(), a human-readable ID should be used, and it is highly recommended to also write the description to give the translators (or LLMs) more context.

// ✅ Good
msg('Not set', {
  id: 'general.fallback-title',
  desc: 'A fallback title when the title or heading of a component is not provided.',
})

// ❌ Bad
msg('Not set')