How can i manage the idiom and notation inside wave components? #2287
-
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 3 replies
-
image below |
Beta Was this translation helpful? Give feedback.
-
cc @marek-mihok |
Beta Was this translation helpful? Give feedback.
-
Hi @junioraze,
As discussed here, there is no option to do it for components with hardcoded strings. You can create a new feature request.
Could you please provide me with reproducible example? This is as close as I could get: from h2o_wave import main, app, Q, ui, data
@app('/demo')
async def serve(q: Q):
q.page['example'] = ui.plot_card(
box='1 1 4 5',
title='Interval',
data=data('year length', 5, rows=[
('1991', 1/100),
('1995', 1/8),
('2002', 1/16),
('2003', 1/32),
('2010', 1/50),
]),
plot=ui.plot([ui.mark(type='interval',
x='=year',
y_min=0,
y='={{intl length style="unit" unit="mile" type="length" notation="compact" }}'
)])
)
await q.page.save() And what does |
Beta Was this translation helpful? Give feedback.
-
@junioraze when I run your code, I have the output you expect: The reason why it is showing mi/mil instead of K,M,B is the language of your browser. Our plot implementation uses This is what happens when I override the browser default with Screen.Recording.2024-03-21.at.12.16.38.mov@mturoci wouldn't make sense to prioritise the language of the website by obtaining html export const intl = createIntl({
locale: document.documentElement.getAttribute("lang") || navigator.language, |
Beta Was this translation helpful? Give feedback.
-
Wouldn't that always return |
Beta Was this translation helpful? Give feedback.
-
By default yes, but it can be configured by custom script which would help to resolve this issue: q.page['meta'].script = ui.inline_script('document.documentElement.setAttribute("lang", "pt-BR");') But this is not ideal solution in my opinion. What is the meaning of using I think the better idea would be to make Wave index.html |
Beta Was this translation helpful? Give feedback.
@junioraze when I run your code, I have the output you expect:
The reason why it is showing mi/mil instead of K,M,B is the language of your browser. Our plot implementation uses
navigator.language
prop for localisation of number format which usually uses language of the browser.This is what happens when I override the browser default with
pt-BR
locale:Screen.Recording.2024-03-21.at.12.16.38.mov
@mturoci wouldn't make sense to prioritise the language of the website by obtaining html
lang
prop here? Something like this?