The m-Power Translate feature allows developers to configure an unlimited number of languages to generated applications. Each time an application is compiled, m-Power will automatically create and translate additional presentation layers for each language that has been configured. Developers will have the opportunity to tweak the default translation tables for full customization. End-user integration is seamless as the user's browser automatically detects which presentation layer should be displayed.
Note: m-Power Translate supports both the Microsoft and Google translate API. However, as of this writing Google translate does not have a free option. As such, this document illustrates the Microsoft API. If you are interested in using Google translate, please contact mrc support.
- Please visit this site to obtain a translation key.
Note: Microsoft requires that you create an account first, prior to signing up for a translation key. Once you have created your account, click on the "My Account" option", then click "Developers", then "Register". Finally, enter a Client ID, Name, Client secret, and Redirect URI (Use: https://localhost). (You will need to note both the client ID and secret for use later.)
- Lastly, click "My Account," then click "Account Keys". Copy the key as shown on this screen, as you will need it in the next step.
- Once this code is obtained, copy it and paste it into the \m-power\proddata\languages\language-config.properties file as the microsoft-appid (Ignore the microsoft-appid note to only use if the key was generated prior to March 31, 2012). Be sure that "translate-service" is set to "microsoft", and that the microsoft-appid, microsoft-client-id, and microsoft-client-secret are all filled out with the appropriate values:
microsoft-client-id=ENTER YOUR CLIENT ID HERE
microsoft-client-secret=ENTER YOUR CLIENT SECRET ID HERE
## microsoft-appid (Note: Should ONLY be used with API Keys generated prior to March 31, 2012)
microsoft-appid=ENTER YOUR MICROSOFT ACCOUNT KEY HERE
Note: If language-config.properties does not exist, copy language-config-dist.properties to language-config.properties.
- After saving the file, open m-Power and sign-in. Navigate to the "Admin Menu", then under "System Management", click the "Languages" button."
- By default, m-Power supports the English language. To add more languages, click on the "Languages" icon referenced above. From here click the "Add" icon.
- Check the interface documentation to see a full list of supported languages. Enter the Language Name as it will be referenced within m-Power, then add the 2 digit language code. If the code is not valid, the developer will be notified.Note: When a language is added, the dictionary is analyzed to add the text referenced within the Dictionary level (Table descriptions, Field descriptions, Application descriptions, etc.) into a language .xml file located in the \m-power\proddata\languages directory. This file is only used in development and is not needed in the production instance of m-Power. m-Power will automatically convert any phrases where the conversion is known. The three files are app_messages_xx.properties, app_labels_xx.properties, and app_constants_xx.properties (Where xx is the 2-digit language code). These files are global and contain translations for all data dictionaries.
- The above screenshot is of the Spanish language being registered to the current data dictionary.
- Developers are now brought to the "Work with Languages" screen, which allows one to remove languages, modify Labels, Messages, or Constants. Developers can also convert all presentation layers within a Data Dictionary for a specific language.
- Protected Text — This option allows you to add specific words or phrases to your language file that you never want translated. To remove an option from the listing, simply delete the applicable protected text and click "Accept."
- Labels — This list was automatically populated with the table, field and application descriptions found in this data dictionary. If m-Power Translate was not able to find a valid translation, the English description will also be stored in the converted language column. Developers have the option to override this with the proper translation manually. Once completed, the developer must click the "Accept" button. Alternatively, developers can click the "Add" icon to add their own Label descriptions when necessary.
- Messages — Common error messages that an end-user might experience have also been translated. Once again, developers have the option to modify these default translations or add new ones, as necessary.
- Constants — This list of constant text is a representation of common text found in our m-Power templates (button text, month/day text, standard relationships, etc.). Developers can once again modify or add additional constants where deemed appropriate.
Note: The above three options each contain a "Status" feature. When new phrases are added to the translation file, they are marked as a Status of "New". Once you have confirmed that they are correct, you have the option of marking them to "Correct". m-Power does not utilize these Status flags within our translation rules, they are simply provided to help you organize your translation definitions.
- Dictionary to Language — This option gives the developer the ability to convert all existing English applications and convert them to the language of their choosing. Not only will this option create new presentation layers for all existing applications, this feature will create common files (such as filter relationship help, header, footer, and Sign-on Screens). Note:This option will convert all presentation layers to the language selected. If any presentation layers exist in this language, they will be overwritten with this option (The original English presentation layers will be unaffected).
Note: If this command has already been run and one wishes to convert a single application, please consider doing this via the Application Menu screen. Note: This feature will not recompile existing Java code, only create additional presentation layers for each language selected to convert.
- As soon as m-Power has been configured for a second language, the "Build and Customize" panel within Application Menu screen will look like this:
The option circled above allows the m-Power developer to translate the presentation layer one application at a time. The developer can then translate individual files, including options for mobile/tablet devices, as well as any language that has been configured.
Based on the screen shot above, note that a developer has individual control to overwrite any combination of PC, Mobile, Tablet output against Spanish, Chinese, or German.
Note: This feature will not recompile existing Java code, only replace existing presentation layer(s).
- Once compiled, developers will have a presentation layer for each language selected as well as each output the developer has configured. Use the "Page" dropdown in m-Painter to navigate between each presentation layer in m-Painter.
Note: Be sure to save before navigating to a different presentation layer as failing to do so will result in changes not being saved.
- True date fields will automatically be converted to conform to the locale format. This means in the Spanish view, the date would be printed as DD/MM/YY.
- Numerical data will also be converted to fit the local format. For example, 1 million in the Spanish locale would be printed as 1.000.000,00 based on locale rules. To change the local format rules, edit this file \m-power\proddata\languages\language-config.properties file.
- Users wishing to change their presentation layer (to display a different language or output-type) can use the "Options" button located in the header. This button will display an interface that allows them to navigate between any supported languages (Please see the notes section below on instructions for configuring this feature).
- Alternatively, users can add "?locale=xx" to their URL to manually change to a different language. Users wanting to change back to English can simply add "?locale=en" to revert back to the default language.
- Upon compile, a unique presentation layer file will be created for each language and output type necessary. For example, if one would like to support Mobile, PC, and Tablet for Spanish, English, and Chinese, m-Power would create 9 presentation layers. Each file can be maintained via m-Painter individually of each other.
- By default the "Options" interface does not allow users to change their language. If this feature is desired, please install this by adding the following code to the \mrcjava\WEB-INF\classes\DATADICT\application_options.html. Add the following code directly after the final
<table border="0" cellspacing="1" cellpadding="1" width="200">
<td style="PADDING-LEFT: 10px; PADDING-RIGHT: 10px" align="left">
<font size="2"><strong>Select Language:</strong></font>
<br /><br />
Note: The application_options.html file exists for each language as well as each output type.
- Only text that resides on the presentation layer will be translated. This means that m-Power Translate will not convert any run-time data that resides in your data tables.
- If you choose to convert multiple data dictionaries with the same language, you will notice your list of labels, messages, and constants will contain keywords from all dictionaries. This was done by design as it frees you from having to recreate the same custom translations within each data dictionary.
- Your m-Power server will need access to the internet to run your translation conversion. If this is not possible with your current setup, please reconfigure your server temporarily so it can access the internet during the Data Dictionary conversion process. Once completed, the server can be moved back internally. Every future dictionary conversion will once again require internet access.