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: {
|
|
|
|
basic: `
|
|
|
|
app.use(PrimeVue, {
|
|
|
|
locale: {
|
|
|
|
accept: 'Aceptar',
|
|
|
|
reject: 'Rechazar',
|
|
|
|
//...
|
|
|
|
}
|
|
|
|
});`
|
|
|
|
},
|
|
|
|
code2: {
|
|
|
|
basic: `
|
|
|
|
import { defineComponent, onMounted } from "vue";
|
|
|
|
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();
|
|
|
|
})
|
|
|
|
}
|
|
|
|
});`
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|