Replies: 1 comment 1 reply
-
Hello and welcome to SQLPage ! A pull request for this would be welcome. The most important would be to document it clearly with examples. Alternatively, you can also achieve programmatic column labels using the dynamic component. Here is an example of how to use it for translations: select 'table' as component;
select
'dynamic' AS component,
json_group_array(json_object(
(select target from translations where lang=$lang and source_en='name'), name,
(select target from translations where lang=$lang and source_en='description'), description,
(select target from translations where lang=$lang and source_en='price'), price
)) AS properties
FROM products; Screencast.From.2025-07-24.21-05-10.mp4you can avoid the repetitions by creation an sql function like CREATE OR REPLACE FUNCTION t(lang_code TEXT, source_text TEXT)
RETURNS TEXT AS $$
SELECT target FROM translations WHERE lang = lang_code AND source_en = source_text;
$$ LANGUAGE SQL IMMUTABLE; this example uses the postgresql syntax |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
To enable a small localization system in table component, can we add a top-level parameter to define column labels? (e.g. «col_labels»)
In
table.handlebars
, update :line 48
<button class="table-sort sort d-inline" data-sort="{{@key}}">{{default (lookup ../../col_labels @index) @key}}</button>
line 50
{{default (lookup ../../col_labels @index) @key}}
Beta Was this translation helpful? Give feedback.
All reactions