Skip to content

Commit 8a1eec4

Browse files
web-padawanclaude
andauthored
docs: add i18n getter override and improve i18n JSDoc for upload components (#11382)
Add i18n getter/setter with @type override to UploadFileListMixin so CEM can resolve the specific UploadFileListI18n type. Add full default i18n structure to JSDoc in both .js and .d.ts. Also add missing fileTooLarge to UploadMixin i18n JSDoc. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f53f0b3 commit 8a1eec4

4 files changed

Lines changed: 93 additions & 2 deletions

File tree

‎packages/upload/src/vaadin-upload-file-list-mixin.d.ts‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,43 @@ export declare class UploadFileListMixinClass {
6969
* To change the default localization, replace this with an object
7070
* that provides all properties, or just the individual properties
7171
* you want to change.
72+
*
73+
* The object has the following JSON structure and default values:
74+
* ```js
75+
* {
76+
* file: {
77+
* retry: 'Retry',
78+
* start: 'Start',
79+
* remove: 'Remove'
80+
* },
81+
* error: {
82+
* tooManyFiles: 'Too Many Files.',
83+
* fileIsTooBig: 'File is Too Big.',
84+
* incorrectFileType: 'Incorrect File Type.'
85+
* },
86+
* uploading: {
87+
* status: {
88+
* connecting: 'Connecting...',
89+
* stalled: 'Stalled',
90+
* processing: 'Processing File...',
91+
* held: 'Queued'
92+
* },
93+
* remainingTime: {
94+
* prefix: 'remaining time: ',
95+
* unknown: 'unknown remaining time'
96+
* },
97+
* error: {
98+
* serverUnavailable: 'Upload failed, please try again later',
99+
* unexpectedServerError: 'Upload failed due to server error',
100+
* forbidden: 'Upload forbidden',
101+
* fileTooLarge: 'File is too large'
102+
* }
103+
* },
104+
* units: {
105+
* size: ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
106+
* }
107+
* }
108+
* ```
72109
*/
73110
i18n: UploadFileListI18n;
74111
}

‎packages/upload/src/vaadin-upload-file-list-mixin.js‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,58 @@ export const UploadFileListMixin = (superClass) =>
8686
return ['__updateItems(items, __effectiveI18n, disabled, _theme)'];
8787
}
8888

89+
/**
90+
* The object used to localize this component.
91+
* To change the default localization, replace this with an object
92+
* that provides all properties, or just the individual properties
93+
* you want to change.
94+
*
95+
* The object has the following JSON structure and default values:
96+
* ```js
97+
* {
98+
* file: {
99+
* retry: 'Retry',
100+
* start: 'Start',
101+
* remove: 'Remove'
102+
* },
103+
* error: {
104+
* tooManyFiles: 'Too Many Files.',
105+
* fileIsTooBig: 'File is Too Big.',
106+
* incorrectFileType: 'Incorrect File Type.'
107+
* },
108+
* uploading: {
109+
* status: {
110+
* connecting: 'Connecting...',
111+
* stalled: 'Stalled',
112+
* processing: 'Processing File...',
113+
* held: 'Queued'
114+
* },
115+
* remainingTime: {
116+
* prefix: 'remaining time: ',
117+
* unknown: 'unknown remaining time'
118+
* },
119+
* error: {
120+
* serverUnavailable: 'Upload failed, please try again later',
121+
* unexpectedServerError: 'Upload failed due to server error',
122+
* forbidden: 'Upload forbidden',
123+
* fileTooLarge: 'File is too large'
124+
* }
125+
* },
126+
* units: {
127+
* size: ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
128+
* }
129+
* }
130+
* ```
131+
* @type {!UploadFileListI18n}
132+
*/
133+
get i18n() {
134+
return super.i18n;
135+
}
136+
137+
set i18n(value) {
138+
super.i18n = value;
139+
}
140+
89141
constructor() {
90142
super();
91143
this.__onManagerFilesChanged = this.__onManagerFilesChanged.bind(this);

‎packages/upload/src/vaadin-upload-mixin.d.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,8 @@ export declare class UploadMixinClass {
252252
* error: {
253253
* serverUnavailable: 'Upload failed, please try again later',
254254
* unexpectedServerError: 'Upload failed due to server error',
255-
* forbidden: 'Upload forbidden'
255+
* forbidden: 'Upload forbidden',
256+
* fileTooLarge: 'File is too large'
256257
* }
257258
* },
258259
* file: {

‎packages/upload/src/vaadin-upload-mixin.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,8 @@ export const UploadMixin = (superClass) =>
411411
* error: {
412412
* serverUnavailable: 'Upload failed, please try again later',
413413
* unexpectedServerError: 'Upload failed due to server error',
414-
* forbidden: 'Upload forbidden'
414+
* forbidden: 'Upload forbidden',
415+
* fileTooLarge: 'File is too large'
415416
* }
416417
* },
417418
* file: {

0 commit comments

Comments
 (0)