c# - .net localization - throw exception in hebrew on englisch operating system -


i have application translated hebrew besides english , german.

to check user input, created validation rule throws argumentoutofrangeexception if value exceeds it's limits.

public override validationresult validate(object value, cultureinfo cultureinfo) {   double validationvalue = 0;   validationvalue = double.parse(value.tostring());    if(validationvalue < min)   {     argumentoutofrangeexception ex = new argumentoutofrangeexception();     return new validationresult(false, ex.message);   }   else if(validationvalue > max)   {     argumentoutofrangeexception ex = new argumentoutofrangeexception();     return new validationresult(false, ex.message);   }    return new validationresult(true, null);   } 

the validation working.
however, if set application language hebrew using cultureinfo.defaultthreadcurrentculture , cultureinfo.defaultthreadcurrentuiculture english exception. setting language german or english, correct exception message. operating system windows 7 english.

  • does text of exception depend on installed languages of os?
  • can resolve problem installing hebrew language pack (only win 7 enterprise/ultimate edition)?

i tried set region israel, cannot install hebrew lp on current test environment.

i found threads people said exceptions should not translated. use internal localization service throw specific exception translated text. if there chance, avoid this.

the .net language pack working. although refactored validation rule. custom message returned if value out of range.

  • i can include minimum , maximum of possible value.
  • future translations not dependent on installed .net language packs.

Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -