-
br-m
<redsh4de:matrix.org> Just have to run “pnpm install” to get the dependencies - it will be installed with the rest of the packages
-
br-m
<redsh4de:matrix.org> can check if it installed after by running “pnpm lefthook check-install”
-
br-m
<redsh4de:matrix.org> note that when using pnpm install --prod - it will install only packages required for building, developer tools & packages will be skipped
-
br-m
<basses:matrix.org> btw not localized yet > <@redsh4de:matrix.org> added @basses:matrix.org, looks pretty good
-
br-m
<redsh4de:matrix.org> Ah yeah didnt add translation keys for arabic/cn
-
br-m
<redsh4de:matrix.org> sec
-
br-m
<redsh4de:matrix.org> from a grep search every string should be localization ready - but some translation json files may not have the translations added, so it falls back to the english json for that specific string
-
br-m
<basses:matrix.org> ok
-
br-m
<redsh4de:matrix.org> Updated texts
-
br-m
<redsh4de:matrix.org> plowsof: wen weblate
-
plowsof
no updates yet sorry
-
br-m
<basses:matrix.org> plowsof: SARR
-
br-m
-
br-m
<redsh4de:matrix.org> i am about to DESTROY so much boilerplate with this
-
br-m
<redsh4de:matrix.org> will let me define per-locale functions once in a global context, then just let pages use the global context functions
-
br-m
<redsh4de:matrix.org> instead of doing shit like const locale = getLocale(Astro.url) for every page or component that needs access to locale info
-
br-m
<redsh4de:matrix.org> can just do const { locale, dir, t } = Astro.locals and it all will be the same function instead of creating new instances every time
-
br-m
<redsh4de:matrix.org> oh and can also turn the existing i18n utils into constructor functions and re-export them via the Astro.locals with the locale info already embedded
-
br-m
<redsh4de:matrix.org> so calls like localizeHref(locale, url) can just turn into localizeHref(url)
-
br-m
<redsh4de:matrix.org> the user won't have to worry about wiring in functions or locale parameters it will all happen in the background
-
br-m
<redsh4de:matrix.org> peak
-
br-m
<321bob321> @basses:matrix.org: Lost in the ether - eum
-
selsta
redsh4de: how would middleware work together with a static website?
-
br-m
<syntheticbird> im supporting selsta question
-
br-m
<syntheticbird> afaik middleware is when using Astro in SSR mode
-
selsta
yes it's not something we can use
-
br-m
<redsh4de:matrix.org> it is something we can use
-
br-m
<redsh4de:matrix.org> astro's middleware in the SSR context simply injects variables in the middle of rendering the page
-
selsta
how? we don't want to run node.js on the derver
-
selsta
server
-
br-m
<syntheticbird> i see your point but it was assumed obvious by a lot that SSR was out because js is also excluded from server
-
br-m
<syntheticbird> yeah this
-
br-m
<redsh4de:matrix.org> nvm, im confusing SSR with SSG
-
br-m
<redsh4de:matrix.org> it works the same on SSG
-
br-m
<syntheticbird> press x for doubt (with all due respect to you and your work)
-
br-m
<redsh4de:matrix.org> i tested this thouroughly and built this
-
br-m
<redsh4de:matrix.org> ill find something from the docs to back this up
-
br-m
<redsh4de:matrix.org> but its basically the same reason how we can have open-graph images generated at build time
-
br-m
<redsh4de:matrix.org> in SSG, the middleware runs at build time as well only - the static pages are generated with the middleware running in the middle of the build process, because the build process is the only place that has JavaScript execution
-
selsta
if it works that it only runs on build time it's fine, I just don't want to increase our attack vector with a node.js server
-
br-m
<redsh4de:matrix.org> Yeah no that was a non-starter from the start
-
br-m
<redsh4de:matrix.org> built output is fully static & my current github actions explicitly checks for lack of presence of script usage
-
br-m
<redsh4de:matrix.org> (in the build output)
-
br-m
-
br-m
<redsh4de:matrix.org> "...rendering occurs at build time for all prerendered pages"
-
br-m
<redsh4de:matrix.org> also mentioned in the roadmap issue for Astro middleware, at the bottom:
withastro/roadmap #531
-
selsta
I don't know enough about Astro :/
-
br-m
<redsh4de:matrix.org> all good i only figured out that this can be used today as well
-
br-m
<redsh4de:matrix.org> there had to be some way to not have to inject localization boilerplate function into every page and component that might need it
-
br-m
<redsh4de:matrix.org> got rid of 250+ loc with this change across the codebase