How to translate my application in Oracle Apex 5Share on LinkedIn
Apex translation concept
Oracle APEX handles translations as a copy of the main Application. That means that, for every language your Application supports, or in other words is translated to, APEX internally creates a “Shadow Application”. These Shadow Applications aren’t listed in Application Builder, but they are exact copies of the main Application.
When you run your Application in a translated language the Shadow Applications code is executed.When you create your translation Applications, you will not see them in the Application Builder but they exist in the APEX Dictionary Tables. They are hidden in the Application Builder so that you cannot edit them directly.
When you run your Application in a translated language the Shadow Applications code is executed.When you create your translation Applications, you will not see them in the Application Builder but they exist in the APEX Dictionary Tables. They are hidden in the Application Builder so that you cannot edit them directly.
All code changes are done in the Main Application which are then rolled out to the translated Shadow Applications with the “Seed” and “Publish” Operations. So whenever you need to roll out code-changes you need to Seed and Publish all Translations.
This is it. The main step in understanding Translations in Oracle APEX is to realize that there is always a copy of the full Application (every page, every process, and every single line of code) for each Language you want to support.
Translating the application
If you want to use the standard translation options in Oracle Apex 5, you must map the primary and target languages, seed and export the translation file, translate the text, import the translation file, and publish the translated application.
In Apex go to Application builder and click on shared Components.
In the Globalization section, click Translate Application.
1. Define your application languages
On this page you can define all the translation languages your application will use.
To add a new language just click on the “create” button. On the next page you have to give un unique id for your translation application and the languages himself.
After you fill the fields press the create button. Now a new translated application is created.
2. Seed translation text
You need to seed your application to make translation possible. When you seed a translation application apex will copy all the translatable text to your translation application in un text repository.
Check the applications witch have to be seeded and press de button “seed”.
note: when you change something afterwards in your primary application you have to seed again.
3. Download translation files
Once the translatable text is seeded, you can begin the process of translating the text strings.
You can now download the XLIFF translation file for the whole application or just for one application.
Click on Export XLIFF File for Application or Export XLIFF File for Page.
Open the XLIFF file that was downloaded using a text editing tool and translate the elements by replacing the target with an equivalent translated phrase.
Note: Navigate to C:\Downloads folder and look for the file with the .xlf extension.
4. Apply translation file
After you have populated the file with your translations, the XLIFF file has to be uploaded back into the translation repository. To do this, in the Translate Application page, click apply XLIFF translation files
Press the button “Upload Files” chose one or more files and upload them
Note: The files must be encoded in UTF-8.
5. Publish translated application
Last step but a very important one, is to publish your translated application.
Check your translated application and press on “Publish”.
The application will be successfully published and is ready to be used.
The application will be successfully published and is ready to be used.
Specifying the language in you application
In APEX we have different ways of setting the language of our applications.
Go in the Shared Components and edit the Globalization Attributes.
Go in the Shared Components and edit the Globalization Attributes.
Specifies how Application Express derives the translated application language. The application primary language can be static, derived from the Web browser language, or determined from a user preference or item. Available options include:
- No NLS (Application not translated) - Select this option if the application will not be translated.
- Application Primary Language - Determines the translated application language based on the Application Primary Language attribute.
- Browser (use browser language preference) - Determines the translated application language based on the user's Web browser language.
- Application Preference (use FSP_LANGUAGE_PREFERENCE) - Determines the translated application language based on a value defined using the APEX_UTIL.SET_PREFERENCE API. This option can be used to maintain a user's language preference across multiple logins.
- Item Preference (use item containing preference) - Determines the translated application language based on an application-level item called FSP_LANGUAGE_PREFERENCE. Using this option requires Application Express to determine the appropriate language preference every time the user logs in.
- Session - Determines the translated application language from the session setting. The Application Express session language can be set via either the APEX_UTIL.SET_SESSION_LANG procedure or via the P_LANG parameter in the URL.
Examples:
- URL: http://.../apex/f?p=990000:1:0&P_LANG=fr-ca
- Session: APEX_UTIL.SET_SESSION_LANG(‘FR-CA’)
Translating messages used in the application or pl/sql
If your application includes PL/SQL regions or PL/SQL processes or calls PL/SQL package, procedures, or functions, you may need to translate generated HTML. First, you define each message on the Translatable Messages page. Second, you use the APEX_LANG.MESSAGE API to translate the messages from PL/SQL stored procedures, functions, triggers, or packaged procedures and functions. You create translatable messages on the Translate Messages page.
Go to shared components and under the Globalization section, click Text Messages..
Press the button “Create text message”
Enter a unique name for the message, chose your language and translation text.
Note: you can easy use substitution variables by using %0 or %1 till %9
Note: you can easy use substitution variables by using %0 or %1 till %9
Now you message can be called from pl/sql packages, procedures and functions.
Example:
begin htp.p(apex_lang.message('GREETING_MESSAGE', V('APP_USER')));end;
Thank you so much for the post you do. I like your post and all you share with us is up to date and quite informative, i would like to bookmark the page so i can come here again to read you, as you have done a wonderful job.
ReplyDeleteCertified Translation company
Glad you like and thank you sharing!
ReplyDelete