-
-
Notifications
You must be signed in to change notification settings - Fork 232
fix: improve accuracy of package page skeleton #1305
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
|
📝 WalkthroughWalkthroughThe PR restructures the package page skeleton (app/components/Package/Skeleton.vue) and updates Playgrounds heading styling (app/components/Package/Playgrounds.vue). Changes: header/nav and metrics badges rearranged; package details, external links and install block restyled (monospace headings, terminal-style install); sidebar reworked into stacked subsections with adjusted sticky offset; README and several headings given font-mono; skeletons expanded and reorganised into modular subsections; i18n locale files updated extensively (many new placeholder keys, removals of Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ❌ 1❌ Failed checks (1 inconclusive)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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
|
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: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
i18n/locales/fr-FR.json (1)
248-260:⚠️ Potential issue | 🟡 MinorPopulate
package.security_downgradewith French translations.The empty object leaves French users with untranslated content. The base en.json contains eight keys (title, description_to_none_provenance, description_to_none_trustedPublisher, etc.) that the Vue code references, but all non-English locales have empty
security_downgradeobjects. Either populate this section with French translations or remove the override to allow fallback to English. This pattern appears across all locales and should be addressed systematically.
| "shortcuts": { | ||
| "section": {} | ||
| }, |
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
🌐 Web query:
vue-i18n empty object fallback behavior translation key
💡 Result:
- If a locale’s messages are an empty object (e.g.
ja: {}), then any$t('some.key')lookup is treated as missing and vue-i18n will fall back throughfallbackLocale(if configured). This is the documented “missing key → fallbackLocale” behavior. [1] - If the key can’t be resolved in any locale in the fallback chain, vue-i18n ultimately returns the key (or whatever your
missinghandler returns). In vue-i18n v8, component-local lookups also havefallbackRoot; when disabled it “is returned the key”. [2] - Important edge case: if the key exists but its value is an empty string (
""), vue-i18n considers it present (so it won’t fall back by default), which is a known/commonly reported behavior. [3] Some setups address this by disabling “return empty string” behavior (e.g.returnEmptyString: falsein some versions/configs). [4]
🏁 Script executed:
# Check the i18n configuration to understand how pl-PL.json is used
fd -t f i18n.ts config | head -5Repository: npmx-dev/npmx.dev
Length of output: 75
🏁 Script executed:
# Look at the structure of the pl-PL.json file and check if it's a merge-locale
head -20 i18n/locales/pl-PL.jsonRepository: npmx-dev/npmx.dev
Length of output: 749
🏁 Script executed:
# Check the base English locale to see what the expected structure is
head -30 i18n/locales/en-US.jsonRepository: npmx-dev/npmx.dev
Length of output: 94
🏁 Script executed:
# Read the i18n configuration to understand fallback chain and locale structure
cat -n config/i18n.tsRepository: npmx-dev/npmx.dev
Length of output: 14333
🏁 Script executed:
# Check if there's an en.json (base English file without country variant)
fd -t f "en\.json" i18n/Repository: npmx-dev/npmx.dev
Length of output: 81
🏁 Script executed:
# Check the directory structure of i18n/locales
ls -la i18n/locales/ | head -20Repository: npmx-dev/npmx.dev
Length of output: 1204
🏁 Script executed:
# Verify if pl-PL.json has the full translation set or is a variant (merge-locale)
wc -l i18n/locales/pl-PL.json i18n/locales/en-US.jsonRepository: npmx-dev/npmx.dev
Length of output: 132
🏁 Script executed:
# Check if there's a pl.json base file that pl-PL.json should merge with
fd -t f "^pl\.json$" i18n/locales/Repository: npmx-dev/npmx.dev
Length of output: 43
🏁 Script executed:
# Search for fallback locale configuration in nuxt.config or i18n setup
fd -t f "nuxt.config\|setup" | head -10Repository: npmx-dev/npmx.dev
Length of output: 43
🏁 Script executed:
# Check the nuxt.config.ts for i18n fallback configuration
grep -n "fallback\|i18n" nuxt.config.ts 2>/dev/null | head -20Repository: npmx-dev/npmx.dev
Length of output: 1108
🏁 Script executed:
# Look for i18n plugin or setup files
fd -t f -e ts -e js i18n | grep -E "plugin|setup|index" | head -10Repository: npmx-dev/npmx.dev
Length of output: 94
🏁 Script executed:
# Read the i18n configuration section in nuxt.config.ts
sed -n '308,340p' nuxt.config.tsRepository: npmx-dev/npmx.dev
Length of output: 858
🏁 Script executed:
# Read the i18n plugin setup
cat -n app/plugins/i18n-loader.client.tsRepository: npmx-dev/npmx.dev
Length of output: 769
Remove empty translation objects for clarity.
Empty objects like {} for shortcuts.section are unnecessary in pl-PL.json, a standalone locale file. While they don't prevent fallback, they add no value and can be omitted since translations are tracked separately for non-English locales. Prefer either providing actual translated content or removing the placeholder key entirely.
🔧 Suggested fix (remove empty placeholder)
- "shortcuts": {
- "section": {}
- },
+ "shortcuts": {},📝 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.
| "shortcuts": { | |
| "section": {} | |
| }, | |
| "shortcuts": {}, |
| "shortcuts": { | ||
| "section": {} | ||
| }, |
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
# Step 1: Find the base locale file(s)
echo "=== Finding base locale files ==="
find lunaria/files -name "en*.json" -type f | head -20
echo ""
echo "=== Content check: list all locale files ==="
ls -la lunaria/files/*.json 2>/dev/null | head -30Repository: npmx-dev/npmx.dev
Length of output: 2066
🏁 Script executed:
#!/bin/bash
# Compare key types between en-US.json and it-IT.json
python3 <<'PY'
import json
base_path = "lunaria/files/en-US.json"
it_path = "lunaria/files/it-IT.json"
def get_path(obj, path):
cur = obj
for p in path:
if not isinstance(cur, dict) or p not in cur:
return None
cur = cur[p]
return cur
def describe_value(v):
if v is None:
return "MISSING"
elif isinstance(v, dict):
if not v:
return "dict (empty)"
else:
return f"dict with keys: {list(v.keys())}"
elif isinstance(v, str):
return f"string (len={len(v)})"
elif isinstance(v, list):
return f"list (len={len(v)})"
else:
return type(v).__name__
paths = [
("shortcuts.section", ["shortcuts", "section"]),
("settings.data_source", ["settings", "data_source"]),
("package.security_downgrade", ["package", "security_downgrade"]),
("package.trends", ["package", "trends"]),
("compare.facets.trends", ["compare", "facets", "trends"]),
]
with open(base_path, "r", encoding="utf-8") as f:
base = json.load(f)
with open(it_path, "r", encoding="utf-8") as f:
it = json.load(f)
print(f"Base locale: {base_path}\nTarget locale: {it_path}\n")
for name, path in paths:
b = get_path(base, path)
i = get_path(it, path)
print(f"{name}:")
print(f" en-US: {describe_value(b)}")
print(f" it-IT: {describe_value(i)}")
print()
PYRepository: npmx-dev/npmx.dev
Length of output: 1417
🏁 Script executed:
#!/bin/bash
# Check i18n configuration to see if it-IT is a merge locale
echo "=== Searching for i18n configuration mentioning it-IT ==="
rg "it-IT|merge.*locale|mergeLocale" --type ts --type js --type json -i 2>/dev/null | grep -i "it\|merge\|config" | head -30
echo ""
echo "=== Checking for i18n configuration files ==="
find . -maxdepth 3 -name "*i18n*" -o -name "*locale*config*" -o -name "*translation*config*" 2>/dev/null | grep -v node_modules | head -20
echo ""
echo "=== Checking scripts for i18n:check:fix logic ==="
fd "compare-translations\|i18n" --type f | head -20Repository: npmx-dev/npmx.dev
Length of output: 2166
🏁 Script executed:
#!/bin/bash
# Check the i18n configuration to see if it-IT is a merge locale
echo "=== config/i18n.ts (it-IT locale definition) ==="
rg -A 10 "code: 'it-IT'" config/i18n.ts
echo ""
echo "=== Understanding merge locale logic ==="
echo "Searching for how merge locales are identified and processed..."
rg -B 5 -A 10 "mergeLocale.*true" scripts/compare-translations.ts | head -40
echo ""
echo "=== Checking mergeLocaleObject function ==="
head -80 lunaria/prepare-json-files.ts | tail -60Repository: npmx-dev/npmx.dev
Length of output: 3086
🏁 Script executed:
#!/bin/bash
# Check i18n system's fallback and rendering logic
echo "=== Checking i18n loader and fallback logic ==="
rg -A 15 "getMessage|getLocalizedString|fallback" app/plugins/i18n-loader.client.ts | head -50
echo ""
echo "=== Verifying package.trends matches exactly ==="
python3 <<'PY'
import json
with open("lunaria/files/en-US.json", "r") as f:
base = json.load(f)
with open("lunaria/files/it-IT.json", "r") as f:
it = json.load(f)
base_trends = base["package"]["trends"]
it_trends = it["package"]["trends"]
base_keys = set(base_trends.keys())
it_keys = set(it_trends.keys())
print(f"Base trends keys: {sorted(base_keys)}")
print(f"Italian trends keys: {sorted(it_keys)}")
print(f"Missing in Italian: {base_keys - it_keys}")
print(f"Extra in Italian: {it_keys - base_keys}")
print(f"All values are strings? {all(isinstance(v, str) for v in it_trends.values())}")
PYRepository: npmx-dev/npmx.dev
Length of output: 823
🏁 Script executed:
#!/bin/bash
# Check what types of values are in package.trends
python3 <<'PY'
import json
with open("lunaria/files/it-IT.json", "r") as f:
it = json.load(f)
trends = it["package"]["trends"]
for key, value in sorted(trends.items()):
value_type = type(value).__name__
if isinstance(value, dict):
print(f"{key}: {value_type} with keys {list(value.keys())}")
elif isinstance(value, str):
print(f"{key}: string (len={len(value)})")
else:
print(f"{key}: {value_type} = {repr(value)}")
PYRepository: npmx-dev/npmx.dev
Length of output: 564
Replace empty-object placeholders with actual structure or remove them to allow fallback.
These keys use empty objects as placeholders, but the base locale defines nested structures with multiple subkeys:
shortcuts.section: base has 3 subkeys (global,search,package)settings.data_source: base has 6 subkeyspackage.security_downgrade: base has 8 subkeyscompare.facets.trends: base has 1 subkey (title)
Empty objects will cause i18n lookups to fail or render incorrectly. Either populate them with translations matching the base schema or delete them to allow fallback to the English text.
The package.trends block (lines 292–311) is correctly implemented with all 16 required keys and should be kept as-is.
No description provided.