c# - How to show a localized exception message -
i need show exception message wcf service in localized language, different english. example, if run instruction anywhere in code:
throw new argumentnullexception(name, "el parámetro es obligatorio.");
the result text "el parámetro es obligatorio. parameter name: xxxx" shown.
i need "parameter name" text translated spanish. think need modify thread culture, not sure how since wcf service.
if language depends on particular client, i'd create overload of functions of service additional parameter language, , set both currentculture , currentuiculture.
if language not depend on client (i.e. same language whole site), set somewhen during start. note new thread inherits language windows, not parent thread, hence have set again every freshly created thread (a newer version of .net framework allows overwrite behavior).
in case, make sure language pack framework installed.
Comments
Post a Comment