2023-02-28 08:29:30 +00:00
|
|
|
<template>
|
|
|
|
<DocSectionText v-bind="$attrs">
|
|
|
|
<p>Second parameter of the use function can be used to initiate the locale during PrimeVue installation.</p>
|
|
|
|
|
2023-02-28 17:40:48 +00:00
|
|
|
<DocSectionCode :code="code1" hideToggleCode importCode hideCodeSandbox hideStackBlitz />
|
2023-02-28 08:29:30 +00:00
|
|
|
|
|
|
|
<p>The locale configuration is reactive so that any changes are instantly reflected in the UI. Suppose you are doing a multi language application and need to change the language dynamically.</p>
|
|
|
|
|
2023-02-28 17:40:48 +00:00
|
|
|
<DocSectionCode :code="code2" hideToggleCode importCode hideCodeSandbox hideStackBlitz />
|
2023-02-28 08:29:30 +00:00
|
|
|
</DocSectionText>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
code1: {
|
2023-09-22 12:54:14 +00:00
|
|
|
basic: `
|
|
|
|
app.use(PrimeVue, {
|
2023-02-28 08:29:30 +00:00
|
|
|
locale: {
|
|
|
|
accept: 'Aceptar',
|
|
|
|
reject: 'Rechazar',
|
|
|
|
//...
|
|
|
|
}
|
2023-09-22 12:54:14 +00:00
|
|
|
});
|
|
|
|
`
|
2023-02-28 08:29:30 +00:00
|
|
|
},
|
|
|
|
code2: {
|
2023-09-22 12:54:14 +00:00
|
|
|
basic: `
|
|
|
|
import { defineComponent, onMounted } from "vue";
|
2023-02-28 08:29:30 +00:00
|
|
|
import { usePrimeVue } from "primevue/config";
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
setup() {
|
|
|
|
const changeToSpanish = () => {
|
|
|
|
const primevue = usePrimeVue();
|
|
|
|
primevue.config.locale.accept = "Aceptar";
|
|
|
|
primevue.config.locale.reject = "Rechazar";
|
|
|
|
}
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
changeToSpanish();
|
|
|
|
})
|
|
|
|
}
|
2023-09-22 12:54:14 +00:00
|
|
|
});
|
|
|
|
`
|
2023-02-28 08:29:30 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|