Skip to content

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

Open
WilcoSp wants to merge 6 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 6 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)
docs.npmx.dev Ready Ready Preview, Comment Mar 6, 2026 9:06pm
npmx.dev Error Error Mar 6, 2026 9:06pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
npmx-lunaria Ignored Ignored Mar 6, 2026 9:06pm

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 29eec4fc-cb29-476c-a2c2-7a593622a50a

📥 Commits

Reviewing files that changed from the base of the PR and between 145cd00 and a51899b.

📒 Files selected for processing (1)
  • app/composables/useViewOnGitProvider.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/composables/useViewOnGitProvider.ts

📝 Walkthrough

Walkthrough

Adds a new composable useViewOnGitProvider(provider) that returns a reactive computed i18n string resolved from common.view_on.{provider} with fallback to common.view_on.git_repo. Updates components to use the new composable and replaces flat common.view_on_npm keys with 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

  • ghostdevv
  • danielroe
🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The PR description clearly explains the changes: moving translation keys for 'view on' links, creating a new composable useViewOnGitProvider, and adding translations for multiple git providers.

✏️ 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

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 8 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% 6 Missing and 1 partial ⚠️
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

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