[SOLVED] How can I change the language or text of Network Errors?

Answered Closed
0
0

 

How can I change the text of for example…..

The Network is down, Retry?

 

 

Thanks!

  • You must to post comments
Best Answer
0
0

Hi Michael,

The low level errors are not localized automatically. You can plugin your javascript error handlers like this, in Default.html add this:

 <script>
   Wisej.onNetworkError = function (type, error) {
      alert(type + ": " + error);
   }
 </script>

 

The default error handler now is this:

/**
 * onNetworkError
 *
 * Called when the http or websocket connection fails.
 * This call can only be assigned, it"s not an event listener.
 *
 * Usage:
 *
 * Wisej.onNetworkError = function(type, error){ alert(error); };
 *
 * @param error {String} the error type: "connection", "network", "timeout".
 * @param message {String} the error message.
 */
Wisej.onNetworkError = Wisej.onNetworkError || function (type, error) {

   // already showing a message box?
   if (Wisej.__showingErrorMessage)
     return;

   Wisej.__showingErrorMessage = true;

   var message = error;
   var buttons = { "close": "Close" };

   // TODO: Localize the texts below.

   switch (type) {
     case "timeout":
      message = "The connection timed out. The server may be busy or unreachable. Retry?";
      buttons = { "retry": "Retry", "close": "Close" };
      break;

    case "connection":
      message = "Failed to connect to the server.";
      buttons = { "close": "Close" };
      break;

    case "network":
      message = "The network is down. Retry?";
      buttons = { "retry": "Retry", "close": "Close" };
      break;
  }

  Wisej.Platform.showMessage("Network Error", message, "error", buttons, function (button) {

    Wisej.__showingErrorMessage = false;

    if (button == "retry") {
      location.reload();
    }
  });
}

HTH

Best,

Luca

 

  • You must to post comments
0
0

 

 

I suggest for the next build, that this field’s can be changed.

Is better idea a free text… we can personalize the App.

  • You must to post comments
Showing 2 results