LazZiya / XLocalizer

Localizer package for Asp.Net Core web applications, powered by online translation and auto resource creating.
https://docs.ziyad.info
128 stars 14 forks source link

FormatException: Input string was not in a correct format. #40

Closed faresayyad closed 1 year ago

faresayyad commented 1 year ago

Hello,

I have a decimal property in the model image

When I switch to the Arabic language error is thrown like this: image


image

LazZiya commented 1 year ago

Can you check the Arabic translations in the resource file? There could be a conflict due to decimal number format (comma) 0,00 and (period) 0.00.

Again you also need to take care of the input field numbering format and validation, because the Arabic culture will accept Arabic (previously known as Hindu) digits ٠١٢٣٤٥٦٧٨٩ but the default input is Latin (previously known as Arabic) digits 0123456789, so you may want to amend the accepted input for Arabic culture to accept Latin digits.

read more here about number systems and how to setup client side validation:

faresayyad commented 1 year ago

Thank you for your response. Actually, I didn't insert any number in the field yet. i changed the language from the drop down list

image

Then the exception thrown

LazZiya commented 1 year ago

Did you checked the resource file for the translated resource name? also check the translated model binding and data annotations messages.

faresayyad commented 1 year ago

I am using XML with MyMemmoryTranslate service: The translation file:

image

LazZiya commented 1 year ago

What about data annotations and model binding errors? do you have them translated?

faresayyad commented 1 year ago

What do you mean by data annotations translation and model binding !?

LazZiya commented 1 year ago

See Validation errors and Model binding errors.

Those error messages could have some invalid translation causing comma and period conflict in different cultures. Search the XML file for any relevant one.

faresayyad commented 1 year ago

The XML File don't have any ModelBinding translation !

faresayyad commented 1 year ago

I mean the XML file contains only one translation regarding the two fields

image

image