Internationalization of login screen

7
Is it possible to use different languages on the login screen? I want to change the language of the labels 'Username' and 'Password'. I also want to change the error message for a wrong login.
asked
5 answers
12

Internationalization (AKA i18n) is always a tricky problem. Short answer is 'yes', you can i18n the login page. The longer answer is 'well, it depends' and it mostly depends on your deployment environment.

The login page is simply the page that you are given by the webserver. The webserver doesn't know or care about your arbitrary preferences for one language or another, unless it has special logic to analyze the HTTP headers of this request OR has logic to analyze application-based session headers.

All-in-all it's reasonable to assume that your webserver doesn't have i18n logic and also doesn't have magical Mendix awareness (which would create other problems).

What I would do for i18n login pages is to setup re-write rules for incoming request for login pages based on the URL. E.g. for fr.example.com I would serve up index.fr.html and for cn.example.com I would serve up index.cn.html. Both would re-direct (after a successful login) to www.example.com, which would serve up a UI based on the language set in the user profile.

Your choices may vary, but a large part of the login UI is dependant on the configuration of the webserver.

answered
8

Since 2.4.3 the following system texts are available in the internationalization -> system texts section of the modeler for configuring the texts shown in the login screen:

  • Sign in failed
  • User name
  • Sign in
  • User name / password incorrect
  • Password
  • Internal server error
  • Server not found
  • Service unavailable

By default the default language chosen in the Modeler will be shown in the login screen.

You can also configure the prefered language by hand by including the right javascript file from the web/ui/js directory. For example en.js or nl.js. We've done this so you can configure your application in such a way that you can provide the right language of the login screen based on the url, i.e. let application.nl point to the login screen with dutch captions and application.com to the english one.

answered
6

Yes, yes we can! You can change these texts in the modeler under "Internationalization", just like any other text. Double-click on "System Texts" and then set the "Username", "Password" and "username/password incorrect" texts to whatever you like. The texts will be displayed in the default language, as configured in the modeler.

Note that this is only available in versions 2.4.3 and up

answered
4

In addition to what Michiel said about the 'special logic to analyze the HTTP headers': ... A standard protocol for negotiating a translation used by the server to deliver pages to the client is described in the Content Negotiation system for HTTP. By examining the HTTP Request Headers sent by the client/browser, it is possible to retrieve the preferred language used by the browser. Most of the time, this corresponds to the i18n translation of your webbrowser program. itself (e.g. using a enUS or nlNL).

The content negotiation system can be used for lots of other purposes, but we're talking about languages here.

Anyway... The preferred place to implement functionality like this is not inside the Mendix server, but using whatever HTTP server program you are using to deliver static content to users. (an example of a often used webserver application is the Apache Webserver which has extensive documentation about Content Negotiation features.)

answered
3

No you can't in any of the older modeler versions (2.4.2 and lower) how is the client supposed to know which user is going to login in the future. If you see the login screen the client has no idea who is going to login. So how would the client determine which language should be used???

But don't give up hope just yet ;-) If you really want to change the caption of the username and password field you can always change it in your theme package.

answered