@@ -129,17 +129,6 @@ export default {
date14: null,
dates1: null,
dates2: null,
- es: {
- firstDayOfWeek: 1,
- dayNames: [ "Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado" ],
- dayNamesShort: [ "Dom","Lun","Mar","Mié","Jue","Vie","Sáb" ],
- dayNamesMin: [ "D","L","M","X","J","V","S" ],
- monthNames: [ "Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre" ],
- monthNamesShort: [ "Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic" ],
- today: 'Hoy',
- clear: 'Borrar',
- weekHeader: 'Sm'
- },
minDate: null,
maxDate: null,
invalidDates: null
diff --git a/src/views/calendar/CalendarDoc.vue b/src/views/calendar/CalendarDoc.vue
index 6d56b3a17..d51a107e3 100755
--- a/src/views/calendar/CalendarDoc.vue
+++ b/src/views/calendar/CalendarDoc.vue
@@ -51,7 +51,7 @@ export default {
DateFormat
-
Default date format is mm/dd/yy, to customize this use dateFormat property or define it at locale settings. Note that standalone property overrides the value in locale settings.
+
Default date format is mm/dd/yy, to customize this use dateFormat property or define it at PrimeVue Locale globally. Note that standalone property overrides the value in locale settings.
@@ -124,36 +124,8 @@ export default {
-
Localization
-
Localization for different languages and formats is defined by binding the locale settings object to the locale property. Following is the default values for English.
-
-
-<Calendar v-model="value" :locale="en" />
-
-
-
-
-
-export default {
- data() {
- return {
- en: {
- firstDayOfWeek: 0,
- dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
- dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
- dayNamesMin: ["Su","Mo","Tu","We","Th","Fr","Sa"],
- monthNames: [ "January","February","March","April","May","June","July","August","September","October","November","December" ],
- monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun","Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ],
- today: 'Today',
- clear: 'Clear',
- dateFormat: 'mm/dd/yy',
- weekHeader: 'Wk'
- }
- }
- }
-}
-
-
+
Locale
+
Locale for different languages and formats is defined globally, refer to the PrimeVue Locale configuration for more information.
Custom Content
Calendar UI accepts custom content using header and footer templates.
@@ -234,8 +206,8 @@ export default {
dateFormat |
string |
- mm/dd/yy |
- Format of the date. |
+ null |
+ Format of the date. Defaults to PrimeVue Locale configuration. |
inline |
@@ -586,12 +558,12 @@ export default {
<Calendar id="basic" v-model="date1" />
</div>
<div class="p-field p-col-12 p-md-4">
- <label for="icon">Icon</label>
- <Calendar id="icon" v-model="date3" :showIcon="true" />
+ <label for="dateformat">Spanish</label>
+ <Calendar id="dateformat" v-model="date2" dateFormat="mm-dd-yy" />
</div>
<div class="p-field p-col-12 p-md-4">
- <label for="spanish">Spanish</label>
- <Calendar id="spanish" v-model="date2" :locale="es" dateFormat="dd/mm/yy" />
+ <label for="icon">Icon</label>
+ <Calendar id="icon" v-model="date3" :showIcon="true" />
</div>
<div class="p-field p-col-12 p-md-4">
<label for="minmax">MinMax</label>
@@ -637,7 +609,7 @@ export default {
<label for="datetemplate">Date Template</label>
<Calendar id="datetemplate" v-model="date12">
<template #date="slotProps">
- <strong v-if="slotProps.date.day > 10 && slotProps.date.day < 15" class="special-day">{{slotProps.date.day}}</strong>
+ <strong v-if="slotProps.date.day > 10 && slotProps.date.day < 15" class="special-day">{{slotProps.date.day}}</strong>
<template v-else>{{slotProps.date.day}}}</template>
</template>
</Calendar>
@@ -693,17 +665,6 @@ export default {
date14: null,
dates1: null,
dates2: null,
- es: {
- firstDayOfWeek: 1,
- dayNames: [ "Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado" ],
- dayNamesShort: [ "Dom","Lun","Mar","Mié","Jue","Vie","Sáb" ],
- dayNamesMin: [ "D","L","M","X","J","V","S" ],
- monthNames: [ "Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre" ],
- monthNamesShort: [ "Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic" ],
- today: 'Hoy',
- clear: 'Borrar',
- weekHeader: 'Sm'
- },
minDate: null,
maxDate: null,
invalidDates: null
diff --git a/src/views/confirmdialog/ConfirmDialogDoc.vue b/src/views/confirmdialog/ConfirmDialogDoc.vue
index cba341880..ff931f7f4 100644
--- a/src/views/confirmdialog/ConfirmDialogDoc.vue
+++ b/src/views/confirmdialog/ConfirmDialogDoc.vue
@@ -155,13 +155,13 @@ export default {
acceptLabel |
string |
null |
- Label of the accept button. |
+ Label of the accept button. Defaults to PrimeVue Locale configuration. |
rejectLabel |
string |
null |
- Label of the reject button. |
+ Label of the reject button. Defaults to PrimeVue Locale configuration. |
acceptIcon |
diff --git a/src/views/confirmpopup/ConfirmPopupDoc.vue b/src/views/confirmpopup/ConfirmPopupDoc.vue
index e55fc3a31..5390ca1e9 100644
--- a/src/views/confirmpopup/ConfirmPopupDoc.vue
+++ b/src/views/confirmpopup/ConfirmPopupDoc.vue
@@ -142,17 +142,17 @@ export default {
null |
Callback to execute when action is rejected. |
-
+
acceptLabel |
string |
null |
- Label of the accept button. |
+ Label of the accept button. Defaults to PrimeVue Locale configuration. |
rejectLabel |
string |
null |
- Label of the reject button. |
+ Label of the reject button. Defaults to PrimeVue Locale configuration. |
acceptIcon |
diff --git a/src/views/fileupload/FileUploadDoc.vue b/src/views/fileupload/FileUploadDoc.vue
index 202a07b2b..f1ee204dd 100755
--- a/src/views/fileupload/FileUploadDoc.vue
+++ b/src/views/fileupload/FileUploadDoc.vue
@@ -194,26 +194,26 @@ myUploader(event) {
chooseLabel |
string |
- Choose |
+ null |
Label of the choose button. |
uploadLabel |
string |
Upload |
- Label of the upload button. |
+ null of the upload button. Defaults to PrimeVue Locale configuration. |
cancelLabel |
string |
Cancel |
- Label of the cancel button. |
+ null of the cancel button. Defaults to PrimeVue Locale configuration. |
customUpload |
boolean |
false |
- Whether to use the default upload or a manual implementation defined in uploadHandler callback. |
+ Whether to use the default upload or a manual implementation defined in uploadHandler callback. Defaults to PrimeVue Locale configuration. |
diff --git a/src/views/locale/LocaleDemo.vue b/src/views/locale/LocaleDemo.vue
new file mode 100644
index 000000000..940f7a6e6
--- /dev/null
+++ b/src/views/locale/LocaleDemo.vue
@@ -0,0 +1,170 @@
+
+
+
+
Internationalization and Localization
+
The Locale API allows setting i18n and l7n options globally for the components.
+
+
Getting Started
+
Locale values are stored in the global configuration that becomes accessible after installing the PrimeVue.
+
+
+import {createApp} from 'vue';
+import PrimeVue from 'primevue/config';
+const app = createApp(App);
+
+app.use(PrimeVue);
+
+
+
+
Second parameter of the use function can be used to initiate the locale during PrimeVue installation.
+
+
+app.use(PrimeVue, {
+ accept: 'Aceptar',
+ reject: 'Rechazar',
+ //...
+});
+
+
+
+
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.
+
+
Options API
+
+
+export default {
+ methods: {
+ changeToSpanish() {
+ this.$primevue.config.locale.accept = 'Aceptar';
+ this.$primevue.config.locale.reject = 'Rechazar';
+ }
+ }
+}
+
+
+
+
Composition API
+
+
+import { defineComponent, reactive } 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';
+ }
+ }
+});
+
+
+
+
+
+
Locale Options
+
+
+
+
+ Key |
+ Value |
+
+
+
+
+ accept |
+ Yes |
+
+
+ reject |
+ No |
+
+
+ choose |
+ Choose |
+
+
+ upload |
+ Upload |
+
+
+ cancel |
+ Cancel |
+
+
+ dayNames |
+ ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] |
+
+
+ dayNamesShort |
+ ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] |
+
+
+ dayNamesMin |
+ ["Su","Mo","Tu","We","Th","Fr","Sa"] |
+
+
+ monthNames |
+ ["January","February","March","April","May","June","July","August","September","October","November","December"] |
+
+
+ monthNamesShort |
+ ["Jan", "Feb", "Mar", "Apr", "May", "Jun","Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] |
+
+
+ today |
+ Today |
+
+
+ today |
+ Today |
+
+
+ weekHeader |
+ Wk |
+
+
+ firstDayOfWeek |
+ 0 |
+
+
+ dateFormat |
+ mm/dd/yy |
+
+
+ weak |
+ Weak |
+
+
+ medium |
+ Medium |
+
+
+ strong |
+ Strong |
+
+
+ passwordPrompt |
+ Enter a password |
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/password/PasswordDoc.vue b/src/views/password/PasswordDoc.vue
index 1e40c86c2..e2eae0c80 100755
--- a/src/views/password/PasswordDoc.vue
+++ b/src/views/password/PasswordDoc.vue
@@ -62,7 +62,7 @@ import Password from 'primevue/password';
promptLabel |
string |
Enter a password |
-
Text to prompt password entry. |
+
Text to prompt password entry. Defaults to PrimeVue Locale configuration. |