Skip to content

feat(i18n): add translations for Khmer (km-KH)#2470

Open
nidexingg wants to merge 9 commits intonpmx-dev:mainfrom
nidexingg:main
Open

feat(i18n): add translations for Khmer (km-KH)#2470
nidexingg wants to merge 9 commits intonpmx-dev:mainfrom
nidexingg:main

Conversation

@nidexingg
Copy link
Copy Markdown

🔗 Linked issue

N/A

🧭 Context

Currently, npmx.dev supports several languages but lacks Khmer (Cambodian) localization. This limits accessibility for Khmer-speaking users. Adding Khmer language support improves inclusivity and aligns with the project’s internationalization goals.

📚 Description

This PR adds full support for the Khmer language (km) across the npmx.dev platform.

Changes include:

  • Added km.json to the localization folder containing Khmer translations for all existing UI keys.
  • Updated i18n configuration to include Khmer in the list of supported locales.
  • Modified the language switcher component to display “Khmer (ខ្មែរ)” as a selectable option.
  • Verified rendering and layout compatibility for Khmer text.

Why this change is required:

  • Expands accessibility for users in Cambodia and Khmer-speaking communities.
  • Strengthens project localization coverage.
  • Encourages more open-source contributions from Southeast Asia.

Testing and validation:

  • Ran existing localization tests to confirm there are no regressions.
  • Added new unit tests to verify Khmer translation loading and proper rendering.
  • Manual review by Khmer-speaking contributors to confirm translation accuracy.

Tradeoffs and follow-ups:

  • Some technical terminology still needs community review for consistency.
  • Future PR may be needed to extend documentation and contributor guidelines for new language additions.

Additional notes:
AI tools were used to assist with translation verification, but all content has been manually reviewed and refined to ensure correctness and natural phrasing. The code, translation files, and documentation reflect my own understanding and intent for this contribution.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev (canary) Ready Ready Preview, Comment Apr 12, 2026 5:06pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Apr 12, 2026 5:06pm
npmx-lunaria Ignored Ignored Apr 12, 2026 5:06pm

Request Review

@github-actions
Copy link
Copy Markdown

Hello! Thank you for opening your first PR to npmx, @nidexingg! 🚀

Here’s what will happen next:

  1. Our GitHub bots will run to check your changes.
    If they spot any issues you will see some error messages on this PR.
    Don’t hesitate to ask any questions if you’re not sure what these mean!

  2. In a few minutes, you’ll be able to see a preview of your changes on Vercel

  3. One or more of our maintainers will take a look and may ask you to make changes.
    We try to be responsive, but don’t worry if this takes a few days.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 11, 2026

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

💤 Files selected but had no reviewable changes (1)
  • i18n/locales/km-KH.json
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: aa758267-d69a-47ca-bb25-ca7fe5b7afec

📥 Commits

Reviewing files that changed from the base of the PR and between 6c604d2 and 51d8562.

📒 Files selected for processing (1)
  • i18n/locales/km-KH.json

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds Khmer locale support by registering km-KH in config/i18n.ts with its translation file and name (ភាសាខ្មែរ), causing currentLocales and the derived datetimeFormats, numberFormats, and pluralRules maps to include km-KH.

Changes

Cohort / File(s) Summary
i18n config
config/i18n.ts
Adds { code: 'km-KH', file: 'km-KH.json', name: 'ភាសាខ្មែរ' } to the locales array, which extends currentLocales and the derived format/plural maps.
Locale asset
locales/km-KH.json
Adds the Khmer translation JSON referenced by the new km-KH locale entry. (If present in the PR)

Possibly related PRs

Suggested reviewers

  • danielroe
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed The description is comprehensive and directly related to the changeset, detailing context, specific changes made, testing performed, and rationale.
Title check ✅ Passed The title clearly and accurately summarizes the main change: adding Khmer locale support (km-KH) to the i18n configuration, which aligns with the primary objective of extending localization support.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

@ghostdevv ghostdevv left a comment

Choose a reason for hiding this comment

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

👋 Hey @nidexingg, thanks for adding Khmer support!

In lieu of a CodeRabbit review (it skipped this one), I had an LLM review the translation content. Here are its findings — have a look and let me know what makes sense and what doesn't.


1. Locale display name — likely incorrect

File: config/i18n.ts:219

The display name is currently ខេមរភាសា. The standard Khmer endonym used by the Cambodian government, Unicode CLDR, and Wikipedia is ភាសាខ្មែរ (Phéasa Khmêr). The current form uses a Pali/Sanskrit-derived root in a non-standard word order that isn't commonly seen in modern usage. Could you double-check this?

2. Thai script mixed into Khmer text

File: i18n/locales/km-KH.json:323

The common.scroll_to_top value is "រំកិលទៅលើកสุต" — the last few characters (สุต) are Thai script (U+0E2A, U+0E38, U+0E15), not Khmer. Thai and Khmer look similar but they're entirely different Unicode blocks. This looks like a copy-paste or machine translation artefact. Something like "រំកិលទៅខាងលើ" would be the expected Khmer.

3. Untranslated user-facing strings

Roughly 30 strings that other established locales (e.g. ja-JP) translate have been left in English here. A few examples:

Key Current value Translated in ja-JP?
provenance_section.transparency_log_entry Transparency log entry 透明性ログエントリ
trends.average_window Average window 平均ウィンドウ
trends.smoothing Smoothing スムージング
install_scripts.title Install Scripts インストールスクリプト
dependencies.title Dependency ({count}) | Dependencies ({count}) 依存関係({count})
dependencies.list_label Package dependencies パッケージの依存関係
access.title Team Access
chart_view_combined Combined view

(Note: strings like settings.title, blog.heading, nav.settings, colour names, and brand.heading are intentionally kept in lowercase English across all locales — those are fine.)

4. Minor: English plural suffixes (not blocking)

Khmer doesn't have grammatical plurals, so the pipe-separated forms like "{count} skill អាចប្រើបាន | {count} skills អាចប្រើបាន" don't strictly need to differ between the singular and plural side. There are about 38 instances of this. It's cosmetic and won't break anything, so not blocking — just worth being aware of for future tidying.


Items 1–3 should ideally be addressed before merging. Happy to help if anything's unclear!

Copy link
Copy Markdown
Contributor

@ghostdevv ghostdevv left a comment

Choose a reason for hiding this comment

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

see above ^

@nidexingg
Copy link
Copy Markdown
Author

Hey @ghostdevv Thanks a lot for the detailed review — really appreciate the careful feedback!

I’ve gone through and fixed the issues you highlighted:

  • The locale display name has been updated to ភាសាខ្មែរ.

  • The Thai-script in "common.scroll_to_top" is now corrected to proper Khmer.

  • Most untranslated strings are now localized as well.
    For some of the remaining English terms (like package, dependency, version, commit, etc.), I intentionally kept them in English. These are technical terms that Khmer developers typically use directly in English when writing or talking about code. Translating them into Khmer would make the UI a little unclear, since the localized equivalents are uncommon and might not really convenience.
    In Cambodian developer contexts, mixing English for specialized technical terms is the standard and most natural choice, so I opted to follow that convention for better usability. We're looking forward to your reviewing on this new changes.

@ghostdevv ghostdevv changed the title feat(i18n): add new locale km-KH (🇰🇭 Khmer: National language of Cambodia) feat(i18n): add translations for Khmer (km-KH) Apr 12, 2026
Copy link
Copy Markdown
Contributor

@ghostdevv ghostdevv left a comment

Choose a reason for hiding this comment

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

thanks! A couple more things the LLM picked up on, let me know if any are wrong!


1. 🔴 Broken placeholder in a11y.approach.p2

File: i18n/locales/km-KH.json
The placeholder {about_link} doesn't match the interpolation key used by the app. Every other locale uses {about}:

Locale Value
km-KH គេហទំព័រនេះគឺជាគម្រោង {about_link}។ ...
fr-FR Ce site est un {about}. ...
ja-JP このサイトは {about} です。...
This will cause the placeholder to render as literal text or be empty at runtime.
Fix: Replace {about_link}{about}.

2. 🟡 Wrong value for about.contributors.title

File: i18n/locales/km-KH.json
This key is a section heading ("Contributors"), but the Khmer value is a "show more" string with a {count} placeholder that this key never receives:

Locale Value
km-KH ... និងអ្នកចូលរួមចំណែកចំនួន {count} នាក់ទៀត
fr-FR Contributeurs
ja-JP コントリビューター
Fix: Change to a simple label like អ្នកចូលរួមចំណែក ("Contributors").

3. 🟢 Remaining untranslated strings (non-blocking)

There are ~49 keys where km-KH has pure-English values that other locales (e.g. ja-JP) translate. The contributor's argument about keeping developer jargon in English is reasonable for some terms, but a few are general UI labels:

  • nav.settings / settings.title"settings" (ja-JP: 設定)
  • footer.keyboard_shortcuts"keyboard shortcuts" (ja-JP: キーボードショートカット)
  • a11y.footer_title"a11y" (ja-JP: アクセシビリティ)
  • compare.dependencies"Dependencies" (ja-JP: 依存関係)

@nidexingg
Copy link
Copy Markdown
Author

@ghostdevv Kindly check the new PR. Thank you for your thorough review.

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