Skip to content

Add localization support#157

Merged
MattiasBuelens merged 78 commits into
mainfrom
i18n
May 29, 2026
Merged

Add localization support#157
MattiasBuelens merged 78 commits into
mainfrom
i18n

Conversation

@MattiasBuelens
Copy link
Copy Markdown
Collaborator

@MattiasBuelens MattiasBuelens commented May 22, 2026

This adds a Locale interface, which contains all human-readable messages used by the UI. Users can register their own locale by calling addLocale(), and then select it by setting the lang attribute of their <theoplayer-ui> or <theoplayer-default-ui>.

Fixes #39.

Todo:

  • Write a localization guide

@MattiasBuelens
Copy link
Copy Markdown
Collaborator Author

@ceyhun-o Good catch, I forgot about that! Language names in track labels should now be localizable.

Or should this not happen because they already have a NAME defined in the manifest?

I added a bit of extra code in e472846 to detect when track.label exactly matches the non-localized (i.e. English) language name, so we will still go through the localization logic. 😉

We may want to port that to Android and React Native too... 🤔

@MattiasBuelens MattiasBuelens marked this pull request as ready for review May 28, 2026 13:23
@MattiasBuelens
Copy link
Copy Markdown
Collaborator Author

Documentation has been updated too now. This is ready for review. 😉

Comment thread src/components/TimeDisplay.ts Outdated
Comment thread examples/locale/nl.js Outdated
MattiasBuelens and others added 2 commits May 29, 2026 09:25
Co-authored-by: ceyhun-o <74964451+ceyhun-o@users.noreply.github.com>
@ceyhun-o ceyhun-o self-requested a review May 29, 2026 08:47
@MattiasBuelens MattiasBuelens merged commit dd9123d into main May 29, 2026
1 check passed
@MattiasBuelens MattiasBuelens deleted the i18n branch May 29, 2026 13:58
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

Successfully merging this pull request may close these issues.

Localization

2 participants