r/sveltejs • u/levmiseri • 5h ago
Change anything on this site – powered by svelte
levmiseri.comA fun experiment where users can change or add anything to the site. Everything working very much thanks to the amazingness of Svelte.
r/sveltejs • u/levmiseri • 5h ago
A fun experiment where users can change or add anything to the site. Everything working very much thanks to the amazingness of Svelte.
r/sveltejs • u/pablopang • 3h ago
TUI are all the rage right now and `opentui` it's a very nice way to build one in a simple way...BUT you are stuck with React or Solid which is fine but what if you could use something nicer? What if you could use Svelte?
Well now you can! `opentui-svelte` uses the brand-new custom renderers API to allow you to build TUIs using svelte as the declarative language to define them!
Give it a try a report any issues:
r/sveltejs • u/TheToadKing • 19h ago
I've been developing a site that uses a component context for handling locales/localization. I want to use some of these calls in some +page.server.ts functions, outside of a Svelte context. What is the correct/idiomatic way to write code like this? Right now I have what I feel like is a big hack that does something like this:
export const [getLocaleContext, setLocaleContext] = createContext<{ code: string }>();
let override: string | null = null
export function overrideLocalization(overrideLocale: string, body: () => void) {
override = overrideLocale;
try {
body();
} finally {
override = null;
}
}
function getLocale() {
if (override) {
return override;
} else {
return getLocaleContext().code
}
}I try to make it safer with a wrapper function and try/finally but this still feels really flimsy. Is there a better way to handle this?