Skip to content

Commit 4ad7ad4

Browse files
author
FreeSynergy
committed
fix(store): i18n status reads catalog.locales, drop unused sub-catalog fetch
1 parent 71d233d commit 4ad7ad4

File tree

1 file changed

+11
-36
lines changed
  • cli/crates/fsn-node-cli/src/commands

1 file changed

+11
-36
lines changed

cli/crates/fsn-node-cli/src/commands/store.rs

Lines changed: 11 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use anyhow::{Context, Result};
88
use fsn_node_core::store::StoreEntry;
99
use fsn_store::StoreClient;
10-
use toml;
1110

1211
// Schema version bundled with this binary — must match Lib's sync_snippets.py SCHEMA_VERSION.
1312
const BUNDLED_SCHEMA_VERSION: &str = "1.0.0";
@@ -123,47 +122,23 @@ pub async fn update_check() -> Result<()> {
123122

124123
// ── i18n ───────────────────────────────────────────────────────────────────────
125124

126-
/// One entry from `[[languages]]` in the store's `catalog/i18n.toml`.
127-
#[derive(serde::Deserialize)]
128-
struct I18nCatalogEntry {
129-
code: String,
130-
name: String,
131-
#[serde(default)]
132-
completeness: u8,
133-
#[serde(default)]
134-
schema_version: String,
135-
// file / sha256 / size are used by the updater, not displayed here
136-
}
137-
138-
#[derive(serde::Deserialize)]
139-
struct I18nCatalog {
140-
#[serde(default, rename = "languages")]
141-
languages: Vec<I18nCatalogEntry>,
142-
}
143-
144125
/// Show all available language packs from the store catalog with completeness.
126+
///
127+
/// Reads `[[locales]]` from the main Node `catalog.toml`.
145128
pub async fn i18n_status() -> Result<()> {
146-
let client = StoreClient::node_store();
147-
let raw = client
148-
.fetch_raw("Node/catalog/i18n.toml")
149-
.await
150-
.context("fetching i18n catalog")?;
151-
let catalog: I18nCatalog = toml::from_str(&raw).context("parsing i18n catalog")?;
152-
153-
if catalog.languages.is_empty() {
154-
println!("No language packs available in the store yet.");
129+
let catalog = fetch_node_catalog().await?;
130+
131+
if catalog.locales.is_empty() {
132+
println!("No language packs listed in the store catalog.");
155133
return Ok(());
156134
}
157135

158-
println!("{:<6} {:<24} {:>5} {:<8} {}", "CODE", "LANGUAGE", "COMP%", "SCHEMA", "");
159-
println!("{}", "─".repeat(58));
160-
for e in &catalog.languages {
161-
let ok = e.schema_version.is_empty() || e.schema_version == BUNDLED_SCHEMA_VERSION;
162-
let marker = if ok { "✓" } else { "⚠ outdated" };
163-
let schema = if e.schema_version.is_empty() { BUNDLED_SCHEMA_VERSION } else { &e.schema_version };
164-
println!("{:<6} {:<24} {:>4}% {:<8} {}", e.code, e.name, e.completeness, schema, marker);
136+
println!("{:<6} {:<24} {:>5} {}", "CODE", "LANGUAGE", "COMP%", "DIR");
137+
println!("{}", "─".repeat(46));
138+
for loc in &catalog.locales {
139+
println!("{:<6} {:<24} {:>4}% {}", loc.code, loc.name, loc.completeness, loc.direction);
165140
}
166-
println!("\nRequired schema: {BUNDLED_SCHEMA_VERSION} (⚠ = needs update, run `fsn store i18n set <code>`)");
141+
println!("\n{} language packs available.", catalog.locales.len());
167142
Ok(())
168143
}
169144

0 commit comments

Comments
 (0)