this post was submitted on 21 Aug 2023
35 points (100.0% liked)
Programming
17366 readers
495 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities !webdev@programming.dev
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
If you are using TypeScript it's quite easy to create a system where the type system will enforce the existence of all translations. I think it should be possible to create a similar solution for other languages as well.
For example:
Missing keys will fail compilation. If you want to skip check you can always use //@ts-ignore
Additionally the type system will enforce only valid translation keys so you won't be able to make a typo it forget to add English translation.
I think I actually just want a system, which will take my English file as the default, and add the missing keys to the rest of the language files.
Quite a lot of IDEs will key you just click "add missing properties" action on the translation object to create a language file.