dependency free (practically) i18n/translation plugin for Fresh #856
brocococonut
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey all~
I've been working on a translation/i18n plugin for some of my personal stuff and figured I'd share it. The name I gave it while sleep deprived is
freshlate
(fresh - translate) - I know, not the best name.Anyway, the only dependencies it has are the same ones the twind plugin has and ones you'd already have built into fresh and a fresh project - preact (typings), and fresh. The file directory structure is borrowed almost entirely from the twind plugin - so thank you to the contributors who put that in place!
It supports formatting and substitution (albeit rudimentary) with a format like below:
This is outlined further in the readme though.
It can also hydrate translations from an api endpoint (it only really accepts an object of translation keys for a specified language) on the browser side for if the plugin languages get out of sync with what you want to display on the frontend for some reason. Or if you don't want to send any translations in the initial package to begin with. This still needs to be documented further, but I'm too tired tonight to continue working on the readme I started
You can find it on deno.land here: plugin: freshlate
Let me know if you have any questions or feedback! Please do remain civil though, this is my first time really contributing something to a bigger project like fresh 😅
Beta Was this translation helpful? Give feedback.
All reactions