diff --git a/package.json b/package.json index 67759763a..64d0ea342 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,8 @@ "license": "ISC", "dependencies": { "@apidevtools/json-schema-ref-parser": "^9.0.9", - "@radiantearth/stac-fields": "1.0.0-beta.19", + "@musement/iso-duration": "^1.0.0", + "@radiantearth/stac-fields": "1.0.0-beta.20", "@radiantearth/stac-migrate": "~1.2.0", "axios": "^1.2.0", "bootstrap-vue": "^2.21.2", diff --git a/src/StacBrowser.vue b/src/StacBrowser.vue index 5c1681cfd..e85c3f9d8 100644 --- a/src/StacBrowser.vue +++ b/src/StacBrowser.vue @@ -49,6 +49,9 @@ import STAC from './models/stac'; import Utils from './utils'; import URI from 'urijs'; +import I18N from '@radiantearth/stac-fields/I18N'; +import { translateFields } from './i18n'; + Vue.use(Clipboard); Vue.use(AlertPlugin); @@ -139,7 +142,13 @@ export default { immediate: true, async handler (locale) { this.$root.$i18n.locale = locale; - require(`./locales/${locale}/datepicker.js`); + + // require(`./locales/${locale}/datepicker`); + // require(`./locales/${locale}/duration`); + + // Update stac-fields + I18N.locales = [locale]; + I18N.translate = translateFields; if (this.data instanceof STAC) { let link = this.data.getLocaleLink(locale, this.fallbackLocaleFromVueX); diff --git a/src/components/Links.vue b/src/components/Links.vue index a15c07aba..4f0136c28 100644 --- a/src/components/Links.vue +++ b/src/components/Links.vue @@ -25,6 +25,7 @@ import Fields from '@radiantearth/stac-fields/fields.json'; import { ogcRelPrefix } from '../rels'; import Utils from '../utils'; import { formatKey } from '@radiantearth/stac-fields/helper'; +import { translateFields } from '../i18n'; export default { @@ -68,7 +69,7 @@ export default { formatRel(rel) { let lc = typeof rel === 'string' ? rel.toLowerCase() : ""; if (lc in Fields.links.rel.mapping) { - return Fields.links.rel.mapping[lc]; + return translateFields(Fields.links.rel.mapping[lc]); } else { if (rel.startsWith(ogcRelPrefix)) { diff --git a/src/components/Metadata.vue b/src/components/Metadata.vue index 7c59ca2d4..bd0621db5 100644 --- a/src/components/Metadata.vue +++ b/src/components/Metadata.vue @@ -10,6 +10,8 @@