Make Maxar imagery strings translatable (close #7724)

This commit is contained in:
Quincy Morgan
2020-06-24 10:40:46 -04:00
parent 688f4e06b4
commit 06e97cd019
4 changed files with 76 additions and 38 deletions

34
data/manual_imagery.json Normal file
View File

@@ -0,0 +1,34 @@
[
{
"id": "Maxar-Premium",
"name": "Maxar Premium Imagery (Beta)",
"type": "tms",
"default": true,
"attribution": {
"required": true,
"text": "Terms & Feedback",
"url": "https://wiki.openstreetmap.org/wiki/DigitalGlobe"
},
"description": "Maxar Premium is a mosaic composed of Maxar basemap with select regions filled with +Vivid or custom area of interest imagery, 50cm resolution or better, and refreshed more frequently with ongoing updates.",
"icon": "https://osmlab.github.io/editor-layer-index/sources/world/Maxar.png",
"max_zoom": 22,
"url": "7586487389962e3f6e31ab2ed8ca321f2f3fe2cf87f1dedce8fc918b4692efd86fcd816ab8a35303effb1be9abe39b1cce3fe6db2c740044364ae68560822c88373d2c784325baf4e1fa007c6dbedab4cea3fa0dd86ee0ae4feeef032d33dcac28e4b16c90d55a42087c6b66526423ea1b4cc7e63c613940eb1c60f48270060bf41c5fcb6a628985ebe6801e9e71f041cc9f8df06b0345600376663e7dc1cdbc7df16876d8b5d006ed5782e6af4bfe2ff5a292",
"encrypted": true
},
{
"id": "Maxar-Standard",
"name": "Maxar Standard Imagery (Beta)",
"type": "tms",
"default": true,
"attribution": {
"required": true,
"text": "Terms & Feedback",
"url": "https://wiki.openstreetmap.org/wiki/DigitalGlobe"
},
"description": "Maxar Standard is a curated set of imagery covering 86% of the earths landmass, with 30-60cm resolution where available, backfilled by Landsat. Average age is 2.31 years, with some areas updated 2x per year.",
"icon": "https://osmlab.github.io/editor-layer-index/sources/world/Maxar.png",
"max_zoom": 22,
"url": "7586487389962e3f6e31ab2ed8ca321f2f3fe2cf87f1dedce8fc918b4692efd86fcd816ab8a35303effb1be9abe39b1cce3fe6db2c740044364ae68560822c88373d2c784325baf4e1fa007c6dbedab4cea3fa0dd86ee0ae4feeef032d33dcac28e4b16c90d55a42087c6b66526423ea1b4cc7e63c613940eb1c60f48270060bf41c5fcb6a628985ebe6801e9e71f010c8c9d7fb6b534560012461377dc1cdb672f16827dfe0d005bf5685b7ac4ea97cf5f795",
"encrypted": true
}
]

14
dist/locales/en.json vendored
View File

@@ -10892,6 +10892,20 @@
"text": "Urząd Miasta Wrocław"
},
"name": "Wrocław: Orthophotomap 2018 (aerial image)"
},
"Maxar-Premium": {
"name": "Maxar Premium Imagery (Beta)",
"attribution": {
"text": "Terms & Feedback"
},
"description": "Maxar Premium is a mosaic composed of Maxar basemap with select regions filled with +Vivid or custom area of interest imagery, 50cm resolution or better, and refreshed more frequently with ongoing updates."
},
"Maxar-Standard": {
"name": "Maxar Standard Imagery (Beta)",
"attribution": {
"text": "Terms & Feedback"
},
"description": "Maxar Standard is a curated set of imagery covering 86% of the earths landmass, with 30-60cm resolution where available, backfilled by Landsat. Average age is 2.31 years, with some areas updated 2x per year."
}
},
"community": {

View File

@@ -777,12 +777,32 @@ function writeEnJson(tstrings) {
const readCoreYaml = fs.readFileSync('data/core.yaml', 'utf8');
const readImagery = fs.readFileSync('node_modules/editor-layer-index/i18n/en.yaml', 'utf8');
const readCommunity = fs.readFileSync('node_modules/osm-community-index/i18n/en.yaml', 'utf8');
const readManualImagery = fs.readFileSync('data/manual_imagery.json', 'utf8');
return Promise.all([readCoreYaml, readImagery, readCommunity])
return Promise.all([readCoreYaml, readImagery, readCommunity, readManualImagery])
.then(data => {
let core = YAML.load(data[0]);
let imagery = YAML.load(data[1]);
let community = YAML.load(data[2]);
let manualImagery = JSON.parse(data[3]);
for (let i in manualImagery) {
let layer = manualImagery[i];
let id = layer.id;
for (let key in layer) {
if (key === 'attribution') {
for (let attrKey in layer[key]) {
if (attrKey !== 'text') {
delete layer[key][attrKey];
}
}
} else if (['name', 'description'].indexOf(key) === -1) {
delete layer[key];
}
}
// tack on strings for additional imagery not included in the index
imagery.en.imagery[id] = layer;
}
let enjson = core;
enjson.en.presets = tstrings;

View File

@@ -1,8 +1,13 @@
/* eslint-disable no-console */
const fs = require('fs');
const sources = require('editor-layer-index/imagery.json');
let sources = require('editor-layer-index/imagery.json');
const prettyStringify = require('json-stringify-pretty-compact');
if (fs.existsSync('./data/manual_imagery.json')) {
// we can include additional imagery sources that aren't in the index
sources = sources.concat(JSON.parse(fs.readFileSync('./data/manual_imagery.json')));
}
let imagery = [];
// ignore imagery more than 20 years old..
@@ -10,41 +15,6 @@ let cutoffDate = new Date();
cutoffDate.setFullYear(cutoffDate.getFullYear() - 20);
const keep = [
// Add custom sources here if needed.
{
id: 'Maxar-Premium',
name: 'Maxar Premium Imagery (Beta)',
type: 'tms',
default: true,
attribution: {
required: true,
text: 'Terms & Feedback',
url: 'https://wiki.openstreetmap.org/wiki/DigitalGlobe'
},
description: 'Maxar Premium is a mosaic composed of Maxar basemap with select regions filled with +Vivid or custom area of interest imagery, 50cm resolution or better, and refreshed more frequently with ongoing updates.',
icon: 'https://osmlab.github.io/editor-layer-index/sources/world/Maxar.png',
max_zoom: 22,
url: '7586487389962e3f6e31ab2ed8ca321f2f3fe2cf87f1dedce8fc918b4692efd86fcd816ab8a35303effb1be9abe39b1cce3fe6db2c740044364ae68560822c88373d2c784325baf4e1fa007c6dbedab4cea3fa0dd86ee0ae4feeef032d33dcac28e4b16c90d55a42087c6b66526423ea1b4cc7e63c613940eb1c60f48270060bf41c5fcb6a628985ebe6801e9e71f041cc9f8df06b0345600376663e7dc1cdbc7df16876d8b5d006ed5782e6af4bfe2ff5a292',
encrypted: true
}, {
id: 'Maxar-Standard',
name: 'Maxar Standard Imagery (Beta)',
type: 'tms',
default: true,
attribution: {
required: true,
text: 'Terms & Feedback',
url: 'https://wiki.openstreetmap.org/wiki/DigitalGlobe'
},
description: 'Maxar Standard is a curated set of imagery covering 86% of the earths landmass, with 30-60cm resolution where available, backfilled by Landsat. Average age is 2.31 years, with some areas updated 2x per year.',
icon: 'https://osmlab.github.io/editor-layer-index/sources/world/Maxar.png',
max_zoom: 22,
url: '7586487389962e3f6e31ab2ed8ca321f2f3fe2cf87f1dedce8fc918b4692efd86fcd816ab8a35303effb1be9abe39b1cce3fe6db2c740044364ae68560822c88373d2c784325baf4e1fa007c6dbedab4cea3fa0dd86ee0ae4feeef032d33dcac28e4b16c90d55a42087c6b66526423ea1b4cc7e63c613940eb1c60f48270060bf41c5fcb6a628985ebe6801e9e71f010c8c9d7fb6b534560012461377dc1cdb672f16827dfe0d005bf5685b7ac4ea97cf5f795',
encrypted: true
}
];
const discard = {
'osmbe': true, // 'OpenStreetMap (Belgian Style)'
'osmfr': true, // 'OpenStreetMap (French Style)'
@@ -106,7 +76,7 @@ const supportedWMSProjections = {
};
sources.concat(keep).forEach(source => {
sources.forEach(source => {
if (source.type !== 'tms' && source.type !== 'wms' && source.type !== 'bing') return;
if (source.id in discard) return;