-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated translations and CI improvements for CrowdIn
- Loading branch information
Showing
9 changed files
with
174 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,10 +7,10 @@ jobs: | |
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-node@v3 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 'lts/*' | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
- run: npm install | ||
- run: npm run build -- --pathPrefix="/stac-browser" --historyMode=hash | ||
- uses: peaceiris/actions-gh-pages@v3 | ||
|
@@ -19,4 +19,4 @@ jobs: | |
publish_dir: dist | ||
exclude_assets: 'report.html' | ||
user_name: 'STAC Browser CI' | ||
user_email: [email protected] | ||
user_email: [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Fix CrowdIn commits | ||
on: | ||
pull_request: | ||
types: | ||
- unlabeled | ||
jobs: | ||
deploy: | ||
if: ${{ github.event.label.name == 'CI run required' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 'lts/*' | ||
- uses: actions/checkout@v4 | ||
- run: npm install | ||
- run: node helpers/fix-crowdin.js | ||
- name: Commit changes | ||
run: | | ||
git config user.name "STAC Browser CI" | ||
git config user.email "[email protected]" | ||
git add -A | ||
timestamp=$(date -u) | ||
git commit -m ":robot: Automated update for locales: ${timestamp} [skip ci]" || exit 0 | ||
git push | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
// Function to read JSON file | ||
const readJsonFile = (filePath) => { | ||
try { | ||
const data = fs.readFileSync(filePath, 'utf8'); | ||
return JSON.parse(data); | ||
} catch (err) { | ||
console.error(`Error reading file from disk: ${err}`); | ||
return null; | ||
} | ||
}; | ||
|
||
// Function to write JSON file | ||
const writeJsonFile = (filePath, data) => { | ||
try { | ||
fs.writeFileSync(filePath, JSON.stringify(data, null, 2) + "\n", 'utf8'); | ||
console.log(`File has been written: ${filePath}`); | ||
} catch (err) { | ||
console.error(`Error writing file to disk: ${err}`); | ||
} | ||
}; | ||
|
||
// Function to remove empty strings from an object deeply | ||
const removeEmptyStrings = (obj) => { | ||
if (Array.isArray(obj)) { | ||
return obj.map(removeEmptyStrings).filter((item) => item !== ''); | ||
} else if (obj !== null && typeof obj === 'object') { | ||
return Object.entries(obj) | ||
.filter(entry => entry[1] !== '') | ||
.reduce((acc, [k, v]) => { | ||
acc[k] = removeEmptyStrings(v); | ||
return acc; | ||
}, {}); | ||
} | ||
return obj; | ||
}; | ||
|
||
// Main function to process the locales directory | ||
const processLocales = (localesDir) => { | ||
const folders = fs.readdirSync(localesDir); | ||
|
||
folders.forEach((folder) => { | ||
const folderPath = path.join(localesDir, folder); | ||
|
||
if (fs.statSync(folderPath).isDirectory()) { | ||
['texts.json', 'fields.json'].forEach((fileName) => { | ||
const filePath = path.join(folderPath, fileName); | ||
if (fs.existsSync(filePath)) { | ||
const jsonData = readJsonFile(filePath); | ||
if (jsonData) { | ||
const cleanedData = removeEmptyStrings(jsonData); | ||
writeJsonFile(filePath, cleanedData); | ||
} | ||
} | ||
}); | ||
} | ||
}); | ||
}; | ||
|
||
// Execute the main function | ||
processLocales('src/locales'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,81 @@ | ||
{ | ||
"actions": {}, | ||
"anonymized": { | ||
"title": "Anonymised" | ||
}, | ||
"assets": { | ||
"alternate": {}, | ||
"copyGdalVfsUrl": {}, | ||
"copyUrl": {}, | ||
"download": {}, | ||
"role": {} | ||
}, | ||
"authentication": { | ||
"button": {} | ||
}, | ||
"catalog": {}, | ||
"catalogs": { | ||
"filterByTitle": "Filter catalogues by title", | ||
"filterByTitleAndMore": "Filter catalogues by title, description or keywords", | ||
"noMatches": "No catalogues match the given search criteria." | ||
}, | ||
"checkbox": {}, | ||
"deprecation": {}, | ||
"errors": { | ||
"labels": {}, | ||
"noExternalAccess": "Accessing external catalogues is not allowed!" | ||
}, | ||
"fullscreen": {}, | ||
"goBack": {}, | ||
"goToCollection": {}, | ||
"goToParent": {}, | ||
"index": { | ||
"catalog": "Catalogue", | ||
"specifyCatalog": "Please specify a STAC Catalogue or API..." | ||
}, | ||
"items": {}, | ||
"leaflet": { | ||
"stayLayer": {}, | ||
"zoom": { | ||
"in": {}, | ||
"out": {} | ||
} | ||
}, | ||
"metadata": {}, | ||
"multiselect": {}, | ||
"pagination": {}, | ||
"protocol": { | ||
"s3": {} | ||
}, | ||
"providers": { | ||
"role": {} | ||
}, | ||
"read": {}, | ||
"search": { | ||
"logical": {}, | ||
"sortOptions": {}, | ||
"tabs": {} | ||
}, | ||
"sidebar": { | ||
"switchCatalog": "Switch Catalogue" | ||
}, | ||
"stacCatalog": "Catalogue | Catalogues" | ||
"sort": { | ||
"asc": {}, | ||
"desc": {} | ||
}, | ||
"source": { | ||
"language": {}, | ||
"share": {}, | ||
"validationParams": {}, | ||
"validationReport": {} | ||
}, | ||
"stacCatalog": "Catalogue | Catalogues", | ||
"table": { | ||
"sort": {} | ||
}, | ||
"tree": {}, | ||
"view": { | ||
"list": {}, | ||
"tiles": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -528,4 +528,4 @@ | |
"°E": "°E", | ||
"°N": "°N", | ||
"μm": "μm" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters