Find tools in the interface language, translate GeoLibre tool names, and name GeoLibre outputs

Aperta
#2,224 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
30/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
json, rust

Direzione di ricerca

Three separable pieces: start with matches in crates/ui-egui/src/panes.rs, where the Tools pane filter compares the query against the English name, summary and id instead of the tl!(tool.name) the row renders; a unit test with a translated name and an accent-folded query pins it down. The larger piece lives in crates/geolibre (downloading, caching and schema-validating GeoLibre language packs off the UI thread, falling back to English), then crates/geolibre/src/lib.rs, which currently drops io_role: "output" parameters, needs an optional output-name field defaulting to the translated tool name with de-duplication. Done means translated tools are findable, GeoLibre names/descriptions resolve from a pack, and repeated runs get distinct output layer names.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Before you start
  • I searched the existing issues and the roadmap and did not find a duplicate request.
What problem does this solve?

In a classroom with the interface in Portuguese (or any language other than English), students can't find tools by their own words, and GeoLibre results come back with English layer names they can't choose.

Three things together, all checked on main (573709f0):

  1. Find Tools only matches English. The filter in the Tools pane (crates/ui-egui/src/panes.rs, geoprocessing) compares the query with x.name, x.summary and x.id, which are the English strings, while the rows show tl!(tool.name). So even a built-in tool that is translated can't be found by what the user sees: with the interface in Portuguese, the row reads Dissolver, but typing dissolver finds nothing ("dissolve".contains("dissolver") is false). The same goes for Densidade de kernel (Kernel Density).
  2. GeoLibre tools have no translations at all. Their names and summaries come from the runner's manifest and aren't in i18n/*.tsv, so the rows stay in English and the search has nothing else to match. Typing curvas de nível (contour lines) returns Accumulation Curvature, Casorati Curvature, and so on, never Contours From Raster. A teacher has to hand out an English word list before every class.
  3. No output name for GeoLibre tools. crates/geolibre/src/lib.rs drops the manifest's io_role: "output" parameters from the form ("outputs are not form fields") and names the layer after spec.name. Every run of Contours From Raster adds a layer called Contours From Raster, in English, and two runs (10 m and 50 m contours, say) give two layers with the same name that have to be renamed by hand. Built-in tools already take output as the layer name.
Proposed solution

Choices in this proposal

  • Search what the user sees, plus the English. matches also tests tl!(tool.name) and tl!(tool.summary), and folds accents on both sides, so curvas de nivel matches curvas de nível. English stays matched, so tutorials written in English still work. This part is small, needs no new strings, and already fixes built-in tools like Dissolver.
  • GeoLibre tools use GeoLibre's own language packs. opengeos/geolibre-language-packs (MIT) already translates this catalogue: v1/whitebox/<locale>.json (schema schema/v1.json, index v1/index.json) has, for each tool id, its name, description and every parameter's label and description, plus the category and subcategory names. The Portuguese pack covers 1,066 tools; contours_from_raster is "Curvas de nível a partir de raster". There are packs for the same languages RustGIS ships (de, es, fr, it, ja, ko, nl, pt, ru, tr, zh and others). GeoLibre keeps them out of the app and downloads one on demand, or imports it from a file. RustGIS can do the same: when the interface language has a pack, offer to download it next to the runner (or import it from a file), cache it, and look up a GeoLibre tool's name, summary, parameter labels, help and toolbox names there, falling back to English. That needs no new strings in RustGIS's catalogues and no translation work on our side, and stays in step with GeoLibre's catalogue. The packs are untrusted input, as GeoLibre treats them: validate them against the schema, accept string leaves only, and cap their size.
  • An optional "Output name" field on GeoLibre tools. For each io_role: "output" parameter, the form gets a text field. It starts empty, and its hint shows the default name, which is now the translated tool name (tl!(spec.name), plus the output's label when there are several, as today). A name already in use gets a number, as with gp.batch's outputPattern. From a script, the parameter takes the same output key the built-in tools use, so gp.run reads the same for both.
Estimated scope

Medium, in three PRs. Search: crates/ui-egui/src/panes.rs only. Language packs: crates/geolibre (download, cache, validation, lookup) and the tool form and rows, no new dependency (serde_json is already there); the download runs off the UI thread like the runner's download. Output name: crates/geolibre/src/lib.rs (form field and naming) plus the tool form.

Alternatives considered
  • Our own catalogue of GeoLibre strings in i18n/. A thousand-plus tools times every language, kept in step with the runner by hand, when GeoLibre already maintains the same strings.
  • Bundle the packs in RustGIS. About 1.8 MB per language. GeoLibre keeps them out of its builds for that reason, and an on-demand download fits RustGIS's handling of the runner itself.
  • Only add aliases (keywords) to the search. Helps find a tool, but the rows and layer names stay in English, which is the confusing part for students.
  • Keep the English layer name and let users rename. That is today's workaround. Two runs giving two layers with the same name is the part that trips people up.

Tests: a unit test for matches with a translated name and an accent-folded query, and one for the GeoLibre job naming the output from the given output and from the default.

Lingua principale
Rust
Stelle
1.9k
Fork
268
Merge medio
11h 1m
PR unite (30g)
942

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di opengeos/RustGIS

Tutte le issue di opengeos/RustGIS

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.