Skip to content

Commit

Permalink
Refactor #5715
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed May 13, 2024
1 parent dc1a062 commit 3fabb33
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion components/lib/config/PrimeVue.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ export interface PrimeVueLocaleOptions {
emptySearchMessage?: string;
emptyMessage?: string;
fileChosenMessage?: string;
emptyFileChosenMessage?: string;
noFileChosenMessage?: string;
aria?: PrimeVueLocaleAriaOptions;
}

Expand Down
2 changes: 1 addition & 1 deletion components/lib/config/PrimeVue.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const defaultOptions = {
emptySelectionMessage: 'No selected item',
emptySearchMessage: 'No results found',
fileChosenMessage: '{0} files',
emptyFileChosenMessage: 'No file chosen',
noFileChosenMessage: 'No file chosen',
emptyMessage: 'No available options',
aria: {
trueLabel: 'True',
Expand Down
6 changes: 3 additions & 3 deletions components/lib/fileupload/FileUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
</Button>
<slot v-if="!auto" name="filelabel" :class="cx('filelabel')">
<span :class="cx('filelabel')" :files="files">
{{ basicChooseButtonLabel }}
{{ basicFileChosenLabel }}
</span>
</slot>
<input v-if="!hasFiles" ref="fileInput" type="file" :accept="accept" :disabled="disabled" :multiple="multiple" @change="onFileSelect" @focus="onFocus" @blur="onBlur" v-bind="ptm('input')" />
Expand Down Expand Up @@ -379,15 +379,15 @@ export default {
chooseButtonClass() {
return [this.cx('pcChooseButton'), this.class];
},
basicChooseButtonLabel() {
basicFileChosenLabel() {
if (this.auto) return this.chooseButtonLabel;
else if (this.hasFiles) {
if (this.files && this.files.length === 1) return this.files[0].name;
return this.$primevue.config.locale?.fileChosenMessage?.replace('{0}', this.files.length);
}
return this.$primevue.config.locale?.emptyFileChosenMessage || '';
return this.$primevue.config.locale?.noFileChosenMessage || '';
},
hasFiles() {
return this.files && this.files.length > 0;
Expand Down
2 changes: 1 addition & 1 deletion doc/configuration/locale/LocaleApiDoc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@
<td>{0} files</td>
</tr>
<tr>
<td>emptyFileChosenMessage</td>
<td>noFileChosenMessage</td>
<td>No file chosen</td>
</tr>
<tr>
Expand Down

0 comments on commit 3fabb33

Please sign in to comment.