Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
commit 1234567890abcdef
Author: Your Name <your@email.com>
Date: 2023-02-20 14:30:00 +0000

Add Spanish locale (#50)

Added Spanish locale to the explorer.

diff --git a/locales/es.json b/locales/es.json
new file mode 100644
index 0000000..1234567
--- /dev/null
+++ b/locales/es.json
@@ -0,0 +1 @@
+{
+ "title": "Explorador",
+ "header": {
+ "title": "Explorador",
+ "description": "Explorador de datos"
+ },
+ "sidebar": {
+ "title": "Menú",
+ "items": [
+ {
+ "title": "Inicio",
+ "icon": "home",
+ "url": "/"
+ },
+ {
+ "title": "Datos",
+ "icon": "database",
+ "url": "/data"
+ },
+ {
+ "title": "Configuración",
+ "icon": "cog",
+ "url": "/settings"
+ }
+ ]
+ },
+ "footer": {
+ "text": "Copyright 2023"
+ }
+}
31 changes: 31 additions & 0 deletions locales/es.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copy the English locale to Spanish

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Remove the leading # — this file is not valid JSON.

The parser will fail on line 1, so the locale cannot be loaded at all.

Fix
-# Copy the English locale to Spanish
 {
🧰 Tools
🪛 Biome (2.5.1)

[error] 1-1: unexpected character #

(parse)


[error] 1-1: String values must be double quoted.

(parse)


[error] 1-1: String values must be double quoted.

(parse)


[error] 1-1: String values must be double quoted.

(parse)


[error] 1-1: String values must be double quoted.

(parse)


[error] 1-1: String values must be double quoted.

(parse)


[error] 1-1: String values must be double quoted.

(parse)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@locales/es.json` at line 1, The Spanish locale file currently starts with a
comment marker, which makes it invalid JSON and prevents it from loading. Remove
the leading # and keep the file as a valid JSON object matching the structure
used by the English locale so the locale parser can read it successfully.

Source: Linters/SAST tools

{
"title": "Explorador",
"header": {
"title": "Explorador",
"description": "Explorador de datos"
},
"sidebar": {
"title": "Menú",
"items": [
{
"title": "Inicio",
"icon": "home",
"url": "/"
},
{
"title": "Datos",
"icon": "database",
"url": "/data"
},
{
"title": "Configuración",
"icon": "cog",
"url": "/settings"
}
]
},
"footer": {
"text": "Copyright 2023"
}
}
Comment on lines +2 to +31

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Register Spanish in the locale registry, or this file stays unreachable.

src/i18n/mod.rs currently hardcodes only en, id, and zh in Lang::ALL / raw(), so es.json is never selected or loaded. The new locale needs to be wired into that enum + switcher path as part of this PR.

🧰 Tools
🪛 Biome (2.5.1)

[error] 2-31: End of file expected

(parse)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@locales/es.json` around lines 2 - 31, The Spanish locale file is currently
unreachable because the locale registry only exposes the existing languages
through Lang::ALL and raw() in src/i18n/mod.rs. Update the Lang enum/switching
logic there to add Spanish as a supported locale, and make sure the new es entry
is returned by the raw() mapping so this file can actually be selected and
loaded.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Flatten the locale to the keys the i18n loader actually reads.

src/i18n/mod.rs only retains top-level string values, and Navbar looks up flat keys like nav.dashboard / nav.assets. This nested header/sidebar/footer structure will be discarded, so most of the UI will fall back to raw keys.

Example
-  "header": {
-    "title": "Explorador",
-    "description": "Explorador de datos"
-  },
-  "sidebar": {
-    "title": "Menú",
-    "items": [
-      ...
-    ]
-  }
+  "header.title": "Explorador",
+  "header.description": "Explorador de datos",
+  "nav.dashboard": "Inicio",
+  "nav.assets": "Datos",
+  "nav.lab": "Laboratorio"
🧰 Tools
🪛 Biome (2.5.1)

[error] 2-31: End of file expected

(parse)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@locales/es.json` around lines 2 - 31, The Spanish locale is nested under
header/sidebar/footer, but the i18n loader in src/i18n/mod.rs only keeps
top-level string entries and Navbar reads flat keys like nav.dashboard and
nav.assets. Flatten locales/es.json into the same top-level key structure used
by the loader and UI, replacing the nested sections with direct string keys so
the translated values are actually available at runtime.