Negotiate labels over ordered language preferences ($ac:langs)#89
Open
namedgraph wants to merge 5 commits into
Open
Negotiate labels over ordered language preferences ($ac:langs)#89namedgraph wants to merge 5 commits into
namedgraph wants to merge 5 commits into
Conversation
- Add dual-sourced $ac:langs param in imports/default.xsl: navigator.languages primary subtags client-side (SaxonJS), Accept-Language server-side (SAXON), plus $ac:lang for collation/formatting - Per-vocab ac:label/ac:description templates negotiate over the ordered preference list; fallback is untagged-else-first — always a single literal - Drop per-file $ldt:lang params; $ldt:lang remains the negotiated Content-Language carrier, declared in imports/default.xsl - Add AC.langs term; XSLTWriterBase passes the request's q-sorted Accept-Language primary subtags as the ac:langs stylesheet param Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
SaxonJS 3 converts the JS array to a sequence of xs:untypedAtomic, so the JS-style length/index read threw XPTY0004 and $ac:langs evaluated empty — suppressing every language-tagged property value client-side. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
No SaxonJS/browser knowledge in Web-Client — the ixsl-sourced declaration moves to LinkedDataHub's client.xsl, which overrides this default by import precedence. Drops the use-when pair and the ixsl namespace. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ranch Web-Client is strictly SSR. The stub now just terminates if invoked as XSLT: server-side the registered UUID extension function overrides it, client-side stylesheets override it by import precedence. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The writer no longer passes the negotiated Content-Language as a stylesheet param — Accept-Language (ac:langs) is the single input, and $ac:lang = ($ac:langs[1], 'en')[1] is derived, not passed. <html lang>, format-date/format-dateTime, sort collations and the TableDataCell language filters all use $ac:lang; the remaining dual use-when sort pairs are collapsed. $ldt:lang survives only in commented-out templates. Co-Authored-By: Claude Fable 5 <noreply@anthropic.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.
Summary
$ac:langs— an ordered language preference list (negotiation input), distinct from$ldt:langwhich carries the negotiatedContent-Language(output). Declared inimports/default.xslwith a product-agnostic default derived from$ldt:lang; consumers override it:XSLTWriterBasepasses the request's q-sortedAccept-Languageprimary subtags (newAC.langsterm), and client-side stylesheets (e.g. LinkedDataHub'sclient.xsl) override it with the browser'snavigator.languages.ac:label/ac:descriptiontemplate pairs (rdfs,dc,dct,skos,sioc,foaf,doap,schema) from single-language$ldt:langfiltering to ordered negotiation: first preferred language with a match wins; fallback is untagged-else-first — always exactly one literal. Fixes labels disappearing (or all languages being emitted by downstream overrides) when the client's top preference has no match.@ltliteral wins for anlt-preferring user even thoughContent-Languagenegotiates toen/es.ixsl/browser references remain. Theac:uuid()stub drops its SaxonJS branch (client-side implementations override by import precedence; server-side the registeredUUIDextension function wins as before).Test plan
Accept-Language: es,lt;q=0.9,en-US;q=0.8,en;q=0.7,lt,en-US;q=0.9,en;q=0.8, anden-US,en;q=0.9: UI chrome and data labels each resolve to the first available preferred language, single literal, SSR/CSR consistent.🤖 Generated with Claude Code