Skip to content

Latest commit

 

History

History
263 lines (169 loc) · 4.63 KB

tk_jtl_plugin.md

File metadata and controls

263 lines (169 loc) · 4.63 KB

TK_JTL_PLUGIN

Constants

Name Code Description
gc_scope_prefix `gc_scope_prefix constant VARCHAR2(31) := lower($$PLSQL_UNIT)

RENDER Function

Render the item as a hidden and display combo.
Original concept for using JSON columns to store language: Bruno Mailloux

Syntax

function render(
    p_item                in apex_plugin.t_page_item
  , p_plugin              in apex_plugin.t_plugin
  , p_value               in gt_string
  , p_is_readonly         in boolean
  , p_is_printer_friendly in boolean
 )
return apex_plugin.t_page_item_render_result

Parameters

Name Description
p_item Standard plugin parameters

VALIDATE Function

Perform validations on the submitted data:

  • Ensure the data is JSON format
  • Ensure the JSON format is of the expected form

Syntax

function validate (
   p_item   in apex_plugin.t_page_item
 , p_plugin in apex_plugin.t_plugin
 , p_value  in varchar2
)
return apex_plugin.t_page_item_validation_result

Parameters

Name Description
``

OUTPUT_LANG_TAB Function

Convert a tab_lang_type array to JSON format of the form:

 [
  {"l":"en","tl":"Name"},
  {"l":"fr","tl":"Nom - Français"},
  {"l":"es","tl":"Nombre - Español"}
 ]

Syntax

function output_lang_tab(p_tab in out nocopy tab_lang_type)
  return clob

Parameters

Name Description
p_tab tab_lang_type
return clob JSON object

GET_TL_VALUE Function

Given a JSON string (p_value) return the value of the language defined by code (p_l)

Syntax

function get_tl_value(
    p_value in varchar2
  , p_l     in lang_code default apex_application.g_flow_language
)
return varchar2

Parameters

Name Description
p_value JSON MLS structure
p_l language code (ie. 'es', 'fr', ...)
return New value as varchar2

Example

tk_jtl_plugin.get_tl_value(:P3_NAME_JTL, :SESSION_LANG) is not null

SET_TL Function

Given a JSON string (p_value) update the corresponding language code (p_l)
with a new translation (p_tl)

Syntax

function set_tl(
    p_value in varchar2
  , p_l     in lang_code default apex_application.g_flow_language
  , p_tl    in varchar2
)
return varchar2

Parameters

Name Description
p_value JSON MLS structure
p_l language code (ie. 'es', 'fr', ...)
p_tl New translated value
return New JSON MSL value

Example

update px_projects
   set name_jtl = tk_jtl_plugin.set_tl(name_jtl, 'en', 'New value')
where id = 21;

ADD_TL Function

Given a JSON string (p_value) add a new language as defined by code (p_l)
and translation (p_tl) at the end of the JSON MLS structure

Syntax

function add_tl(
    p_value in varchar2
  , p_l     in lang_code default apex_application.g_flow_language
  , p_tl    in varchar2
)
return varchar2

Parameters

Name Description
p_value JSON MLS structure
p_l language code (ie. 'es', 'fr', ...)
p_tl New translated value
return New JSON MSL value

Example

update px_projects
   set name_jtl = tk_jtl_plugin.add_tl(name_jtl, 'en', 'New value')
where id = 21;

REMOVE_TL Function

Given a JSON MLS string (p_value) remove a language as defined by code (p_l)

Syntax

function remove_tl(
    p_value in varchar2
  , p_l     in lang_code default apex_application.g_flow_language
)
return varchar2

Parameters

Name Description
p_value JSON MLS structure
p_l language code (ie. 'es', 'fr', ...)
return New JSON MSL value

Example

update px_projects
   set name_jtl = tk_jtl_plugin.remove_tl(name_jtl, 'en', 'New value')
where id = 21;