This page (revision-4) was last changed on 26-Nov-2021 10:22 by rforbes

This page was created on 26-Nov-2021 10:22 by rforbes

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Page revision history

Version Date Modified Size Author Changes ... Change note
4 26-Nov-2021 10:22 1 KB rforbes to previous
3 26-Nov-2021 10:22 1 KB rforbes to previous | to last
2 26-Nov-2021 10:22 1 KB rforbes to previous | to last
1 26-Nov-2021 10:22 2 KB rforbes to last

Page References

Incoming links Outgoing links

Version management

Difference between version and

At line 1 changed 14 lines
FUNCTION TRANSLATE (
P_TABLE IN VARCHAR2,
P_COLUMN IN VARCHAR2,
P_REF_ID IN VARCHAR2,
P_LANGUAGE in VARCHAR2 default 'FRE',
P_COUNTRY in VARCHAR2 default NULL,
P_ROLE in VARCHAR2 default NULL)
RETURN VARCHAR2 AS
v_mob_id number;
v_return varchar2(4000);
v_mla_id number;
v_mro_id number := 0;
v_dco_id number := 0;
BEGIN
!!Text and Code Translations
At line 16 changed 2 lines
/*
RForbes 20111013 Original Version
!Functionality:
This function retrieves text and code translation information as shown on [IMLA].
At line 19 changed 4 lines
P_TABLE is the TABLE_ALIAS of the object for which you are looking for the translation (e.g. DPD for position details)
P_COLUMN is the COLUMN_NAME of the object for which you are looking for the translation (e.g. POSITION_TITLE)
P_REF_ID is the ID on the table identified in P_TABLE that has the record you are looking for the translation
P_LANGUAGE optional is the language you want to translate to (if not provided, FREnch will be used)
!Parameters:
At line 24 changed one line
*/
|P_TABLE | Identifies the [TABLE_ALIAS] that you are translating data for
|P_COLUMN | Identifies the [COLUMN_NAME] that you are translating data for
|P_REF_ID | Identifies the record ID for the table indicated that contains the data to be translated
|P_LANGUAGE | ''Optional''. The [LANGUAGE_CODE] that you want to translate to. If not provided, 'FRE'nch will be used.
|P_COUNTRY | ''Optional''. The [COUNTRY_CODE] that you are tranlsating data for. If not provided, no country-specific translation is sought.
|P_ROLE | ''Optional''. The [ROLE_NAME] that you are translating data for. If not provided, no role-specific translation is sought.
At line 26 changed 47 lines
-- Find MLA_ID
-- 1. look for language + country combination
-- 2. look for language + NO Country
if P_COUNTRY is not NULL then
begin
select ID into v_DCO_ID
from p2k_cm_countries
where country_code = upper(trim(p_country));
exception
when others then
return '*NO COUNTRY '||sqlerrm(sqlcode);
end;
end if;
if P_ROLE is not NULL then
begin
select ID into v_MRO_ID
from p2k_am_roles
where role_name = upper(trim(p_role));
exception
when others then
return '*NO ROLE '||sqlerrm(sqlcode);
end;
end if;
begin
select ID into v_MLA_ID
from p2k_am_languages
where LANGUAGE_CODE = upper(trim(p_LANGUAGE))
and NVL(DCO_ID,0) = v_dco_id
and NVL(MRO_ID,0) = v_mro_id;
exception when others then
begin
select ID into v_MLA_ID
from p2k_am_languages
where LANGUAGE_CODE = upper(trim(p_LANGUAGE))
and NVL(DCO_ID,0) = v_dco_id;
exception when others then
begin
select ID into v_MLA_ID
from p2k_am_languages
where LANGUAGE_CODE = upper(trim(p_LANGUAGE));
exception when others then
return '*NO LANGUAGE '||sqlerrm(sqlcode);
end;
end;
end;
!Returns:
Varchar2
At line 74 changed 22 lines
begin
select ID into V_MOB_ID
from p2k_am_objects
where OBJECT_CODE = upper(trim(p_TABLE))
and ATTRIBUTE_CODE = upper(trim(p_column));
exception when others then
return NULL;
end;
begin
select TRANSLATED_TEXT into V_RETURN
from p2k_am_translations
where MOB_ID = v_mob_id
and REFERENCE_ID = p_ref_id
and MLA_ID = v_mla_id;
exception when others then
return NULL;
end;
RETURN V_RETURN;
END; -- TRANSLATE;
If no translation is found, NULL is returned.
!Errors:
* {{*NO COUNTRY}} When the country code provided is invalid
* {{*NO ROLE}} When the role name provided is invalid
* {{*NO LANGUAGE}} When the language code provided is invalid, or there is some other error retrieving the set of languages
!Example:
{{P2K_PU.TRANSLATE('DPD','POSITION_TITLE',~)}}
Will return the translation for the position title, as seen on IDPS, for the French language, for the position detail identified by the ID placed in ~. If there is no translation, NULL is returned
{{NVL(P2K_PU.TRANSLATE('DPD','POSITION_TITLE',~),POSITION_TITLE)}}
Will return the translation as above, but if there is no translation, will return the position title. This would be useful in reports.
----
![Notes|Edit:Internal.P2K_PU.TRANSLATE]
[{InsertPage page='Internal.P2K_PU.TRANSLATE' default='Click to create a new notes page'}]