Repository navigation
feat(language): set or correct an asset's language as a BCP 47 tag with a region - #693
Merged
Merged
Conversation
…th a region
The language transcription hears stays on the asset; editors can now set or
correct it as a BCP 47 tag (en-GB, pt-BR), validated and normalized, through
PATCH /resources/{id}, the MCP tool set_language and the Details tab. A
person's language (language_set) is kept when the asset is transcribed again;
null forgets it. Stored languages stay valid; the new field is only added.
The Language filter writes tags the usual way, and a pipeline condition on en
takes en-GB and en-US too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QFUNzy1QZy5HhKAyJxTAYJ
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.
Requested by Adeel · project thread
Description
Before: an asset's language was whatever transcription detected, shown upper-cased with no way to edit it, and transcribing again (or importing its text again) overwrote it. There was no region, so British and American English, or Brazilian and European Portuguese, looked the same.
After: editors set or correct an asset's language as a BCP 47 tag, with a region when it matters. It works from the Details tab (a pencil on the Language row; Enter saves, Escape cancels), through
PATCH /api/v1/resources/<id> {"language": "en-gb"}, or with the MCP toolset_language. The tag is checked and written in its standard form (en-GB,zh-Hant-TW,es-419), and anything that isn't a tag gets a 400. A person's language is kept when the asset is transcribed or its text imported again;nullforgets it so the next transcription detects it. The row reads like "British English (en-GB) · set by a person" or "… · detected". Changes are audited; the IIIF manifest and Dublin Core record carry the tag. A pipeline step'slanguages: ["en"]condition now matchesen-GBanden-UStoo.How:
metadata.language_tagvalidates and normalizes;library.set_languagestores it with alanguage_setflag;ingest.write_transcriptkeeps a person's language.Motivation and Context
Item from the personal feature plan sheet (languages: no BCP 47 region).
Screenshots (if appropriate):
n/a
Steps to reproduce (if appropriate):
Open an English recording's Details tab, edit Language, type
en-gband press Enter: it shows "British English (en-GB) · set by a person". Transcribe it again: the language stays en-GB.Types of changes
!in the title)Checklist:
make hookschecks it on commit).tests/api/test_language.py,tests/api/test_mcp.py,__tests__/recording-language.test.tsx).docs/accordingly (docs/api.md#an-assets-language,docs/mcp.md,docs/processing.md,docs/database.md).## UnreleasedinCHANGELOG.md. Written aschangelog.d/asset-language.md, per build(release): changelog fragments in changelog.d/ instead of one Unreleased section #581.Done questions (AGENTS.md)
PATCH /resources/<id>and MCPset_language;get_recordingreturnslanguage_set..envedit or manual step.languagestays a string;language_setis a new field older rows simply lack (noted indocs/database.md).docs/requirements.mdname the checks.make openapi).en), so a region comes from a person.Local CI: the container runs several times slower than usual, so I ran the changed tests directly:
test_language.py,test_mcp.py,test_pipelines.py,test_translations.py(57 passed),recording-languageandrecording-translatejest (11 passed). ruff, mypy and tsc are clean, andmake openapishows no drift. GitHub CI decides the merge.Generated by Claude Code