-
Notifications
You must be signed in to change notification settings - Fork 27
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
Dynamic locales in production mode build #20
Comments
About your first issue: please see globalizejs/globalize-compiler#10 and just let me know if you have any further question. About your second issue: When you use
Please, just let me know if you have any questions. |
Thanks a lot for the answers. I've tried the solution for the second issue. It works fine! However I still have questions regarding the first problem. In our project we need to create some wrappers for globalize functions. And therefore it is very important for us to be able to pass different format options as parameters. Obviously creating a separate formatter for each option is not suitable for us. Thanks |
I'm glad it could be of help and you're welcome.
In this case, you need to use regular Globalize, not the runtime one. Regular Globalize has code to traverse CLDR JSON and generate formatters on the fly. Alternatively to that, you could fork Globalize-compiler to statically parse your wrapper instead of Globalize calls. This would allow you to generate compiled code for your wrapper. |
I'm closing this issue, but feel free to add new comments if you have any further questions. |
Hey there, we are trying to set locale dynamically in the production build.
And we have faced several issues. Perhaps we are doing something very wrong. But we will appreciate any help and explanations.
To easily reproduce the problem we can consider app-npm-webpack example project.
First issue:
var numberFormatter = Globalize.numberFormatter( { maximumFractionDigits: 2 } );
with
Result: I'm getting the following error:
Second issue:
var numberFormatter = Globalize.numberFormatter( { maximumFractionDigits: 2 } );
with
<script src="i18n/de.87c3b28dd71ac48d7ae8.js"></script>
in index.htmlResult:
Uncaught TypeError: numberFormatter is not a function
Is it a valid use case at all?
Is it possible to have several locales simultaneously in the production build and change them dynamically from the code?
We have seen similar questions (#13 and #15). But unfortunately they don't really give the answers to our questions.
Thanks.
The text was updated successfully, but these errors were encountered: