Skip to content

Post language metadata is not correctly federated to Hollo #647

Closed

Description

@naskya

Description of a bug

The language information of posts is not correctly preserved when federating:

  • from one Hollo instance to another Hollo instance
  • from Mastodon to a Hollo instance

The receiving Hollo instance does not correctly interpret the language metadata of federated posts.

Tested versions

Some context

I noticed that Mastodon uses zh-YUE as the Cantonese language tag, which is rejected by the Intl.Locale constructor:

In that issue, I cited Hollo as an example of an ActivityPub implementation that uses Intl.Locale. I verified locally that language information from Mastodon posts was not being federated correctly to Hollo, and wrote the description based on that finding.

However, I was too hasty and did not verify whether language information was federated correctly from Mastodon to Hollo for languages other than Cantonese. I ran control tests with other languages (e.g., en, ja, and zh-TW) and confirmed that the language metadata is not recognized correctly in any of these cases.

Conversely, I also confirmed that language information successfully federated from Hollo to Mastodon, as long as the language is supported by Mastodon.

Activity

  1. naskya commented on Oct 3, 2026

    @naskya
    ContributorAuthor

    I think the cause is that persistPost() takes a remote post’s language from the singular content/summary, but Mastodon (and Hollo itself) sends data that doesn’t match this after JSON-LD expansion.

    language:
    object.content instanceof LanguageString
    ? object.content.locale.toString()
    : object.summary instanceof LanguageString
    ? object.summary.locale.toString()
    : null,

  2. self-assigned this
    on Oct 4, 2026
  3. added theissue type on Oct 4, 2026
  4. dahlia commented on Oct 4, 2026

    @dahlia
    Member

    Thanks for the report, and for running the control tests with other languages. That's what made it clear this wasn't only about Cantonese.

    There turn out to be two separate problems here.

    The first one is in Hollo, and your guess was right. Mastodon and Hollo both send content alongside contentMap, so after JSON-LD expansion the content property holds two values: a plain string and a language-tagged one. object.content returns the first, which is the plain string, so the instanceof LanguageString check never passes and the language is always stored as null. This affects every language, including posts from other Hollo instances. The fix is to look through object.contents and object.summaries for a LanguageString instead.

    The second one is specific to zh-YUE and lives in Fedify. zh-YUE is actually a valid BCP 47 tag (an extended language subtag, which RFC 5646 canonicalizes to yue), but Intl.Locale only accepts Unicode BCP 47 locale identifiers, which don't allow extlangs. Fedify currently drops such values without any warning. I've filed fedify-dev/fedify#1229 to have Fedify normalize extlang tags before passing them to Intl.Locale, so Cantonese posts from Mastodon will keep their language whether or not mastodon/mastodon#40840 gets resolved.

    I'll fix that in a Fedify patch release shortly, and then ship both fixes together in a Hollo 0.9.x patch release.

  5. dahlia commented on Oct 5, 2026

    @dahlia
    Member

    Fixed in Hollo 0.9.22.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Fields

Priority

None yet

Effort

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions