Break out translation importing into its own function for load{Locale,Namespace}Async #384
jesperp
started this conversation in
DX improvements
Replies: 2 comments 3 replies
-
Thanks for your suggestion. Indeed it makes sense to expose a function to just load a dictionary. I can add this feature |
Beta Was this translation helpful? Give feedback.
3 replies
-
shipped in version |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Right now,
loadLocaleAsync
andloadNamespaceAsync
imports translations and loads them into theloadedLocales
dictionary. I would like to break out the importing of the translation into a separate exported function that bothloadLocaleAsync
andloadNamespaceAsync
can reuse. This opens up the possibility to get the translations without updating the globally sharedloadedLocales
, which can be problematic in a server environment (see discussions here).This is untested possible solution (I am sure Ivan can clean this up):
I think this is quite a simple structural change that doesn't break anything but opens up a possible solution for users that can't use the singleton dictionary. Sure, I can just do
"generateOnlyTypes": true
and make my own solution but then I loose a lot of the benefits like automatically updating my namespace imports. I think users wants to go great lengths to avoid generateOnlyTypes, unless doing a lot of custom stuff..Thoughts? :)
Beta Was this translation helpful? Give feedback.
All reactions