The goal is to provide a simple way to translate your application at runtime.



IMPORTANT:


This feature is functional but under improvement.

With your help, testing on your project, we will be able to mature and put into production.

It's a very complex topic.

I can't guarantee it will be self-sufficient, but I'm trying to make it as functional as possible so that you don't have an additional cost with other components.



How to use


In the UniFormReady( for forms ) and uniFrameReady( for frames ) event add the function:


  rc_Translate( Self, nil , '' , mm.CONFIG_LANGUAGE );


See examples in "frmLogin", "mainform", "frmBaseCad" ...



The function will detect objects that have been 'pointed' as "translatable", that is, each object may have in its "hint" property the indication that it can be translated, so RadCORE filters the properties that are "texts"( capition , text, empty text etc ).


Ex: frmLogin


1. See the "hint" of the "labWelcome" component, it contains: [[translate:]].

This warns you that the CAPTION property can be translated.


2. See the "hint" of the "edUserName" component, it contains: [[translate:except-text]].

This warns that the TEXT property cannot be translated. That's because it receives what the user types, so it shouldn't be translated.


RadCORE will add the respective form in the translation folders:



After accessing the RadCORE main menu, access the settings to manipulate the objects and their translations:





By clicking on the combobox on the side, you select which language you want to use by default in the application.


Clicking on EDIT will make the translation settings.



Translating




In the "form list" combobox select each form that you have added the "rc_translate" function and added the "[[translate:]]" to your translatable objects.


Then the list of properties (grouped) and their objects are displayed.


Click on the "CONTENT" column and its respective content will be displayed in the MEMO at the bottom of the screen.


Add the translation and click "SAVE."


Repeat the process with each item with each defined language.



Defining the languages






I'm trying to follow the unigui pattern.


ARRAY_LANGUAGES holds the current list of supported languages.

ARRAY_LANGUAGES_FLAGS stores its abbreviation.


When selecting a language ( ARRAY_LANGUAGES ) the SERVERMODULE is changed ( ExtLOCALE ).


Adjust according to your need.



Defining MESSAGES / MENUS


When selecting a language, the application is restarted and the control "globals" are referenced in the rc_ConfigTranslateMessages function.



Read this function to create new usage variables in your application.


> Some specific screens may receive the same translation definition pattern, but with local variables.

> The choice to use GLOBALS was to give more performance and avoid loading external files.


Examples of use:


RadCORE brings some examples where we can leave the MAIN MENU options translatable.



Main.pas


mm.MNU_OTHERS_OPEN_TICKET


This way the string comparison will be done correctly regardless of the language. (see below):





DM_RC


mm.MSG_CONFIRM_DELETE




There is still a lot to do and I hope everyone's collaboration, because I use google translator and the translation is not always faithful.


I know there are many languages and I couldn't adapt them all in this version, but I demonstrated how simple it is to add new ones.



IMPORTANTE:


In the "mkm_translate" unit there are 2 points where the "MemIni" is updated. Read the comment above.

Created with the Personal Edition of HelpNDoc: Easily create CHM Help documents