I want to make my application multi-languagas and achieves following conditions:
What the main steps will be followed to apply the previous conditions on my Oracle Apex application? Try to apply these steps if you have two languages en
and ar
.
Shared Components > Globalization
set the Application Primary Language
to English (en)
, then set Application Language Derived From
to Item Preference (use item containing preference)
.Shared Components > Translate > Define application languages
add Arabic (ar)
.Shared Components > Application Items
add new item FSP_LANGUAGE_PREFERENCE
.Shared Components > Lists > Navigation Bar
add the entries which are their attributes defined in the following table:Name | Target Type | Page | Icon | Parent Entry | Request | Set these items | With these values |
---|---|---|---|---|---|---|---|
Select Language | No Target | - | fa-globe | - | - | - | - |
English | Page in this application | &APP_PAGE_ID. | - | Select Language | LANG | FSP_LANGUAGE_PREFERENCE | en |
العربية | Page in this application | &APP_PAGE_ID. | - | Select Language | LANG | FSP_LANGUAGE_PREFERENCE | ar |
Shared Components > Application Processes
add SET_LANG
process, with the source code of PL/SQL language:BEGIN
APEX_UTIL.REDIRECT_URL(P_URL => '&APP_PAGE_ALIAS.' || '?SESSION=' || '&APP_SESSION.');
END;
then set its Condition Type
as Request = Expression 1
, where Expression 1
is LANG
.
Login
Page which its PAGE_ID
is 9999 add the following:Radio Group
page item with of name P9999_LANG
where the Page Action on Selection
is Submit Page
and the List of value is the following SQL query:SELECT
case
WHEN :FSP_LANGUAGE_PREFERENCE = 'en' then 'English'
WHEN :FSP_LANGUAGE_PREFERENCE = 'ar' then 'الإنجليزية'
end as d,
'en' as r
FROM DUAL
UNION ALL
SELECT
case
WHEN :FSP_LANGUAGE_PREFERENCE = 'en' then 'Arabic'
WHEN :FSP_LANGUAGE_PREFERENCE = 'ar' then 'العربية'
end as d,
'ar' as r
FROM DUAL
Before Header
Point, with the follwing PL/SQL code:DECLARE
BROWSER_LANG VARCHAR(2) := substr(NVL(owa_util.get_cgi_env('HTTP_ACCEPT_LANGUAGE'),'en'),1,2);
BEGIN
CASE
WHEN :FSP_LANGUAGE_PREFERENCE IS NULL AND :P9999_LANG IS NULL THEN
:P9999_LANG := BROWSER_LANG;
:FSP_LANGUAGE_PREFERENCE := BROWSER_LANG;
ELSE
NULL;
END CASE;
END;
Processing
Point and type Execute Code
:begin
:FSP_LANGUAGE_PREFERENCE := :P9999_LANG;
end;
After Processing
Point, and Behavior of Type Page or URL (Redirect)
and Target Page 9999
(redirect to itself). and set value of Item P9999_LANG
with value &P9999_LANG.
with server-side conditon of Type
Request = Valueand Value is
P9999_LANG`.