04:27:58
redsh4de:matrix.org:
Just have to run “pnpm install” to get the dependencies - it will be installed with the rest of the packages
05:07:26
redsh4de:matrix.org:
can check if it installed after by running “pnpm lefthook check-install”
08:58:19
redsh4de:matrix.org:
note that when using pnpm install --prod - it will install only packages required for building, developer tools & packages will be skipped
09:07:39
basses:matrix.org:
btw not localized yet > <@redsh4de:matrix.org> added @basses:matrix.org, looks pretty good
09:08:02
redsh4de:matrix.org:
Ah yeah didnt add translation keys for arabic/cn
09:08:03
redsh4de:matrix.org:
sec
09:09:40
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
09:10:03
basses:matrix.org:
ok
10:51:21
redsh4de:matrix.org:
Updated texts
11:28:17
redsh4de:matrix.org:
plowsof: wen weblate
11:38:57
plowsof:
no updates yet sorry
15:32:21
basses:matrix.org:
plowsof: SARR
15:32:43
redsh4de:matrix.org:
https://docs.astro.build/en/guides/middleware/
15:32:50
redsh4de:matrix.org:
i am about to DESTROY so much boilerplate with this
15:35:04
redsh4de:matrix.org:
will let me define per-locale functions once in a global context, then just let pages use the global context functions
15:35:04
redsh4de:matrix.org:
instead of doing shit like const locale = getLocale(Astro.url) for every page or component that needs access to locale info
15:35:04
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
15:37:23
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
15:37:23
redsh4de:matrix.org:
so calls like localizeHref(locale, url) can just turn into localizeHref(url)
15:37:43
redsh4de:matrix.org:
the user won't have to worry about wiring in functions or locale parameters it will all happen in the background
15:37:44
redsh4de:matrix.org:
peak
21:23:50
321bob321:
@basses:matrix.org: Lost in the ether - eum
21:37:48
selsta:
redsh4de: how would middleware work together with a static website?
21:43:41
syntheticbird:
im supporting selsta question
21:43:54
syntheticbird:
afaik middleware is when using Astro in SSR mode
21:44:06
selsta:
yes it's not something we can use
21:46:26
redsh4de:matrix.org:
it is something we can use
21:46:48
redsh4de:matrix.org:
astro's middleware in the SSR context simply injects variables in the middle of rendering the page
21:47:04
selsta:
how? we don't want to run node.js on the derver
21:47:07
selsta:
server
21:47:22
syntheticbird:
i see your point but it was assumed obvious by a lot that SSR was out because js is also excluded from server
21:47:40
syntheticbird:
yeah this
21:47:43
redsh4de:matrix.org:
nvm, im confusing SSR with SSG
21:47:51
redsh4de:matrix.org:
it works the same on SSG
21:48:23
syntheticbird:
press x for doubt (with all due respect to you and your work)
21:48:33
redsh4de:matrix.org:
i tested this thouroughly and built this
21:49:08
redsh4de:matrix.org:
ill find something from the docs to back this up
21:49:38
redsh4de:matrix.org:
but its basically the same reason how we can have open-graph images generated at build time
21:50:21
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
21:51:20
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
21:51:44
redsh4de:matrix.org:
Yeah no that was a non-starter from the start
21:52:47
redsh4de:matrix.org:
built output is fully static & my current github actions explicitly checks for lack of presence of script usage
21:52:58
redsh4de:matrix.org:
(in the build output)
21:54:24
redsh4de:matrix.org:
https://docs.astro.build/en/guides/middleware/
21:55:01
redsh4de:matrix.org:
"...rendering occurs at build time for all prerendered pages"
21:57:07
redsh4de:matrix.org:
also mentioned in the roadmap issue for Astro middleware, at the bottom: https://github.com/withastro/roadmap/issues/531
22:00:02
selsta:
I don't know enough about Astro :/
22:00:26
redsh4de:matrix.org:
all good i only figured out that this can be used today as well
22:00:55
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
22:02:07
redsh4de:matrix.org:
got rid of 250+ loc with this change across the codebase