We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Related to this old question: #344
The model:
var culture = CultureInfo.CreateSpecificCulture("en-US"); var jsonSettings = new JsonSerializerSettings { Culture = culture }; var model = JsonConvert.DeserializeObject("{ \"id\": 0.005 }", jsonSettings);
The template:
"test {{id}}"
Handlebars created like:
var config = new HandlebarsConfiguration { FormatProvider = culture }; var handlebars = HandlebarsDotNet.Handlebars.Create(config);
Execute the template:
var template = Handlebars.Compile(text); var result = template(model);
And the result is:
"test 0,005" // <-- It's formatted using my local culture (Dutch) and not en-US?
The text was updated successfully, but these errors were encountered:
@zjklee or @rexm : do you have an idea on this?
Sorry, something went wrong.
@StefH Please ignore my first "solution" the actual solution is to deserialize into an ExpandObject, that still allows you to support dynamic values.
So your code should look like the following
var culture = CultureInfo.CreateSpecificCulture("en-US"); var model = JsonConvert.DeserializeObject<ExpandObject>("{ \"id\": 0.005 }");
No branches or pull requests
Related to this old question:
#344
The model:
The template:
"test {{id}}"
Handlebars created like:
Execute the template:
And the result is:
The text was updated successfully, but these errors were encountered: