[zh-TW] Add media player intents (transport, volume, search and play) - #4025
Merged
Conversation
…mute/volume) - Transport controls incl. context-area, name and area combos - HassSetVolume/HassSetVolumeRelative with 百分之X / X% / X趴 forms and direction words (調大|大聲一點 -> up)
The existing volume tests only used Arabic numerals (20/50), leaving two gaps: Chinese numerals, which is how people actually speak, and the ends of the 0-100 / -100-100 ranges. Both already work — this pins the behaviour so a change to the shared range lists or to hassil's number parsing cannot silently break it.
- Uses the 播放X的歌/專輯 (query-first) form: hassil's recognize_best
tie-break (wildcards, then literal chunks; list matches don't count)
means a class-first form (播放歌手五月天) can never beat the plain
播放{search_query} template, so the media_class templates carry a
required 的 to win
- media_class values use Taiwan vocabulary (影片/電影/播客|podcast/影集)
The search_query wildcard was only ever fed two plain Chinese values. Adds the cases most likely to break it: - an English query, which keeps its internal whitespace even though zh-TW sets ignore_whitespace - a query that itself contains 的, confirming the wildcard splits at the last 的 + media_class rather than the first
bluefoxlee
added a commit
that referenced
this pull request
Jul 30, 2026
…ests (#4026) The two English examples added in #4025 pass this repo's CI but fail the packaging sanity check in OHF-Voice/intents-package, because zh-TW sets ignore_whitespace and the packaged data applies it while this repo's test fixture does not. Replaces them with Chinese examples that resolve to the same value under either configuration. Co-authored-by: bluefoxlee <jerrylee@me.com>
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.
Changes
Adds the media player intents to zh-TW (Traditional Chinese), covering all 31 slot combinations
intents.yamldefines for them.Transport & volume (23 combinations, default / name_only / area_only, plus floor_only for volume)
HassMediaSearchAndPlay (8 combinations)
media_classmaps the terms people actually use: 歌手→artist, 專輯→album, 歌|歌曲→track, 播放清單|歌單→playlist, 播客→podcast, 電影→movie, 影集|電視劇→tv_show.Taiwan vocabulary: 音量 rather than 聲音 for volume, 靜音 for mute, 繼續播放 for unpause.
Testing
python3 -m script.intentfest validate --language zh-TW— All good!pytest tests --language zh-TW— 262 passedTwo commits are test-only, covering paths the happy-path tests would miss:
lists/media.yaml, or to hassil's number parsing, cannot silently break it.search_querywildcard boundaries. The wildcard was only ever fed plain Chinese values. Added an English query, which keeps its internal whitespace even though zh-TW setsignore_whitespace, and a query that itself contains 的 (播放五月天的歌的專輯), confirming the wildcard splits at the last 的 + media_class rather than the first.Also verified against a live Home Assistant instance with a custom
home-assistant-intentsbuild: