App languages

DecSoft App Builder want to helps to translate your app into various languages, and, for that the app languages manager is provided, as well other stuff, like some useful language related app methods. The app languages manager allows to add one or more languages to the app, in addition to the language in which you design it, so we can change to one of the available languages at runtime.

At designtime

You can prepare your app translations at designtime by using the app languages manager. You can add a new language, by specifying a language code and a language name. These must be uniques in the app, so we can refer to a specific language without problems.

Once you add a new language in the app languages manager, you can see the all the existing app views, app dialogs and app frames. Just select one view, dialog or frame in order to show their controls, and, finally, select one of the available controls, in order to show their properties, ready to be translated.

The app languages manager show to you the original controls properties, so you can see what you must translate at any moment. It's important to note that what you translate is a piece of JavaScript code, so, for example, strings must be quoted. Just remember that what you see in the original piece of code and therefore what the translated piece of code must be is a piece of JavaScript.

Basically that's all. You can iterate over the app views, dialogs and frames, their controls and translatable properties, translate it, and, TA-DA! You can then show your app to the users in any of the availables languages.

Use the app languages manager is quite easy, as you can see in the below animated GIF image.

Resources and Sidebar

In addition to the app interface (app views, dialogs, frames, controls), it's also possible to translate the optional sidebar and the app resources. You can do it by using the app languages manager, as you can see below:

At runtime

DecSoft App Builder prepares the right stuff in order to made available all the translated languages at runtime. Basically, what you must to do is to call the translateView() method, in order to translate the current app view, dialog, and, of course, the possible used app frames, as well all their contained controls.

Before you call to the translateView() method, you can set the "app.language" to one of the available languages codes, so the method translate the current app view or dialog in the desired language. If the code language do not exists, the method leave the app equals, or translate it to the default app language.

There is other languages related methods that you can find useful too: getLanguages() method, getLanguagesNames() method, getLanguagesCodes() method, getLanguageCodeFromName() method and the getLanguageNameFromCode() method.

Default language

When you start a new app in DecSoft App Builder, the Language property is set to "en", and the LanguageName property is set to "English". You can of course change these language code and name to another, for example, "es" and "Español".

The point is that you no need to translate the app into the language in which you are designing it. For example, when you place a Push button control in an app view, and, you set his "text" property to "Click here", you no need to do anything more.

When, at runtime, you translate the app view into the default language (comming back from another language that has been previously used), the "Click here" property become again show, automatically, without the need to prepare a specific language for it.

There is a Languages sample app included with the installation of DecSoft App Builder. Take a look to see the app resources in action!