Translations cleanup + item fix

This commit is contained in:
Jan Kvetina 2022-02-22 07:58:39 +01:00
parent 76b1169c70
commit b0a4d4dd12
4 changed files with 11 additions and 39 deletions

View File

@ -1351,7 +1351,7 @@ CREATE OR REPLACE PACKAGE BODY app AS
SELECT 'Y' INTO is_valid
FROM apex_application_page_items p
WHERE p.application_id = v_app_id
AND p.page_id IN (0, v_page_id)
AND p.page_id IN (0, v_page_id, 947)
AND p.item_name = v_item_name;
EXCEPTION
WHEN NO_DATA_FOUND THEN

View File

@ -274,52 +274,24 @@ CREATE OR REPLACE PACKAGE BODY app_actions AS
AS
v_footer VARCHAR2(4000);
BEGIN
-- show untranslated items to developers
IF app.is_developer() THEN
FOR c IN (
SELECT
i.item_name,
app.get_translated_item(i.item_name) AS item_value
FROM apex_application_page_items i
WHERE i.application_id = app.get_app_id()
AND i.page_id = app.get_page_id()
AND i.item_name LIKE 'T%'
--
AND app.get_translated_item(i.item_name) = '{' || i.item_name || '}'
) LOOP
app.set_item (
in_name => c.item_name,
in_value => c.item_value,
in_raise => FALSE
);
--
app.log_warning('MISSING_TRANSLATION', c.item_name);
END LOOP;
END IF;
-- load translations
FOR c IN (
SELECT
NVL(t.page_item_name, t.app_item_name) AS item_name
t.item_name,
app.get_translated_item(t.item_name) AS item_value
FROM translations_current t
WHERE NVL(t.page_item_name, t.app_item_name) IS NOT NULL
--
-- @TODO: T_GRID* MISSING -> THEN MOVE TO MESSAGES
--
-- @TODO: MESSAGES matching APP ITEMS prepare too
--
) LOOP
app.set_item (
in_name => c.item_name,
in_value => app.get_translated_item(c.item_name),
in_value => COALESCE(c.item_value, CASE WHEN app.is_developer_y() = 'Y' THEN '${' || c.item_name || '}' END),
in_raise => FALSE
);
IF app.is_debug_on() THEN
app.log_debug('SET_TRANSLATION', c.item_name, app.get_translated_item(c.item_name));
app.log_debug('SET_TRANSLATION', c.item_name, c.item_value);
END IF;
END LOOP;
-- show page comment into footer
-- show page comment in footer
BEGIN
SELECT p.page_comment INTO v_footer
FROM apex_application_pages p

View File

@ -10,7 +10,7 @@ SELECT
t.page_id,
t.item_name,
--
NULL AS item_type, -- @TODO: fix later
REGEXP_SUBSTR(t.item_name, '^[^_]+[_]([^_]+)', 1, 1, NULL, 1) AS item_type,
--
CASE WHEN i.item_name IS NOT NULL THEN 'Y' END AS is_page_item,
CASE WHEN a.item_name IS NOT NULL THEN 'Y' END AS is_app_item,
@ -25,8 +25,8 @@ JOIN x
ON x.app_id = t.app_id
LEFT JOIN apex_application_page_items i
ON i.application_id = t.app_id
AND i.page_id = t.page_id
AND i.item_name = REGEXP_REPLACE(t.item_name, '^([A-Z]+)[_]', '\1' || t.page_id || '_')
AND i.page_id IN (947, t.page_id)
AND i.item_name = t.item_name
LEFT JOIN apex_application_items a
ON a.application_id = t.app_id
AND a.item_name = t.item_name;

View File

@ -17,8 +17,8 @@ JOIN x
AND (x.page_id = t.page_id OR t.page_id = 0)
LEFT JOIN apex_application_page_items i
ON i.application_id = t.app_id
AND i.page_id = t.page_id
AND i.item_name = REGEXP_REPLACE(t.item_name, '^([A-Z]+)[_]', '\1' || t.page_id || '_')
AND i.page_id IN (947, t.page_id)
AND i.item_name = t.item_name
LEFT JOIN apex_application_items a
ON a.application_id = t.app_id
AND a.item_name = t.item_name;