Skip to content

feat: adding missing english translations for other git providers#1962

Open
WilcoSp wants to merge 10 commits intonpmx-dev:mainfrom
WilcoSp:fix/missing_view_on_git
Open

feat: adding missing english translations for other git providers#1962
WilcoSp wants to merge 10 commits intonpmx-dev:mainfrom
WilcoSp:fix/missing_view_on_git

Conversation

@WilcoSp
Copy link
Contributor

@WilcoSp WilcoSp commented Mar 6, 2026

🔗 Linked comment

Resolved the issue I had raised in this comment & this discord message

🧭 Context

Currently at the package page when a package doesn't have a readme.md the text "No README available." with a link that has the text "View on GitHub" but without any checks what the git provider is & the translations for the git providers are missing.

📚 Description

I've moved the translation of "View on GitHub" from "package.readme.view_on_github" to "common_view_on.github" & created the English translations for the other git providers + a fallback to "common.view_on"
I've also created the composable "useViewOnGitProvider" which will give the "common.view_on" translation based on the given git provider.

I've also changed the key for "common.view_on_npm" to "common.view_on.npm" because of the added translations

I've chosen to have the translations at "common.view_on.*" instead of "package.readme.view_on.*" because for changelog/releases these translations are also needed for a button at the top right that navigates to the changelog.md or releases, here examples with Vue & Nuxt

…llback & created a composable to get the correct translation.

fixed that package page only said "view on github"
@vercel
Copy link

vercel bot commented Mar 6, 2026

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

Project Deployment Actions Updated (UTC)
npmx.dev Error Error Mar 7, 2026 11:48am
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Mar 7, 2026 11:48am
npmx-lunaria Ignored Ignored Mar 7, 2026 11:48am

Request Review

@WilcoSp WilcoSp changed the title fix: adding missing english translations for other git providers fix(i18n): adding missing english translations for other git providers Mar 6, 2026
@github-actions
Copy link

github-actions bot commented Mar 6, 2026

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

File Note
i18n/locales/ar.json Localization changed, will be marked as complete.
i18n/locales/az-AZ.json Localization changed, will be marked as complete.
i18n/locales/bg-BG.json Localization changed, will be marked as complete.
i18n/locales/bn-IN.json Localization changed, will be marked as complete.
i18n/locales/cs-CZ.json Localization changed, will be marked as complete.
i18n/locales/de-DE.json Localization changed, will be marked as complete.
i18n/locales/en.json Source changed, localizations will be marked as outdated.
i18n/locales/es.json Localization changed, will be marked as complete.
i18n/locales/fr-FR.json Localization changed, will be marked as complete.
i18n/locales/hi-IN.json Localization changed, will be marked as complete.
i18n/locales/hu-HU.json Localization changed, will be marked as complete.
i18n/locales/id-ID.json Localization changed, will be marked as complete.
i18n/locales/it-IT.json Localization changed, will be marked as complete.
i18n/locales/ja-JP.json Localization changed, will be marked as complete.
i18n/locales/kn-IN.json Localization changed, will be marked as complete.
i18n/locales/mr-IN.json Localization changed, will be marked as complete.
i18n/locales/nb-NO.json Localization changed, will be marked as complete.
i18n/locales/ne-NP.json Localization changed, will be marked as complete.
i18n/locales/pl-PL.json Localization changed, will be marked as complete.
i18n/locales/pt-BR.json Localization changed, will be marked as complete.
i18n/locales/ru-RU.json Localization changed, will be marked as complete.
i18n/locales/ta-IN.json Localization changed, will be marked as complete.
i18n/locales/te-IN.json Localization changed, will be marked as complete.
i18n/locales/tr-TR.json Localization changed, will be marked as complete.
i18n/locales/uk-UA.json Localization changed, will be marked as complete.
i18n/locales/zh-CN.json Localization changed, will be marked as complete.
i18n/locales/zh-TW.json Localization changed, will be marked as complete.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 6, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a new composable useViewOnGitProvider(provider) that returns a computed i18n string resolved from common.view_on.{provider} with fallback to common.view_on.git_repo. Updates several page components to use the new composable and changes static translation keys from common.view_on_npm / package.readme.view_on_github to the nested common.view_on structure. Updates many locale JSON files and i18n/schema.json to remove common.view_on_npm, add common.view_on (multiple provider keys) and remove package.readme.view_on_github.

Possibly related PRs

Suggested labels

i18n

Suggested reviewers

  • danielroe
  • ghostdevv
🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The pull request description clearly explains the context, changes, and rationale for restructuring translation keys and creating a new composable.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 38b8a77f-e181-4a0a-968c-1fb505432735

📥 Commits

Reviewing files that changed from the base of the PR and between 58da597 and 035ba9f.

📒 Files selected for processing (32)
  • app/composables/useViewOnGitProvider.ts
  • app/pages/org/[org].vue
  • app/pages/package/[[org]]/[name].vue
  • app/pages/~[username]/index.vue
  • i18n/locales/ar.json
  • i18n/locales/az-AZ.json
  • i18n/locales/bg-BG.json
  • i18n/locales/bn-IN.json
  • i18n/locales/cs-CZ.json
  • i18n/locales/de-DE.json
  • i18n/locales/en.json
  • i18n/locales/es.json
  • i18n/locales/fr-FR.json
  • i18n/locales/hi-IN.json
  • i18n/locales/hu-HU.json
  • i18n/locales/id-ID.json
  • i18n/locales/it-IT.json
  • i18n/locales/ja-JP.json
  • i18n/locales/kn-IN.json
  • i18n/locales/mr-IN.json
  • i18n/locales/nb-NO.json
  • i18n/locales/ne-NP.json
  • i18n/locales/pl-PL.json
  • i18n/locales/pt-BR.json
  • i18n/locales/ru-RU.json
  • i18n/locales/ta-IN.json
  • i18n/locales/te-IN.json
  • i18n/locales/tr-TR.json
  • i18n/locales/uk-UA.json
  • i18n/locales/zh-CN.json
  • i18n/locales/zh-TW.json
  • i18n/schema.json

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 627000b8-ec1f-4bc7-a3f6-ab87a9223bea

📥 Commits

Reviewing files that changed from the base of the PR and between 035ba9f and e2398c4.

📒 Files selected for processing (1)
  • i18n/locales/en.json

"error": "Error"
"error": "Error",
"view_on": {
"npm": "view on npm",
Copy link
Contributor

@coderabbitai coderabbitai bot Mar 6, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Inconsistent capitalisation: "view" should be "View".

All other entries in view_on start with uppercase "View on …", but the npm entry uses lowercase "view on npm". For UI consistency, capitalise "View" while keeping "npm" lowercase per its branding.

✏️ Proposed fix
-      "npm": "view on npm",
+      "npm": "View on npm",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"npm": "view on npm",
"npm": "View on npm",

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's "view" instead of "View" because it was originally like that, the same for github it's "View" because before moving the translation it also was with "View"

Copy link
Contributor

Choose a reason for hiding this comment

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

@WilcoSp, understood — the casing is intentional, preserving the original values from before the keys were moved. Thanks for the context!


✏️ Learnings added
Learnt from: WilcoSp
Repo: npmx-dev/npmx.dev PR: 1962
File: i18n/locales/en.json:194-194
Timestamp: 2026-03-06T16:08:13.589Z
Learning: In `i18n/locales/en.json`, the `common.view_on.npm` entry intentionally uses lowercase "view on npm" (matching its original casing from `common.view_on_npm`), while `common.view_on.github` uses "View on GitHub" (uppercase, matching its original casing from `package.readme.view_on_github`). The inconsistency is deliberate and should not be flagged in future reviews.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: serhalp
Repo: npmx-dev/npmx.dev PR: 1183
File: lunaria/files/uk-UA.json:305-318
Timestamp: 2026-02-08T18:44:10.538Z
Learning: In the npmx.dev project, new or changed entries in i18n translation files (locale JSON files) may be omitted from non-English languages. Translations are not completed in-band in the same PR and are tracked elsewhere. It is acceptable for non-English locale files to be missing keys that exist in English locale files.

Learnt from: userquin
Repo: npmx-dev/npmx.dev PR: 1096
File: i18n/locales/es-419.json:34-41
Timestamp: 2026-02-06T14:53:23.339Z
Learning: In the npmx.dev project, when using country locale variants (e.g., es-419, es-ES), place only translations that differ from the base language in variant JSON files (e.g., es-419.json). The base file (es.json) is loaded first, then the variant file overlays any keys it defines. This behavior is provided by vue-i18n's multiple-files feature. See CONTRIBUTING.md under 'Country variants (advanced)' for details.

@codecov
Copy link

codecov bot commented Mar 6, 2026

Codecov Report

❌ Patch coverage is 0% with 33 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
app/composables/useViewOnGitProvider.ts 0.00% 29 Missing and 3 partials ⚠️
app/pages/package/[[org]]/[name].vue 0.00% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@WilcoSp WilcoSp changed the title fix(i18n): adding missing english translations for other git providers feat(i18n): adding missing english translations for other git providers Mar 6, 2026
@WilcoSp WilcoSp changed the title feat(i18n): adding missing english translations for other git providers feat: adding missing english translations for other git providers Mar 6, 2026
case 'tangled':
return t('common.view_on.tangled')
}
return t('common.view_on.git_repo')
Copy link
Member

@userquin userquin Mar 6, 2026

Choose a reason for hiding this comment

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

If we have string & {}, can we use te fromuseI18n to check if the key exists? Otherwise return gihub

Copy link
Member

@userquin userquin Mar 6, 2026

Choose a reason for hiding this comment

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

return uProvider && te(`common.view_on.${uProvider}`) ? t(`common.view_on.${uProvider}`) : t('common.view_on.git_repo')

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll change it to use te but I do think it's best to return "Git repository" instead of Github as it is closer to the truth than returning github by default

Copy link
Member

@userquin userquin Mar 6, 2026

Choose a reason for hiding this comment

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

Add the case to the swtich (without default), then add console.warn (add eslint rule to ignore that console.warn) and return the value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've figured out that the keys can also be referenced in comments, that way 'te' can still be used

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
app/composables/useViewOnGitProvider.ts (1)

23-34: The comment-only provider list is easy to forget to update.

If the i18n report needs static references, consider moving these provider ids into a small shared constant or fixture. That gives you one source of truth instead of a third hard-coded copy alongside the locale/schema entries.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 958f2467-3139-42db-aecf-97866c4cf639

📥 Commits

Reviewing files that changed from the base of the PR and between a51899b and 5d19137.

📒 Files selected for processing (1)
  • app/composables/useViewOnGitProvider.ts

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