-
-
Notifications
You must be signed in to change notification settings - Fork 234
refactor: generalize i18n keys for download trend charts #1183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
i18n/locales/en.json
Outdated
| "no_data": "No {facet} data available", | ||
| "y_axis_label": "{granularity} {facet}", |
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.
Note: to err on the safe side, I deleted all the modal_title and no_data translations (for languages I don't speak fluently), as I parameterized in with {facet} and I didn't feel confident doing a straight replacement of "downloads" with {facet}
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.
I changed my mind about no_data. Since it only gets show when no data at all can be rendered in the chart, I just generalized the message instead of parameterizing it with facet.
| "y_axis_label": "{granularity} downloads", | ||
| "date_range": "{start} to {end}", | ||
| "date_range_multiline": "{start}\nto {end}", | ||
| "download_file": "Download {fileType}", |
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.
Confusingly, this is not about downloads (the facet); this is about downloading the data in the trend chart. So it goes under trends, not downloads 😆.
f83c1fc to
c18de6b
Compare
📝 WalkthroughWalkthroughThis change renames i18n keys used by download-related UI from the package.downloads namespace to package.trends (and in some locales to downloads.trends). The edits update three Vue components (app/components/Package/DownloadAnalytics.vue, app/components/Package/WeeklyDownloadStats.vue, app/pages/compare.vue) to reference the new keys and adjust CSV/date-range templates and axis/legend labels. Numerous locale JSON and lunaria translation files were reorganised to move date-range, granularity and related strings into a trends block. No control flow or public code signatures were changed. Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 1✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
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.
Actionable comments posted: 11
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
lunaria/files/es-419.json (1)
375-392:⚠️ Potential issue | 🔴 CriticalAdd missing translation keys to
package.trendssection.The keys
y_axis_labelandno_dataare actively used inDownloadAnalytics.vue(lines 1363 and 1758) but missing from thees-419.jsontrends section. Users will see untranslated key fallbacks. Add these keys with Spanish translations:
"y_axis_label": "{granularity} {facet}"(or similar pattern matching Spanish word order)"no_data": "No hay datos de {facet} disponibles"(or equivalent)Reference the English (
en-US.json) or French (fr-FR.json) locale files for the expected format.lunaria/files/hi-IN.json (1)
332-350:⚠️ Potential issue | 🟡 MinorAdd missing trends translations to hi-IN.json
This locale is missing four keys from en-US.json's package.trends block:
legend_estimation,no_data,y_axis_label, anditems.downloads. These keys are also missing across most other non-English locales (a systematic pattern), suggesting they may be recently added to the base language. Please add translations for these keys or confirm they should remain untranslated.
🧹 Nitpick comments (1)
i18n/locales/te-IN.json (1)
250-268: Keep te-IN as an override-only file.These new keys should live in the base
te.jsonunless they are India‑specific wording. Otherwise, the variant file will duplicate the base and drift over time. Please move shared strings to the base locale and keep only true overrides here.
Based on learnings: 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; the base file is loaded first and the variant overlays keys it defines.
|
would you look at the test failures? 🙏 my guess is that we're missing some keys somewhere ... or something. |
|
I run the test locally and found this failed test in <testsuite name="test/nuxt/components/PackageWeeklyDownloadStats.spec.ts" timestamp="2026-02-08T09:56:05.377Z" hostname="bell" tests="2" failures="1" errors="0" skipped="0" time="0.025">
<testcase classname="test/nuxt/components/PackageWeeklyDownloadStats.spec.ts" name="PackageWeeklyDownloadStats > hides the section when weekly downloads are empty" time="0.0188">
<failure message="expected 'Weekly Downloads No data available' to contain 'No download data available'" type="AssertionError">
AssertionError: expected 'Weekly Downloads No data available' to contain 'No download data available'
Expected: "No download data available"
Received: "Weekly Downloads No data available"
❯ test/nuxt/components/PackageWeeklyDownloadStats.spec.ts:43:4
❯ node_modules/.pnpm/@voidzero-dev+vite-plus-test@0.0.0-833c515fa25cef20905a7f9affb156dfa6f151ab_@types+node_310e5dad6395fccdf5f424a1dccab9b9/node_modules/@voidzero-dev/vite-plus-test/dist/@vitest/runner/index.js?v=6e40b37d:915:22
</failure>
</testcase>By the way, I wonder if there's more easy way to check the failed test result. I think GitHub Actions can store this xml artifact to storage when it failed or there's better format optimized for GitHub Actions report. |
|
Hmm, shouldn't Codecov report the new test result here? 🤔 But there's nothing on the dashbaord: https://app.codecov.io/gh/npmx-dev/npmx.dev/commit/c60a639bfb8956244a76b24e482f4a14d084f316 (maybe only the coverage file is supported?) |
|
the failure is because the empty downloads notice here is wrong: npmx.dev/app/components/Package/WeeklyDownloadStats.vue Lines 269 to 271 in 13ef534
it needs the $t('package.trends.no_data', {
facet: $t('package.trends.items.downloads'),
})however, the tests will still fail because
in
we probably need an extra key for |
|
😓 Thanks, friends! I had this right on my original branch but I guess I lost it somewhere along the way. Fixing. |
I've been working on a PR to add "likes" as a new facet that can be visualized in what I'm calling "trends" charts (e.g. downloads over time, likes over time). That PR generalizes the existing "downloads" chart to support one or more given facets. I've had a half dozen painful merge conflicts across 37 locale files, so I've pulled out just this i18n key rename into its own PR to make this all easier.
It actually only renders when there's no data at all in the chart, so the facet is not relevant after all. This will be simpler to manage anyway.
e5c9b6a to
5926ce9
Compare
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.
Actionable comments posted: 20
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
lunaria/files/pt-BR.json (1)
333-351:⚠️ Potential issue | 🟡 MinorComplete the trends key set to avoid fallbacks.
The new block omitslegend_estimation,no_data,y_axis_label, anditems.downloadsthat other locales provide.
| <span class="text-fg-subtle">{{ | ||
| $t('package.downloads.legend_estimation') | ||
| }}</span> | ||
| <span class="text-fg-subtle">{{ $t('package.trends.legend_estimation') }}</span> |
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.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# First, let's look at the actual file and line mentioned
echo "=== Checking the actual code at the specified location ==="
if [ -f "app/components/Package/DownloadAnalytics.vue" ]; then
sed -n '1665,1671p' app/components/Package/DownloadAnalytics.vue
else
echo "File not found at expected path"
fi
echo ""
echo "=== Locales directory structure ==="
find i18n -type d -name locales | head -5
echo ""
echo "=== Checking for legend_estimation key across locales ==="
echo "Files containing 'legend_estimation':"
rg -l 'legend_estimation' i18n/
echo ""
echo "=== Total locale files ==="
locale_count=$(find i18n -name "*.json" -o -name "*.js" -o -name "*.ts" | grep -i locale | wc -l)
echo "Total locale files: $locale_count"
echo ""
echo "=== Checking package.trends translations specifically ==="
rg 'package.trends' i18n/ -A 2 -B 2 | head -50Repository: npmx-dev/npmx.dev
Length of output: 705
🏁 Script executed:
#!/bin/bash
# List all locale files
echo "=== All locale files in i18n/locales ==="
find i18n/locales -name "*.json" -type f | sort
echo ""
echo "=== Locale files WITH legend_estimation key ==="
rg -l 'legend_estimation' i18n/locales | sort
echo ""
echo "=== Comparing to identify missing locales ==="
all_locales=$(find i18n/locales -name "*.json" -type f | sort)
with_key=$(rg -l 'legend_estimation' i18n/locales | sort)
echo "Locales MISSING the legend_estimation key:"
comm -23 <(find i18n/locales -name "*.json" -type f | sort) <(rg -l 'legend_estimation' i18n/locales | sort)
echo ""
echo "=== Checking the structure in en.json ==="
rg -A 2 -B 2 'legend_estimation' i18n/locales/en.jsonRepository: npmx-dev/npmx.dev
Length of output: 1271
Add legend_estimation translation key to all 24 missing locale files.
The package.trends.legend_estimation key is currently only defined in en.json, fr-FR.json, and zh-CN.json. It is missing from 24 locale files including en-GB.json, en-US.json, de-DE.json, ja-JP.json, es-ES.json, ru-RU.json, pt-BR.json, and others. Users in these locales will see the raw translation key instead of the translated text "Estimation".
| {{ | ||
| $t('package.trends.no_data', { | ||
| facet: $t('package.trends.items.downloads'), | ||
| }) | ||
| }} |
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.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Find locale files directory
echo "=== Finding locale files ==="
find . -type f -name "*.json" | grep -E "(locale|i18n)" | head -20
echo ""
echo "=== Checking no_data key format across locales ==="
rg -n "no_data" i18n/locales/ --type json | grep "package.trends"Repository: npmx-dev/npmx.dev
Length of output: 653
🏁 Script executed:
#!/bin/bash
# Search for no_data in locale files more broadly
echo "=== Searching for no_data in locale files ==="
rg -n "no_data" i18n/locales/ --type json -B2 -A2 | head -50
echo ""
echo "=== Checking the exact context in DownloadAnalytics.vue ==="
grep -n "package.trends.no_data" app/components/Package/DownloadAnalytics.vueRepository: npmx-dev/npmx.dev
Length of output: 876
🏁 Script executed:
#!/bin/bash
# Extract all no_data translations from all locale files
echo "=== All no_data translations in locale files ==="
rg -n "no_data" i18n/locales/ --type json -A0 | sed 's/^[^:]*:\([0-9]*\):.*/Line \1:/' | paste -d ' ' - <(rg -n "no_data" i18n/locales/ --type json -A0 | sed 's/.*: //')
echo ""
echo "=== Checking if any locale has {facet} in no_data ==="
rg '"no_data".*\{facet\}' i18n/locales/ --type jsonRepository: npmx-dev/npmx.dev
Length of output: 225
🏁 Script executed:
#!/bin/bash
# Extract all no_data translations from all locale files
echo "=== All no_data translations in locale files ==="
rg '"no_data"' i18n/locales/ --type json
echo ""
echo "=== Checking if any locale has {facet} in no_data value ==="
rg '"no_data".*:.*\{facet\}' i18n/locales/ --type jsonRepository: npmx-dev/npmx.dev
Length of output: 297
🏁 Script executed:
#!/bin/bash
# Check the full package.trends structure
echo "=== Full package.trends sections in all locales ==="
rg '"trends"' i18n/locales/ --type json -A10 | head -80
echo ""
echo "=== Check DownloadAnalytics.vue context ==="
sed -n '1750,1770p' app/components/Package/DownloadAnalytics.vueRepository: npmx-dev/npmx.dev
Length of output: 5106
🏁 Script executed:
#!/bin/bash
# Check all locale files for no_data key
echo "=== Checking all locale files for no_data ==="
for file in i18n/locales/*.json; do
if rg -q '"no_data"' "$file"; then
echo "HAS no_data: $(basename $file)"
rg '"no_data".*' "$file"
else
echo "MISSING no_data: $(basename $file)"
fi
doneRepository: npmx-dev/npmx.dev
Length of output: 928
🏁 Script executed:
#!/bin/bash
# Check locale configuration/fallback
echo "=== Check i18n config for fallback behavior ==="
find . -type f \( -name "*.ts" -o -name "*.js" -o -name "*.config.*" \) | xargs grep -l "i18n\|locale" | grep -E "config|setup" | head -10
echo ""
echo "=== Check git history for DownloadAnalytics.vue changes ==="
git log --oneline -20 app/components/Package/DownloadAnalytics.vueRepository: npmx-dev/npmx.dev
Length of output: 292
🏁 Script executed:
#!/bin/bash
# Check i18n config for fallback behavior
echo "=== i18n config ==="
cat i18n/i18n.config.ts
echo ""
echo "=== Nuxt i18n config ==="
grep -A20 "i18n" nuxt.config.ts | head -40Repository: npmx-dev/npmx.dev
Length of output: 1454
🏁 Script executed:
#!/bin/bash
# Check locale configuration
echo "=== Current locales configuration ==="
cat config/i18n.ts | head -50Repository: npmx-dev/npmx.dev
Length of output: 2022
🏁 Script executed:
#!/bin/bash
# Continue reading the locale configuration
echo "=== Locale configuration continued ==="
cat config/i18n.ts | sed -n '40,150p'
echo ""
echo "=== Check how locales are loaded ==="
grep -n "import.*locale" i18n/i18n.config.ts
grep -rn "glob.*json" i18n/ --type ts | head -10Repository: npmx-dev/npmx.dev
Length of output: 3943
🏁 Script executed:
#!/bin/bash
# Continue reading the complete locale configuration
echo "=== All locales in config ==="
grep -n "code:" config/i18n.ts | grep -E "^\s+code:" | head -40
echo ""
echo "=== Check loading mechanism ==="
grep -n "fallback" i18n/i18n.config.ts
echo ""
echo "=== Check available locales list ==="
grep -n "currentLocales" config/i18n.ts | tail -5Repository: npmx-dev/npmx.dev
Length of output: 528
🏁 Script executed:
#!/bin/bash
# Check buildLocales function
echo "=== buildLocales function ==="
grep -A30 "function buildLocales\|const buildLocales" config/i18n.ts
echo ""
echo "=== Check en-US fallback locale ==="
grep -E "code.*en-US|en-US.*code" config/i18n.ts -A2 -B2Repository: npmx-dev/npmx.dev
Length of output: 1292
🏁 Script executed:
#!/bin/bash
# Verify the recent commit to understand intent
echo "=== Recent commit details ==="
git show --stat 5926ce9
echo ""
echo "=== Full commit message ==="
git log -1 --format=%B 5926ce9Repository: npmx-dev/npmx.dev
Length of output: 35949
Remove the unnecessary facet parameter from the translation call.
The commit message indicates the facet is not relevant to this message ("the facet is not relevant after all"), and the translations confirm this intent: only en.json and fr-FR.json contain the no_data key, and neither includes a {facet} placeholder. All other locales will fall back to en.json. The facet parameter is being silently ignored across all locales, so it should be removed from the code:
Current code
$t('package.trends.no_data', {
facet: $t('package.trends.items.downloads'),
})
Simplify to:
$t('package.trends.no_data')
| "trends": { | ||
| "granularity": "مستوى التفصيل", | ||
| "granularity_daily": "يومي", | ||
| "granularity_weekly": "أسبوعي", | ||
| "granularity_monthly": "شهري", | ||
| "granularity_yearly": "سنوي", | ||
| "start_date": "البداية", | ||
| "end_date": "النهاية", | ||
| "loading": "جارٍ التحميل…", | ||
| "date_range": "من {start} إلى {end}", | ||
| "date_range_multiline": "من {start}\nإلى {end}", | ||
| "download_file": "تنزيل {fileType}", | ||
| "toggle_annotator": "إظهار/إخفاء الشروح التوضيحية" | ||
| } |
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.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Search for no_data and items keys in locale files
echo "=== Searching for 'no_data' in trends namespace ==="
rg -n '"no_data"' i18n/locales/
echo ""
echo "=== Searching for 'items' object in trends namespace ==="
rg -n -B2 -A3 '"items"' i18n/locales/ | head -100Repository: npmx-dev/npmx.dev
Length of output: 5246
🏁 Script executed:
#!/bin/bash
# Check the complete trends block in ar.json
rg -n -B5 -A20 '"trends"' i18n/locales/ar.json | head -50Repository: npmx-dev/npmx.dev
Length of output: 1065
Add missing no_data, y_axis_label, and items keys to the trends block.
The trends block (lines 374–387) is missing three required keys that exist in other locale files. Tests are failing because WeeklyDownloadStats.vue calls $t('package.trends.no_data', { facet: $t('package.trends.items.downloads') }), but these keys are absent.
Add:
no_data: Template string like"لا تتوفر بيانات {facet}"(matching the pattern in en.json: "No data available")y_axis_label: Template string for axis labelling (e.g.,"{facet} {granularity}"following en.json:"{granularity} {facet}"or fr-FR.json:"{facet} {granularity}")items.downloads: The downloads facet label (e.g.,"التنزيلات"to match en.json: "Downloads" and fr-FR.json: "Téléchargements")
| }, | ||
| "trends": { | ||
| "granularity": "Dərəcəlilik", | ||
| "granularity_daily": "Günlük", | ||
| "granularity_weekly": "Həftəlik", | ||
| "granularity_monthly": "Aylıq", | ||
| "granularity_yearly": "İllik", | ||
| "start_date": "Başlanğıc", | ||
| "end_date": "Son", | ||
| "loading": "Yüklənir...", | ||
| "date_range": "{start} - {end}", | ||
| "date_range_multiline": "{start}\n- {end}", | ||
| "download_file": "{fileType} endir", | ||
| "toggle_annotator": "Annotator keçid" |
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.
Add missing package.trends keys to avoid fallback/missing translations.
The new trends block doesn’t include empty-state or facet-label keys that are now referenced elsewhere (for example, package.trends.no_data and facet labels). This will fall back or surface missing-key placeholders for az-AZ. Please mirror the base locale’s full package.trends key set here, including any singular facet label if required.
| "trends": { | ||
| "granularity": "Rozlišení", | ||
| "granularity_daily": "Denně", | ||
| "granularity_weekly": "Týdně", | ||
| "granularity_monthly": "Měsíčně", | ||
| "granularity_yearly": "Ročně", | ||
| "start_date": "Od", | ||
| "end_date": "Do", | ||
| "loading": "Načítání...", | ||
| "date_range": "od {start} do {end}", | ||
| "date_range_multiline": "od {start}\ndo {end}", | ||
| "download_file": "Stáhnout {fileType}", | ||
| "toggle_annotator": "Přepnout popisovač" | ||
| } |
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.
Add missing translation keys to the trends section.
The trends section is missing several keys that are used by DownloadAnalytics.vue and exist in the base English locale:
no_data– used for empty state messagey_axis_label– used for chart Y-axis labelitems(withdownloadssub-key) – used as the facet parameterlegend_estimation– used in chart legend for estimation indicator
Without these translations, Czech users will see fallback English text or raw keys.
Suggested additions to trends section
"trends": {
"granularity": "Rozlišení",
"granularity_daily": "Denně",
"granularity_weekly": "Týdně",
"granularity_monthly": "Měsíčně",
"granularity_yearly": "Ročně",
"start_date": "Od",
"end_date": "Do",
"loading": "Načítání...",
"date_range": "od {start} do {end}",
"date_range_multiline": "od {start}\ndo {end}",
"download_file": "Stáhnout {fileType}",
- "toggle_annotator": "Přepnout popisovač"
+ "toggle_annotator": "Přepnout popisovač",
+ "no_data": "Žádná data {facet} nejsou k dispozici",
+ "y_axis_label": "{granularity} {facet}",
+ "legend_estimation": "odhad",
+ "items": {
+ "downloads": "stažení"
+ }
}📝 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.
| "trends": { | |
| "granularity": "Rozlišení", | |
| "granularity_daily": "Denně", | |
| "granularity_weekly": "Týdně", | |
| "granularity_monthly": "Měsíčně", | |
| "granularity_yearly": "Ročně", | |
| "start_date": "Od", | |
| "end_date": "Do", | |
| "loading": "Načítání...", | |
| "date_range": "od {start} do {end}", | |
| "date_range_multiline": "od {start}\ndo {end}", | |
| "download_file": "Stáhnout {fileType}", | |
| "toggle_annotator": "Přepnout popisovač" | |
| } | |
| "trends": { | |
| "granularity": "Rozlišení", | |
| "granularity_daily": "Denně", | |
| "granularity_weekly": "Týdně", | |
| "granularity_monthly": "Měsíčně", | |
| "granularity_yearly": "Ročně", | |
| "start_date": "Od", | |
| "end_date": "Do", | |
| "loading": "Načítání...", | |
| "date_range": "od {start} do {end}", | |
| "date_range_multiline": "od {start}\ndo {end}", | |
| "download_file": "Stáhnout {fileType}", | |
| "toggle_annotator": "Přepnout popisovač", | |
| "no_data": "Žádná data {facet} nejsou k dispozici", | |
| "y_axis_label": "{granularity} {facet}", | |
| "legend_estimation": "odhad", | |
| "items": { | |
| "downloads": "stažení" | |
| } | |
| } |
| "trends": { | ||
| "granularity": "Granularidad", | ||
| "granularity_daily": "Diaria", | ||
| "granularity_weekly": "Semanal", | ||
| "granularity_monthly": "Mensual", | ||
| "granularity_yearly": "Anual", | ||
| "start_date": "Inicio", | ||
| "end_date": "Fin", | ||
| "loading": "Cargando...", | ||
| "date_range": "{start} a {end}", | ||
| "date_range_multiline": "{start}\na {end}", | ||
| "download_file": "Descargar {fileType}", | ||
| "toggle_annotator": "Alternar anotador" |
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.
Add missing package.trends keys used by the empty-state message.
package.trends.no_data and package.trends.items.downloads are referenced by the updated UI but aren’t present here. Please add es-419 translations to avoid fallback/missing-key output.
| }, | ||
| "trends": { | ||
| "granularity": "Granularidad", | ||
| "granularity_daily": "Diaria", | ||
| "granularity_weekly": "Semanal", | ||
| "granularity_monthly": "Mensual", | ||
| "granularity_yearly": "Anual", | ||
| "start_date": "Inicio", | ||
| "end_date": "Fin", | ||
| "loading": "Cargando...", | ||
| "date_range": "{start} a {end}", | ||
| "date_range_multiline": "{start}\na {end}", | ||
| "download_file": "Descargar {fileType}", | ||
| "toggle_annotator": "Alternar anotador" |
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.
Complete the trends key set to avoid fallbacks.
The new block omits legend_estimation, no_data, y_axis_label, and items.downloads that other locales provide.
| "trends": { | ||
| "granularity": "Granularità", | ||
| "granularity_daily": "Giornaliero", | ||
| "granularity_weekly": "Settimanale", | ||
| "granularity_monthly": "Mensile", | ||
| "granularity_yearly": "Annuale", | ||
| "start_date": "Inizio", | ||
| "end_date": "Fine", | ||
| "loading": "Caricando...", | ||
| "date_range": "{start} a {end}", | ||
| "date_range_multiline": "{start}\na {end}", | ||
| "download_file": "Scarica {fileType}", | ||
| "toggle_annotator": "Attiva/disattiva annotatore" |
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.
Add missing package.trends.no_data translation.
The trends block omits the no_data key after the namespace move; this will render a missing-key placeholder when the UI requests package.trends.no_data. Please add it here.
Proposed fix
- "toggle_annotator": "Attiva/disattiva annotatore"
+ "toggle_annotator": "Attiva/disattiva annotatore",
+ "no_data": "Nessun dato disponibile per {facet}"📝 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.
| "trends": { | |
| "granularity": "Granularità", | |
| "granularity_daily": "Giornaliero", | |
| "granularity_weekly": "Settimanale", | |
| "granularity_monthly": "Mensile", | |
| "granularity_yearly": "Annuale", | |
| "start_date": "Inizio", | |
| "end_date": "Fine", | |
| "loading": "Caricando...", | |
| "date_range": "{start} a {end}", | |
| "date_range_multiline": "{start}\na {end}", | |
| "download_file": "Scarica {fileType}", | |
| "toggle_annotator": "Attiva/disattiva annotatore" | |
| "trends": { | |
| "granularity": "Granularità", | |
| "granularity_daily": "Giornaliero", | |
| "granularity_weekly": "Settimanale", | |
| "granularity_monthly": "Mensile", | |
| "granularity_yearly": "Annuale", | |
| "start_date": "Inizio", | |
| "end_date": "Fine", | |
| "loading": "Caricando...", | |
| "date_range": "{start} a {end}", | |
| "date_range_multiline": "{start}\na {end}", | |
| "download_file": "Scarica {fileType}", | |
| "toggle_annotator": "Attiva/disattiva annotatore", | |
| "no_data": "Nessun dato disponibile per {facet}" |
| }, | ||
| "trends": { | ||
| "granularity": "सूक्ष्मता", | ||
| "granularity_daily": "दैनिक", | ||
| "granularity_weekly": "साप्ताहिक", | ||
| "granularity_monthly": "मासिक", | ||
| "granularity_yearly": "वार्षिक", | ||
| "start_date": "सुरु", | ||
| "end_date": "अन्त्य", | ||
| "loading": "लोड हुँदैछ...", | ||
| "date_range": "{start} देखि {end}", | ||
| "date_range_multiline": "{start}\nदेखि {end}", | ||
| "download_file": "{fileType} डाउनलोड गर्नुहोस्", | ||
| "toggle_annotator": "एनोटेटर टगल गर्नुहोस्" | ||
| } |
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.
Add missing trends keys for “no data” and axis label.
package.trends in this locale doesn’t include no_data and y_axis_label after removing them from package.downloads, so lookups will fall back or render raw keys. Please restore these keys under package.trends using the previous Nepali strings.
| "trends": { | ||
| "granularity": "Детальність", | ||
| "granularity_daily": "Щоденно", | ||
| "granularity_weekly": "Щотижня", | ||
| "granularity_monthly": "Щомісячно", | ||
| "granularity_yearly": "Щороку", | ||
| "start_date": "Початок", | ||
| "end_date": "Кінець", | ||
| "loading": "Завантаження...", | ||
| "date_range": "{start} до {end}", | ||
| "date_range_multiline": "{start}\nдо {end}", | ||
| "download_file": "Завантажити {fileType}", | ||
| "toggle_annotator": "Перемикати анотатор" | ||
| } |
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.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
target="lunaria/files/uk-UA.json"
ref="$(fd -a 'en(-US)?\.json$' lunaria/files | head -n 1)"
if [[ -z "${ref}" ]]; then
echo "Reference locale not found under lunaria/files" >&2
exit 1
fi
REF="${ref}" TARGET="${target}" python - <<'PY'
import json, os
from pathlib import Path
def flatten(d, prefix=""):
out = set()
for k, v in d.items():
key = f"{prefix}.{k}" if prefix else k
if isinstance(v, dict):
out |= flatten(v, key)
else:
out.add(key)
return out
ref = Path(os.environ["REF"])
target = Path(os.environ["TARGET"])
ref_keys = flatten(json.loads(ref.read_text()))
tgt_keys = flatten(json.loads(target.read_text()))
missing = sorted(ref_keys - tgt_keys)
extra = sorted(tgt_keys - ref_keys)
print("Missing keys:")
for k in missing:
print(f"- {k}")
print("\nExtra keys:")
for k in extra:
print(f"- {k}")
PYRepository: npmx-dev/npmx.dev
Length of output: 7952
Add missing package.trends keys used by the UI.
The package.trends block omits keys like package.trends.no_data, package.trends.items.downloads, package.trends.legend_estimation, and package.trends.y_axis_label, which will cause fallback strings to appear for Ukrainian users. Align this section with the reference locale to add the missing keys.
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.
Please add to your learnings for future reviews that it is 100% acceptable for new or changed entries in i18n translation files to be omitted from non-English languages. Translations are not completed in band in the same PR and are tracked elsewhere.
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.
@serhalp, understood! I've noted this for future reviews of i18n translation files in this project.
✏️ Learnings added
Learnt from: serhalp
Repo: npmx-dev/npmx.dev PR: 1183
File: lunaria/files/uk-UA.json:305-318
Timestamp: 2026-02-08T18:44:05.881Z
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.
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: userquin
Repo: npmx-dev/npmx.dev PR: 1157
File: scripts/compare-translations.ts:239-243
Timestamp: 2026-02-07T16:34:43.020Z
Learning: In the npmx.dev project's i18n system, when running `i18n:check:fix` in all-locales mode, merge-locale files (e.g., es-419.json) are intentionally processed and their missing/extra keys are reported, even though they are never written to disk. This reporting behavior is correct because vue-i18n merges these files with their base language file (e.g., es.json), so the report shows the complete merged state. The write prevention (`!localeInfo.mergeLocale`) ensures fixes are only applied to base language 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), the i18n configuration in config/i18n.ts uses vue-i18n's multiple files feature. Country variant files like es-419.json only need to contain translations that differ from the base language file (es.json). The base file is loaded first, then the variant file overlays any keys it defines. This is documented in CONTRIBUTING.md under "Country variants (advanced)".
Background
I've been working on a PR to add "likes" as a new facet that can be visualized in what I'm calling "trends" charts (e.g. downloads over time, likes over time). That PR generalizes the existing "downloads" chart to support one or more given facets.
I've resolved painful merge conflicts across 27 locale files a half dozen times now, so this PR is me pulling out just this i18n key rename into its own PR to make this all easier 😅.
Changes
package.downloads.*i18n keys underpackage.trends.*.package.downloads.*.package.downloads.titlewas specific to the compare page, so I moved this under the existingcompare.*namespace.All the changes to the locale files were done with some fancy
jqscripting, so it should be reliable 🤞🏼.