Skip to content

Commit

Permalink
Merge pull request #51 from performant-software/RB-bug-fixes
Browse files Browse the repository at this point in the history
Debugging the map search further
  • Loading branch information
ajolipa authored May 10, 2024
2 parents 2ce9e34 + aa9c28e commit a94c656
Show file tree
Hide file tree
Showing 26 changed files with 2,001 additions and 138 deletions.
7 changes: 5 additions & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"recommendations": ["astro-build.astro-vscode"],
"recommendations": [
"astro-build.astro-vscode",
"inlang.vs-code-extension"
],
"unwantedRecommendations": []
}
}
9 changes: 8 additions & 1 deletion astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@ import netlify from "@astrojs/netlify";
import mdx from "@astrojs/mdx";
import tailwind from "@astrojs/tailwind";
import sitemap from "@astrojs/sitemap";
import config from "./src/i18n/config";
import paraglide from '@inlang/paraglide-astro';

import react from "@astrojs/react";

// https://astro.build/config
export default defineConfig({
i18n: config.i18n,
output: "server",
adapter: netlify(),
integrations: [mdx(), tailwind(), sitemap(), react()],
integrations: [mdx(), tailwind(), sitemap(), react(), paraglide({
// recommended settings
project: "./project.inlang",
outdir: "./src/paraglide", //where your files should be
})],
vite: {
resolve: {
preserveSymlinks: true,
Expand Down
30 changes: 30 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const fs = require('fs');

const getFields = async () => {
const coreDataPayload = await fetch('https://core-data-cloud-staging-2c51db0617a5.herokuapp.com/core_data/public/projects/24/descriptors').then((res) => {
return res.json();
});
let coreDataFields = '';
let enJson = {};
coreDataPayload && coreDataPayload.descriptors && coreDataPayload.descriptors.forEach((field, idx) => {
const label = `${field?.context ? `${field.context} -> ` : ''}${field.label}`;
coreDataFields += `${idx > 0 ? ',\n\t': '\t'}"${field.identifier}": {\n\t\tcaption: m.${`t_${field.identifier.replaceAll('-', '').replaceAll(' ', '')}`}(),\n\t\ttinaLabel: "${label}"\n\t}`;
enJson[`t_${field.identifier.replaceAll('-', '').replaceAll(' ', '')}`] = field.label;
})
// create new user defined field config file
const userDefinedFields = `import * as m from "../paraglide/messages.js";\n\nconst userDefinedFields = {\n${coreDataFields}\n}\n\nexport default userDefinedFields;`
fs.writeFileSync('./src/i18n/userDefinedFields.ts', userDefinedFields);
console.log('New userDefinedFields file created!');

// put initial English values in
let en = JSON.parse(fs.readFileSync('./content/ui/en.json', 'utf8'));
Object.keys(enJson).forEach((key) => {
if (!Object.keys(en).includes(key)) {
en[key] = enJson[key];
}
});
fs.writeFileSync('./content/ui/en.json', JSON.stringify(en, null, '\t'));
console.log('Default English values populated!');
}

getFields();
29 changes: 29 additions & 0 deletions content/ui/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"t_map": "Map",
"t_home": "Home",
"t_about": "About",
"t_paths": "Paths",
"t_posts": "Posts",
"t_title": "Name",
"t_root": "Places",
"t_b1e5fbf908034e398810d252eeb1b714": "Places",
"t_988645ac54c54de7aa827c1f8489036c": "Address",
"t_e86ea9bfb8e9407eb1f6dadf9318bc5a": "People",
"t_a2932c3c4257453197ffe810bee2bb93": "Nickname",
"t_8fb6371fcb7c4a048365804336a0e8c1": "Organizations",
"t_99848f101acd41b3a79c1253735b6498": "Dates",
"t_cb28be8a29664899a688fc193e4cd1f3": "Archives",
"t_4706a19055fa4c6aa122b1fbeadf831f": "Notes",
"t_8e1f898712dd46e0a413fdbce695a665": "OCLC NO",
"t_443682f46eb14682a52572a7e887787d": "Libraries",
"t_0eaeca10fcb04d46961e132f4c6c9694": "Photos",
"t_c083228a547249528bf5170ca9564dd2": "Poems",
"t_7a6901c7d6084a5cb984b272cf436f7e": "Events",
"t_44c190bfa51a451db5f6f72710916816": "Editor",
"t_253bfff8ccb3467cb7249082c1130ad4": "Publisher",
"t_a15ae785173b4c95aeb5bf9aeb8b4252": "Contributor",
"t_83f862f6f23145f79bc166ef8c2eeaf3": "Organization",
"t_db766f684e574016b3a37ba76ea1b215": "Landscapes",
"t_c969f66cf9b04305aeda0e2768397f0a": "Author",
"t_e0f9145da27445149ffd49ac1945fe4b": "Event Locations"
}
3 changes: 3 additions & 0 deletions messages/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"$schema": "https://inlang.com/schema/inlang-message-format"
}
Loading

0 comments on commit a94c656

Please sign in to comment.