GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: add i18n support with zh-Hant and zh-CN translations by Jacky97s · Pull Request #899 · OpenAPITools/openapi-diff

Conversation

@Jacky97s

@Jacky97s Jacky97s commented Mar 20, 2026 •
edited by cubic-dev-ai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Summary

  • Add I18n utility class with UTF-8 ResourceBundle loading and locale parsing
  • Extract all user-facing strings from renderers (Console, Markdown, HTML, AsciiDoc) into .properties resource bundles
  • Add --lang CLI option to select output language (en, zh-Hant, zh-CN)
  • Add CJK-aware display width calculation for correct console alignment with Chinese characters
  • Add Traditional Chinese (zh-TW) and Simplified Chinese (zh-CN) translation files
  • Set HTML lang attribute dynamically based on locale

Usage

# Default (English)
openapi-diff old.yaml new.yaml

# Traditional Chinese
openapi-diff old.yaml new.yaml --lang zh-Hant

# Simplified Chinese
openapi-diff old.yaml new.yaml --lang zh-CN

Test plan

  • All 266 existing tests pass with default English locale
  • Verify console output alignment with Chinese characters
  • Verify HTML output includes correct lang attribute for each locale
  • Verify --lang CLI option selects correct translations

Summary by cubic

Add internationalization across renderers and the CLI with English, Traditional Chinese (zh-Hant), and Simplified Chinese (zh-CN). Adds a --lang option, CJK-aware console alignment, per-locale HTML lang, and hardens i18n with thread-safe and null-safe handling.

  • New Features

    • Introduced I18n utility with UTF-8 ResourceBundle loading and locale parsing.
    • Replaced hardcoded strings in Console/Markdown/HTML/AsciiDoc with bundle messages.
    • Added translations: messages.properties (en), messages_zh_TW.properties (zh-Hant), messages_zh_CN.properties (zh-CN).
    • Added --lang CLI option (en, zh-Hant, zh-CN), accepts zh-TW/zh-Hans aliases.
    • Implemented CJK-aware display width for proper console alignment.
    • HTML output now sets the lang attribute based on the selected locale.
  • Bug Fixes

    • Prevented NPEs by adding null checks to CJK centering helpers.
    • Made I18n locale and bundle handling thread-safe (volatile fields, synchronized setLocale).

Written for commit da71782. Summary will update on new commits.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Jacky97s added 3 commits March 20, 2026 12:18
@Jacky97s Jacky Tan
feat: add i18n infrastructure for multilingual output
8ffe9dc
- Add I18n utility class with UTF-8 ResourceBundle loading and locale parsing
- Add English messages.properties as default resource bundle
- Replace hardcoded strings in ConsoleRender, MarkdownRender, HtmlRender, AsciidocRender with I18n.getMessage() calls
- Add CJK-aware display width calculation for correct console alignment
- Add --lang CLI option to select output language
- Set HTML lang attribute dynamically based on locale
@Jacky97s Jacky Tan
feat: add Traditional Chinese (zh-Hant) translation
c53cf82
- Add messages_zh_TW.properties with full Traditional Chinese translations
@Jacky97s Jacky Tan
feat: add Simplified Chinese (zh-CN) translation and Chinese locale s…
b08e836
…upport

- Add messages_zh_CN.properties with full Simplified Chinese translations
- Add zh-Hant, zh-TW, zh-Hans, zh-CN locale parsing to I18n
cubic-dev-ai[bot]
cubic-dev-ai Bot reviewed Mar 20, 2026
View reviewed changes

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 10 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="core/src/main/java/org/openapitools/openapidiff/core/output/ConsoleRender.java">

<violation number="1" location="core/src/main/java/org/openapitools/openapidiff/core/output/ConsoleRender.java:362">
P2: New CJK centering helper is not null-safe and can throw NPE during rendering/formatting.</violation>
</file>

<file name="core/src/main/java/org/openapitools/openapidiff/core/output/I18n.java">

<violation number="1" location="core/src/main/java/org/openapitools/openapidiff/core/output/I18n.java:20">
P2: `I18n` uses unsynchronized mutable static locale/bundle state, which is not thread-safe and can leak or mismatch language state across concurrent operations.</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Add one-off context when rerunning by tagging @cubic-dev-ai with guidance or docs links (including llms.txt)
  • Ask questions if you need clarification on any suggestion

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread core/src/main/java/org/openapitools/openapidiff/core/output/ConsoleRender.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread core/src/main/java/org/openapitools/openapidiff/core/output/I18n.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

claude and others added 2 commits March 20, 2026 14:35
@claude
Fix null-safety in CJK centering and thread-safety in I18n
e00b70e
- Add null checks to centerCjk() and displayWidth() to prevent NPE
  when title or text is null during rendering
- Make I18n locale/bundle fields volatile and setLocale() synchronized
  to prevent state mismatch across concurrent operations

https://claude.ai/code/session_01XTXX1WQecRWzUdK5ewwnrZ
@Jacky97s
Merge pull request #1 from Jacky97s/claude/fix-safety-issues-O6f2h
da71782
@Jacky97s

Jacky97s commented Mar 20, 2026

Copy link
Copy Markdown
Author

@cubic-dev-ai

review again

cubic-dev-ai[bot] reacted with eyes emoji
All reactions
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cubic-dev-ai

cubic-dev-ai Bot commented Mar 20, 2026

Copy link
Copy Markdown

@cubic-dev-ai

review again

@Jacky97s I have started the AI code review. It will take a few minutes to complete.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cubic-dev-ai[bot]
cubic-dev-ai Bot reviewed Mar 20, 2026
View reviewed changes

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 10 files

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
DrSatyr

This comment was marked as duplicate.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

DrSatyr
DrSatyr reviewed May 7, 2026
View reviewed changes
Comment thread README.md
[![Contribute with Gitpod](https://img.shields.io/badge/Contribute%20with-Gitpod-908a85?logo=gitpod)](https://gitpod.io/#https://github.com/OpenAPITools/openapi-diff)
[![Join the Slack chat room](https://img.shields.io/badge/Slack-Join%20the%20chat%20room-orange)](https://join.slack.com/t/openapi-generator/shared_invite/zt-12jxxd7p2-XUeQM~4pzsU9x~eGLQqX2g)
[Contribute with Gitpod](https://gitpod.io/#https://github.com/OpenAPITools/openapi-diff)
[Join the Slack chat room](https://join.slack.com/t/openapi-generator/shared_invite/zt-12jxxd7p2-XUeQM~4pzsU9x~eGLQqX2g)

@DrSatyr DrSatyr May 7, 2026

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This replaces the badge image links with plain text links for Build, Sonar, Maven Central, Gitpod, Slack, and Docker. That removes the visible badges from the rendered README and appears unrelated to the i18n feature. Please revert the README formatting-only changes, or at least keep the existing badge image syntax.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

@DrSatyr DrSatyr DrSatyr left review comments
@cubic-dev-ai cubic-dev-ai[bot] cubic-dev-ai[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@Jacky97s @DrSatyr @claude
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.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.