@octostar/map-component 0.9.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -43
- package/dist/de-CiibAOpt.js +584 -0
- package/dist/de-CiibAOpt.js.map +1 -0
- package/dist/es-D8jViCNt.js +584 -0
- package/dist/es-D8jViCNt.js.map +1 -0
- package/dist/fr-ftr3hxY2.js +584 -0
- package/dist/fr-ftr3hxY2.js.map +1 -0
- package/dist/index.mjs +996 -638
- package/dist/index.mjs.map +1 -1
- package/dist/it-JiSfNdMa.js +584 -0
- package/dist/it-JiSfNdMa.js.map +1 -0
- package/dist/pt-BR-DfnZxiOD.js +584 -0
- package/dist/pt-BR-DfnZxiOD.js.map +1 -0
- package/dist/pt-PT-Cvl_rDbf.js +584 -0
- package/dist/pt-PT-Cvl_rDbf.js.map +1 -0
- package/dist/types/components/cluster-pie-chart.d.ts.map +1 -1
- package/dist/types/components/layers-panel.d.ts.map +1 -1
- package/dist/types/components/map-editor-canvas.d.ts.map +1 -1
- package/dist/types/components/properties-panel.d.ts.map +1 -1
- package/dist/types/components/timebar.d.ts +1 -2
- package/dist/types/components/timebar.d.ts.map +1 -1
- package/dist/types/i18n/icuContext.d.ts +10 -0
- package/dist/types/i18n/icuContext.d.ts.map +1 -0
- package/dist/types/i18n/index.d.ts +17 -0
- package/dist/types/i18n/index.d.ts.map +1 -0
- package/dist/types/i18n/locale.d.ts +12 -0
- package/dist/types/i18n/locale.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/feature-cap.d.ts +3 -24
- package/dist/types/lib/feature-cap.d.ts.map +1 -1
- package/dist/types/lib/ingest-pipeline.d.ts.map +1 -1
- package/dist/types/lib/labels/icon-labels.d.ts +33 -0
- package/dist/types/lib/labels/icon-labels.d.ts.map +1 -0
- package/dist/types/lib/labels/message-labels.d.ts +112 -0
- package/dist/types/lib/labels/message-labels.d.ts.map +1 -0
- package/dist/types/lib/labels/panel-labels.d.ts +328 -0
- package/dist/types/lib/labels/panel-labels.d.ts.map +1 -0
- package/dist/types/lib/map-editor-api.d.ts +6 -8
- package/dist/types/lib/map-editor-api.d.ts.map +1 -1
- package/dist/types/lib/map-labels.d.ts +602 -609
- package/dist/types/lib/map-labels.d.ts.map +1 -1
- package/package.json +15 -1
package/README.md
CHANGED
|
@@ -142,54 +142,48 @@ Host requirements:
|
|
|
142
142
|
/>
|
|
143
143
|
```
|
|
144
144
|
|
|
145
|
-
###
|
|
145
|
+
### Language: `language`
|
|
146
146
|
|
|
147
|
-
|
|
148
|
-
confirm dialogs, icon names)
|
|
149
|
-
|
|
150
|
-
|
|
147
|
+
The map translates every string it draws itself (panels, toolbar, menus,
|
|
148
|
+
tooltips, toasts, confirm dialogs, icon names) into Italian, French, German,
|
|
149
|
+
Spanish, Brazilian and European Portuguese. It shows the language of:
|
|
150
|
+
|
|
151
|
+
1. the `language` prop, a locale tag (`it`, `it-CH`, `pt-BR`), when the map
|
|
152
|
+
ships it;
|
|
153
|
+
2. else the page's `<html lang>`, which the Octostar shell and the apps set to
|
|
154
|
+
the user's locale, so a host usually passes nothing;
|
|
155
|
+
3. else English.
|
|
156
|
+
|
|
157
|
+
The whole tag formats numbers: `it-CH` reads the Italian catalog with Swiss
|
|
158
|
+
digit grouping (an apostrophe between thousands, where `it` writes `12.345`).
|
|
151
159
|
|
|
152
160
|
```tsx
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
const labels: MapLabels = {
|
|
156
|
-
layersPanel: {
|
|
157
|
-
title: t('Layers'),
|
|
158
|
-
groupLayerCount: count => t('{count, plural, one {# layer} other {# layers}}', { count }),
|
|
159
|
-
// ...the group's other keys
|
|
160
|
-
},
|
|
161
|
-
// ...every other group
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
<MapEditorCanvas labels={labels} />;
|
|
161
|
+
<MapEditorCanvas language={userLocale} />
|
|
165
162
|
```
|
|
166
163
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
`selectedCount`, `binEvents` and `binEventsWithSelection` before it
|
|
191
|
-
compiles. The `Timebar` prop itself is still `labels?: Partial<TimebarLabels>`,
|
|
192
|
-
and inside the map the Timebar uses `labels.timebar`.
|
|
164
|
+
Each language's catalog is a separate chunk the map fetches the first time it
|
|
165
|
+
shows that language; until it lands the map shows English. The map reads
|
|
166
|
+
`<html lang>` when it renders, so a host that switches the language without a
|
|
167
|
+
reload passes `language`, which the map follows at once. The map keeps its
|
|
168
|
+
own i18next instance, so a host's i18next (its language, its catalogs) is never
|
|
169
|
+
read or changed. A `Timebar` a host renders on its own follows `<html lang>`.
|
|
170
|
+
|
|
171
|
+
The catalogs live in `client/src/i18n` (gettext `po/*.po` are the source of
|
|
172
|
+
truth, `GLOSSARY.md` the binding terms). After adding or changing a `t()`
|
|
173
|
+
string, run `pnpm i18n:update`, translate the new `msgstr` in every `po/*.po`,
|
|
174
|
+
then `pnpm i18n:compile`; `pnpm i18n:check` and `pnpm lint:i18n` run in CI.
|
|
175
|
+
|
|
176
|
+
### Text stored in data stays English
|
|
177
|
+
|
|
178
|
+
Layer names the map creates are stored in English in every language: "Default
|
|
179
|
+
Layer", "New Layer", "Loaded from workspace" and "N workspace features". Hosts
|
|
180
|
+
match layers by name across users' maps (share links), so a stored name must
|
|
181
|
+
not depend on who created it. Only the display follows the language: any layer
|
|
182
|
+
whose stored name is "Default Layer" shows the translated name (matched by
|
|
183
|
+
name, since restoring a saved map gives layers new ids); once renamed it shows
|
|
184
|
+
its own name. Text the map writes into a feature when it is created (a new
|
|
185
|
+
text label's "New Label") is in the language shown at that moment and is kept
|
|
186
|
+
as written.
|
|
193
187
|
|
|
194
188
|
## License
|
|
195
189
|
|