Skip to content

Commit

Permalink
Make EN locale more international, add EN-US alternatively available …
Browse files Browse the repository at this point in the history
…for the US, i18n optimizations, update stac-fields
  • Loading branch information
m-mohr committed Jun 7, 2024
1 parent 900a3ee commit 7d80990
Show file tree
Hide file tree
Showing 31 changed files with 1,110 additions and 1,125 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ The following languages are currently supported:

- German (Germany, Switzerland)
- Spanish
- English (US, UK)
- English (International, US, UK)
- French (Canada, France, Switzerland)
- Italian (Italy, Switzerland)
- Romanian
Expand Down
1 change: 1 addition & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports = {
"es",
"en",
// "en-GB",
// "en-US",
"fr",
// "fr-CA",
// "fr-CH",
Expand Down
1,587 changes: 748 additions & 839 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"dependencies": {
"@apidevtools/json-schema-ref-parser": "^10.1.0",
"@musement/iso-duration": "^1.0.0",
"@radiantearth/stac-fields": "1.3.3",
"@radiantearth/stac-fields": "1.4.0",
"@radiantearth/stac-migrate": "~1.6.0",
"ajv-i18n": "^4.2.0",
"axios": "^1.2.0",
Expand Down
10 changes: 1 addition & 9 deletions src/StacBrowser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ import STAC from './models/stac';
import Utils from './utils';
import URI from 'urijs';
import I18N from '@radiantearth/stac-fields/I18N';
import { translateFields, API_LANGUAGE_CONFORMANCE, loadMessages } from './i18n';
import { API_LANGUAGE_CONFORMANCE } from './i18n';
import { getBest, prepareSupported } from './locale-id';
import BrowserStorage from "./browser-store";
Expand Down Expand Up @@ -144,13 +143,6 @@ export default {
return;
}
// Update stac-fields
I18N.locales = [locale];
I18N.translate = translateFields;
// Load messages
await loadMessages(locale);
// Set the locale for vue-i18n
this.$root.$i18n.locale = locale;
Expand Down
3 changes: 2 additions & 1 deletion src/components/Catalogs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ export default {
}
// Sort
if (!this.hasMore && this.sort !== 0) {
catalogs = catalogs.slice(0).sort((a,b) => STAC.getDisplayTitle(a).localeCompare(STAC.getDisplayTitle(b), this.uiLanguage));
const collator = new Intl.Collator(this.uiLanguage);
catalogs = catalogs.slice(0).sort((a,b) => collator.compare(STAC.getDisplayTitle(a), STAC.getDisplayTitle(b)));
if (this.sort === -1) {
catalogs = catalogs.reverse();
}
Expand Down
3 changes: 2 additions & 1 deletion src/components/Items.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ export default {
chunkedItems() {
let items = this.items;
if (this.sort !== 0) {
items = items.slice(0).sort((a,b) => STAC.getDisplayTitle(a).localeCompare(STAC.getDisplayTitle(b), this.uiLanguage));
const collator = new Intl.Collator(this.uiLanguage);
items = items.slice(0).sort((a,b) => collator.compare(STAC.getDisplayTitle(a), STAC.getDisplayTitle(b)));
if (this.sort === -1) {
items = items.reverse();
}
Expand Down
3 changes: 2 additions & 1 deletion src/components/Links.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ export default {
}
return summary;
}, {});
return Object.values(groups).sort((g1, g2) => g1.label.localeCompare(g2.label, this.uiLanguage));
const collator = new Intl.Collator(this.uiLanguage);
return Object.values(groups).sort((g1, g2) => collator.compare(g1.label, g2.label));
},
hasGroups() {
return this.groups.some(group => group.rel.length > 0 && group.links.length >= 2);
Expand Down
4 changes: 2 additions & 2 deletions src/components/Map.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<template>
<div class="map-container">
<l-map class="map" v-if="show" :class="stac.type" @ready="init" :options="mapOptions">
<l-control-fullscreen :key="`z${ix}`" :options="fullscreenOptions" />
<l-control-zoom :key="`z${ix}`" v-bind="zoomControlTexts" position="topleft" />
<l-control-fullscreen :key="`fullscreen${ix}`" :options="fullscreenOptions" />
<l-control-zoom :key="`zoom${ix}`" v-bind="zoomControlTexts" position="topleft" />
<l-control-layers v-if="showLayerControl" position="bottomleft" ref="layerControl" />
<component
v-for="basemap of basemaps" :is="basemap.is" :key="basemap.key"
Expand Down
Loading

0 comments on commit 7d80990

Please sign in to comment.