Skip to content

Conversation

@snprajwal
Copy link
Contributor

@snprajwal snprajwal commented Oct 9, 2025

Bug/issue #, if applicable: rdar://160284853

Summary

The @SupportedLanguage directive allows specifying a language that an
article is available in. It can be used within the @Metadata directive
like in the below example, where the article is made available in both
Swift and Objective-C:


@metadata {
  @SupportedLanguage(swift)
  @SupportedLanguage(objc)
}

This directive is processed when creating the topic graph node for the
article. The supported languages of an article need to be stored in the
resolved topic reference that eventually gets serialised into the render
node, which the navigator uses. When a catalog contains more than one
module, any articles present are not registered in the documentation
cache, since it is not possible to determine what module it is belongs
to. In such cases, to correctly include the set of supported languages,
they must be added to the reference in the topic graph node during
creation, rather than creating the reference and later updating this
information during registration. This patch adds the logic to store the
set of supported languages during topic node creation for all articles,
indepedent of the cache registration.

Dependencies

N/A

Testing

Unit tests have been added to test this functionality when creating the documentation node and reference for articles containing the directive.

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • Added tests
  • Ran the ./bin/test script and it succeeded
  • Updated documentation if necessary

@snprajwal snprajwal force-pushed the pnadig/article-supported-lang branch from a7af0ff to 77cc7c5 Compare October 9, 2025 17:24
@snprajwal
Copy link
Contributor Author

@swift-ci please test

@snprajwal snprajwal force-pushed the pnadig/article-supported-lang branch from 77cc7c5 to d9e38ad Compare October 14, 2025 12:15
@snprajwal
Copy link
Contributor Author

@swift-ci please test

The `@SupportedLanguage` directive allows specifying a language that an
article is available in. It can be used within the `@Metadata` directive
like in the below example, where the article is made available in both
Swift and Objective-C:

```

@metadata {
  @SupportedLanguage(swift)
  @SupportedLanguage(objc)
}
```

This directive is processed when creating the topic graph node for the
article. The supported languages of an article need to be stored in the
resolved topic reference that eventually gets serialised into the render
node, which the navigator uses. When a catalog contains more than one
module, any articles present are not registered in the documentation
cache, since it is not possible to determine what module it is belongs
to. In such cases, to correctly include the set of supported languages,
they must be added to the reference in the topic graph node during
creation, rather than creating the reference and later updating this
information during registration. This patch adds the logic to store the
set of supported languages during topic node creation for all articles,
indepedent of the cache registration.

rdar://160284853
@snprajwal snprajwal force-pushed the pnadig/article-supported-lang branch from d9e38ad to dba85cd Compare October 15, 2025 16:03
@snprajwal
Copy link
Contributor Author

@swift-ci please test

@snprajwal snprajwal requested a review from d-ronnqvist October 15, 2025 16:12
@d-ronnqvist d-ronnqvist merged commit 44f3997 into swiftlang:main Oct 15, 2025
2 checks passed
@snprajwal snprajwal deleted the pnadig/article-supported-lang branch October 15, 2025 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants