/// <summary> /// Sets the locale used in any error messages or results returned to the client. /// </summary> /// <param name="locale">The locale name in the format "[languagecode]-[country/regioncode]".</param> /// <returns>A locale that the server supports and is the best match for the requested locale.</returns> public virtual string SetLocale(string locale) { if (_server == null) { throw new NotConnectedException(); } try { // set the requested locale on the server. _locale = _server.SetLocale(locale); } catch { // find a best match and check if the server supports it. string revisedLocale = OpcServer.FindBestLocale(locale, _supportedLocales); if (revisedLocale != locale) { _server.SetLocale(revisedLocale); } // cache the revised locale. _locale = revisedLocale; } // return actual local used. return(_locale); }