Hexagon Geospatial
MENU

WebGIS Q&A

WebGIS enables powerful geospatial web applications and services that securely share your organization’s rich geospatial data, and provides tools to deeply examine spatial data and create value added products, on demand.
Showing results for 
Search instead for 
Do you mean 

Is there a way to force a specific language in Geospatial Portal?

by Technical Evangelist on ‎02-09-2018 02:53 AM (233 Views)

Question

Is there a way to force a specific language in Geospatial Portal? By default, Portal uses the language of the browser.

Answer

There's no such functionallity out of the box in Portal but this can be solved with a small customization.

Administrator must modify all ASPX files that are expected to be used by users, adding this code just after the <head> element:

<head runat="server">
<script runat="server" language="C#">
   protected new void InitializeCulture()
   {
      if (Request.Cookies["lngCode"] != null && Request.Cookies["lngCode"].Value != null && Request.Cookies["lngCode"].Value != "")
      {
         // either keep the language manually selected by user (saved in a cookie)
         System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(Request.Cookies["lngCode"].Value);
         System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(Request.Cookies["lngCode"].Value);
      }
      else
      {
         // or use default language
         System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("da-DK");
         System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("da-DK");
      }
   }
</script>
  • Example above will force usage of Danish language but still will take into consideration user selected language.
  • The language selection is held in a web browser cookie.
Contributors