Skip to content

Translate qualifierMessage#1249

Closed
dsuket wants to merge 1 commit intoPaloAltoNetworks:mainfrom
dsuket:translate-QualifierMessage
Closed

Translate qualifierMessage#1249
dsuket wants to merge 1 commit intoPaloAltoNetworks:mainfrom
dsuket:translate-QualifierMessage

Conversation

@dsuket
Copy link
Copy Markdown
Contributor

@dsuket dsuket commented Nov 18, 2025

Description

  • I implemented internationalization for QualifierMessage.
  • I moved the output of QualifierMessage from the plugin to the theme side.
    • Along with this change, I removed unnecessary methods from the plugin.
  • Added the ja resource file.
  • Fix snapshot

Motivation and Context

The QualifierMessage was not internationalized, so I fixed it.

How Has This Been Tested?

  • Updated and executed the tests.
  • I ran it locally and checked.

Screenshots (if appropriate)

スクリーンショット 2025-11-18 9 21 43

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes if appropriate.
  • All new and existing tests passed.

@dsuket dsuket marked this pull request as ready for review November 18, 2025 00:27
@dsuket dsuket force-pushed the translate-QualifierMessage branch from 5b027a6 to b6afb5e Compare November 18, 2025 00:32
@dsuket dsuket changed the title translate QualifierMessage Translate qualifierMessage Nov 18, 2025
@github-actions
Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit b6afb5e):

https://docusaurus-openapi-36b86--pr1249-5y63xwne.web.app

(expires Thu, 15 Jan 2026 22:20:59 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: bf293780ee827f578864d92193b8c2866acd459f

@sserrata
Copy link
Copy Markdown
Member

Thanks @dsuket! The i18n approach looks solid — moving translatable strings from the plugin to the theme is the right move.

Questions before merging:

  • Demo config change — Adding i18n: { locales: ["en", "ja"] } enables multi-locale builds for the demo site. Is this intentional going forward, or was it just for testing? If just for testing, please remove it. If intentional, please document why in the PR description.
  • String coverage — Are all hardcoded strings in getQualifierMessage now translatable? (e.g., "non-empty", ">= X characters", "Value must match regular expression")
  • Plugin export — Is getQualifierMessage still exported from the plugin for backward compatibility, or is it being removed? Should we flag it for future cleanup?

@sserrata sserrata self-assigned this Dec 17, 2025
@sserrata sserrata added the reviewing 👀 Undergoing manual audit to determine if issue should still be active label Dec 17, 2025
sserrata added a commit that referenced this pull request Mar 30, 2026
Move qualifier-message rendering fully to the theme layer so that
Docusaurus i18n can translate the human-readable constraint strings:
- "characters" (minLength / maxLength)
- "non-empty" (minLength === 1)
- "Value must match regular expression" (pattern)

Architecture:
- `getQualifierMessage` is removed from the plugin and kept only in
  the theme (`docusaurus-theme-openapi-docs/src/markdown/schema.ts`),
  where `translate()` is available at render time.
- `SchemaItem` now computes `qualifierMessage` from its `schema` prop
  when the caller doesn't pass one explicitly, so all callers are
  simplified — no more `qualifierMessage={getQualifierMessage(schema)}`
  at every call site.
- Plugin `createSchema.ts` and `Schema/index.tsx` drop all
  `qualifierMessage` prop passes; the theme component handles it.
- `utils.ts` `create()` skips props with `undefined` values, cleaning
  up generated MDX.
- Dead code removed: `humanizeConstraints`, `humanizeNumberRange`, and
  related helpers were exported but unused.

Translation IDs added:
  theme.openapi.schemaItem.characters
  theme.openapi.schemaItem.nonEmpty
  theme.openapi.schemaItem.expression

Demo directory intentionally untouched (no locale config added).

Closes #1249. Credit: @dsuket

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sserrata
Copy link
Copy Markdown
Member

Thanks @dsuket! The approach is solid. Since this PR has been open for a while without updates, I've taken ownership and applied the changes in #1364 with one cleanup: the demo i18n config changes are excluded (they were for local testing and shouldn't be part of the feature). All the architectural changes — moving getQualifierMessage to the theme layer, the SchemaItem fallback computation, and the three new translation IDs — are included.

Closing this in favour of #1364.

@sserrata sserrata closed this Mar 30, 2026
sserrata added a commit that referenced this pull request Mar 30, 2026
Move qualifier-message rendering fully to the theme layer so that
Docusaurus i18n can translate the human-readable constraint strings:
- "characters" (minLength / maxLength)
- "non-empty" (minLength === 1)
- "Value must match regular expression" (pattern)

Architecture:
- `getQualifierMessage` is removed from the plugin and kept only in
  the theme (`docusaurus-theme-openapi-docs/src/markdown/schema.ts`),
  where `translate()` is available at render time.
- `SchemaItem` now computes `qualifierMessage` from its `schema` prop
  when the caller doesn't pass one explicitly, so all callers are
  simplified — no more `qualifierMessage={getQualifierMessage(schema)}`
  at every call site.
- Plugin `createSchema.ts` and `Schema/index.tsx` drop all
  `qualifierMessage` prop passes; the theme component handles it.
- `utils.ts` `create()` skips props with `undefined` values, cleaning
  up generated MDX.
- Dead code removed: `humanizeConstraints`, `humanizeNumberRange`, and
  related helpers were exported but unused.

Translation IDs added:
  theme.openapi.schemaItem.characters
  theme.openapi.schemaItem.nonEmpty
  theme.openapi.schemaItem.expression

Demo directory intentionally untouched (no locale config added).

Closes #1249. Credit: @dsuket

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
sserrata added a commit that referenced this pull request Mar 30, 2026
…ect (#1365)

* feat(i18n): make QualifierMessage strings translatable

Move qualifier-message rendering fully to the theme layer so that
Docusaurus i18n can translate the human-readable constraint strings:
- "characters" (minLength / maxLength)
- "non-empty" (minLength === 1)
- "Value must match regular expression" (pattern)

Architecture:
- `getQualifierMessage` is removed from the plugin and kept only in
  the theme (`docusaurus-theme-openapi-docs/src/markdown/schema.ts`),
  where `translate()` is available at render time.
- `SchemaItem` now computes `qualifierMessage` from its `schema` prop
  when the caller doesn't pass one explicitly, so all callers are
  simplified — no more `qualifierMessage={getQualifierMessage(schema)}`
  at every call site.
- Plugin `createSchema.ts` and `Schema/index.tsx` drop all
  `qualifierMessage` prop passes; the theme component handles it.
- `utils.ts` `create()` skips props with `undefined` values, cleaning
  up generated MDX.
- Dead code removed: `humanizeConstraints`, `humanizeNumberRange`, and
  related helpers were exported but unused.

Translation IDs added:
  theme.openapi.schemaItem.characters
  theme.openapi.schemaItem.nonEmpty
  theme.openapi.schemaItem.expression

Demo directory intentionally untouched (no locale config added).

Closes #1249. Credit: @dsuket

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(license): support SPDX identifier field in OAS v3.1.0 License Object

Adds rendering support for the `identifier` field introduced in OAS v3.1.0,
which is mutually exclusive with `url`. When present, links to the canonical
SPDX license page at https://spdx.org/licenses/<identifier>.html.

Closes #1319

* test(license): add demo test spec for SPDX identifier support

Adds licenseIdentifier.yaml to demo/examples/tests to verify that a spec
using license.identifier renders a clickable SPDX license link correctly.

Related to #1319

* test(license): add licenseUrl.yaml for regression check alongside identifier test

Related to #1319

* fix(types): add identifier field to LicenseObject

Required for createLicense.ts to compile after adding SPDX identifier support.

Closes #1319

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

reviewing 👀 Undergoing manual audit to determine if issue should still be active

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants