Add Slovak (sk) language support and fix getTranslationText() bug#748
Merged
Conversation
- Add translations/sk.json with full Slovak translation (~170 keys) - Wire Slovak into all 5 non-minified build files: add sk variable block, register in moduleFromTag, add sk: Slovak to getSupportedLangs() - Fix three bugs in getTranslationText() affecting all languages: missing ! negation on Object.hasOwn check, value/key swap in fallback loop, and incorrect !== -1 comparison on a boolean return value - Add Slovak demo page (demos/local-sk.html) with sign language and described video support - Add Slovak WebVTT tracks: captions, audio descriptions, chapters Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Member
|
Thanks! There's no need to make any PRs to commit to built files; as noted in my contribution guide, I prefer for built files to be omitted from all PRs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #747 (Slovak translation). This PR adds:
Bug fix in
getTranslationText()(affects all languages usingdata-lang)Three bugs in the
data-langattribute code path:!negation:Object.hasOwn(supportedLangs, this.lang)entered the"not supported" fallback even for supported languages like
skthis.lang = valueassigned the display name (e.g."Slovak") instead of the language code ("sk"), breaking the module lookupObject.hasOwn(...) !== -1—hasOwnreturns boolean, not-1Without this fix,
data-lang="sk"causes the player to fall back to Englishdespite Slovak being listed in
getSupportedLangs().Slovak registered in all non-minified build files
Added Slovak variable declarations,
moduleFromTagentry, andgetSupportedLangs()entry to:build/ableplayer.js,build/ableplayer.dist.js,build/ableplayer.esm.js,build/separate-dompurify/ableplayer.js,build/separate-dompurify/ableplayer.dist.js.(Minified files require a rebuild via
npm run build.)Slovak demo page (
demos/local-sk.html)Follows the pattern of
local-de.html. Default tracks are Slovak, Englishas fallback. Includes sign language (
data-sign-src) and described video(
data-desc-src) using existingwwa_signandwwa_describedassets.Slovak WebVTT tracks (
media/)wwa_captions_sk.vtt— captions translated from English, same timestampswwa_description_sk.vtt— audio descriptionswwa_chapters_sk.vtt— chapters: Úvod, Terrill ThompsonTest plan
demos/local-sk.htmlvia HTTP server; verify player UI is in Slovaklocal-de.htmletc.) still work