Skip to content

Commit

Permalink
docs(i18n): update vuetify3 example
Browse files Browse the repository at this point in the history
  • Loading branch information
jourdain committed Feb 4, 2024
1 parent 0b3ca3b commit af29e78
Showing 1 changed file with 23 additions and 30 deletions.
53 changes: 23 additions & 30 deletions examples/validation/core/32_i18n_vue3.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,56 +15,49 @@

LANG = {
"en": {
"$vuetify": {
"title": "Hello world",
"selector": "Language selection",
"stepper": {
"next": "Next",
"prev": "Previous",
},
},
"fr": {
"$vuetify": {
"title": "Bonjour tout le monde",
"selector": "Langue selection",
"stepper": {
"next": "Suivant(me)",
"prev": "Precedent(me)",
},
},
}

server.enable_module(
dict(
vue_use=[
(
"trame_vuetify",
{
"locale": {
"locale": "en",
"fallback": "en",
"messages": LANG,
}
},
)
]
)
)
CONFIG = {
"locale": {
"locale": "en",
"fallback": "en",
"messages": LANG,
}
}


# -----------------------------------------------------------------------------
# UI setup
# -----------------------------------------------------------------------------

with SinglePageLayout(server) as layout:
with SinglePageLayout(server, vuetify_config=CONFIG) as layout:
# Toolbar
with layout.toolbar as toolbar:
vuetify3.VSpacer()
toolbar.add_child("{{ $vuetify.locale.t('title') }}")
vuetify3.VSpacer()
toolbar.add_child("{{ $vuetify.lang.current }}")
vuetify3.VSpacer()
vuetify3.VSelect(
label=("$vuetify.locale.t('selector')",),
v_model=("$vuetify3.locale.current",),
v_model=("$vuetify.locale.current",),
items=("langs", ["en", "fr"]),
density="compact",
)

layout.content.add_child("i18n test {{ Object.keys($vuetify.locale) }}")
with layout.content:
with vuetify3.VStepper(
items=("steps", ["Step 1", "Step 2", "Step 3"]),
):
for i in range(3):
with vuetify3.Template(raw_attrs=[f"v-slot:item.{i+1}"]):
vuetify3.VCardTitle(title=f"Step {i+1}")


# -----------------------------------------------------------------------------
Expand Down

0 comments on commit af29e78

Please sign in to comment.