Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: select text file string should be i18n supported. avoided renaming existing field for backward compatiblity #1591

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/angular/src/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2692,15 +2692,15 @@ export declare interface IxTypography extends Components.IxTypography {}


@ProxyCmp({
inputs: ['accept', 'disabled', 'i18nUploadDisabled', 'i18nUploadFile', 'loadingText', 'multiline', 'multiple', 'selectFileText', 'state', 'uploadFailedText', 'uploadSuccessText'],
inputs: ['accept', 'disabled', 'i18nUploadDisabled', 'i18nUploadFile', 'i18nSelectFileText', 'loadingText', 'multiline', 'multiple', 'selectFileText', 'state', 'uploadFailedText', 'uploadSuccessText'],
methods: ['setFilesToUpload']
})
@Component({
selector: 'ix-upload',
changeDetection: ChangeDetectionStrategy.OnPush,
template: '<ng-content></ng-content>',
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
inputs: ['accept', 'disabled', 'i18nUploadDisabled', 'i18nUploadFile', 'loadingText', 'multiline', 'multiple', 'selectFileText', 'state', 'uploadFailedText', 'uploadSuccessText'],
inputs: ['accept', 'disabled', 'i18nUploadDisabled', 'i18nUploadFile', 'i18nSelectFileText', 'loadingText', 'multiline', 'multiple', 'selectFileText', 'state', 'uploadFailedText', 'uploadSuccessText'],
})
export class IxUpload {
protected el: HTMLElement;
Expand Down
22 changes: 22 additions & 0 deletions packages/core/component-doc.json
Original file line number Diff line number Diff line change
Expand Up @@ -21040,6 +21040,28 @@
"optional": false,
"required": false
},
{
"name": "i18nSelectFileText",
"type": "string",
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"mutable": false,
"attr": "i-1-8n-select-file-text",
"reflectToAttr": false,
"docs": "Label for select file text",
"docsTags": [],
"default": "'+ Drag files here or…'",
"values": [
{
"type": "string"
}
],
"optional": false,
"required": false
},
{
"name": "i18nUploadFile",
"type": "string",
Expand Down
8 changes: 8 additions & 0 deletions packages/core/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3098,6 +3098,10 @@ export namespace Components {
* Label for upload file button
*/
"i18nUploadFile": string;
/**
* Label for select file text
*/
"i18nSelectFileText": string;
/**
* Will be used by state = UploadFileState.LOADING
*/
Expand Down Expand Up @@ -8349,6 +8353,10 @@ declare namespace LocalJSX {
* Label for upload file button
*/
"i18nUploadFile"?: string;
/**
* Label for select file text
*/
"i18nSelectFileText"?: string;
/**
* Will be used by state = UploadFileState.LOADING
*/
Expand Down
7 changes: 6 additions & 1 deletion packages/core/src/components/upload/upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@
*/
@Prop() selectFileText = '+ Drag files here or…';

/**
* Label for Select file text
*/
@Prop() i18nSelectFileText = '+ Drag files here or…';
Copy link
Collaborator

@danielleroux danielleroux Dec 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose behind this change?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to pass this string as per selected language, similar to i18nUploadFile button internationalization.
Kindly let me know if any other details are needed.

Copy link
Author

@ram-02 ram-02 Dec 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

selectFileText property is getting used to show default text, Can we rename selectFileText to i18nSelectFileText instead of adding new property?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least not in a minor version this have to be done on a major version e.g release-3.0.0 branch.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok then can you please suggest how should we proceed with this PR?
Should I close this PR and raise a defect to address this or should I follow any other steps?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see two options here:

Either close the PR and add the i18n prefix at a later point in time, or
deprecate the selectFileText property (and add a changeset to this PR).


/**
* Will be used by state = UploadFileState.LOADING
*/
Expand Down Expand Up @@ -197,7 +202,7 @@
case UploadFileState.SELECT_FILE:
return (
<span class="state">
<span class="upload-text">{this.selectFileText}</span>
<span class="upload-text">{this.i18nSelectFileText || this.selectFileText}</span>

Check failure on line 205 in packages/core/src/components/upload/upload.tsx

View workflow job for this annotation

GitHub Actions / build

Replace `{this.i18nSelectFileText·||·this.selectFileText}` with `⏎··············{this.i18nSelectFileText·||·this.selectFileText}⏎············`
</span>
);
case UploadFileState.LOADING:
Expand Down
1 change: 1 addition & 0 deletions packages/vue/src/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1206,6 +1206,7 @@ export const IxUpload = /*@__PURE__*/ defineContainer<JSX.IxUpload>('ix-upload',
'disabled',
'state',
'selectFileText',
'i18nSelectFileText',
'loadingText',
'uploadFailedText',
'uploadSuccessText',
Expand Down
Loading