-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Behind the scenes key generation for @solid-primitives/i18n
#493
Comments
Do you think it's worth the effort? |
I don't think I understand. |
The goal is to make internalization as seamless as possible. So that when i use the
or just
now when resolving the translation a hash of the string The problem now is how to get the hashes into the dict? We could use a cli command for extracting all
en.json (is skipped because it's the default language) the default value in Ok so now, we have a ultimate beast of automation. Because the developer can just make as many There is just one catch, that adds a little bit of work i just discovered: When we change the default value afterwards, there is no way for the extractor to know what the old translation was. In this case the extractor must also output a list of all redundant keys so that the translator can match them up afterwards manually. And i think that's a worth it trade-off because in most cases when you change the default value (the english translation) you might also want to change the other translations. With that you have to at least do something manual with them so you can't miss a changed default value, which could also be a benefit. I hope I've made my idea clear enough, but if you have any questions left, don't hesitate to ask. |
There is also a second issue, with nested translations, so eg:
if the export encounters such nested translations, the only thing we can do is to inform the developer or translator about the line of code where it occurs and in this case we need to go back to manual legacy translations with custom keys, but that's not really a problem because this is just an extension and doesn't have to be used. Further extendingFor these nested translations we can offer a vite plugin that monitors all those custom keys and also automatically puts them into a json file. .... and this would be the ultimate translation experience, wouldn't it? 😉 |
Describe The Problem To Be Solved
As a developer I don't want to have to come up with an project-wide unique key for each piece of text that needs to be internationalized. The given
defaultValue
with parameters should be enough and the rest should be handled in the background.Suggest A Solution
A CLI Tool as this Feature requests (#492) could output a hash-map like .json output. And a vite plugin generates theses hashes in advance so that we have identical lookup times, less work and smaller bundles on the client side.
A killer feature would be to automatically determine the hash length so that for small projects only two to three letters do the trick which would also significantly reduce bundle size of these translation json's
The text was updated successfully, but these errors were encountered: