Skip to content

Commit 9430a57

Browse files
update readme
1 parent 301e951 commit 9430a57

1 file changed

Lines changed: 41 additions & 14 deletions

File tree

README.md

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -452,18 +452,31 @@ Custom properties are supported via the usage of CMIS secondary type properties.
452452
> SDM supports secondary properties with data types `String`, `Boolean`, `Decimal`, `Integer` and `DateTime`.
453453

454454
## Support for Maximum allowed uploads
455-
This plugin allows you to customize the maximum number of uploads a user can perform. Once a user exceeds the defined limit, any further upload attempts will trigger an error. The error message shown to the user is also fully customizable. The annotation `@SDM.Attachments` should be used for defining the maximum upload limit and the error message.
455+
This plugin allows you to customize the maximum number of uploads a user can perform. Once a user exceeds the defined limit, any further upload attempts will trigger an error. The error message shown to the user is also fully customizable. The annotation `@SDM.Attachments` should be used for defining the maximum upload limit.
456456

457457
Refer the following example from a sample Bookshop app:
458458
- maxCount: Specifies the maximum number of documents a user is allowed to upload.
459-
- maxCountError: Defines the error message displayed when the upload limit (maxCount) is exceeded.
460459

461460
```cds
462461
extend entity Books with {
463-
attachments : Composition of many Attachments @SDM.Attachments:{maxCount: 4, maxCountError:'Only 4 attachments allowed.'};
462+
attachments : Composition of many Attachments @SDM.Attachments:{maxCount: 4};
464463
}
465464

466465
```
466+
467+
#### Customizing the Maximum Count Error Message
468+
469+
To customize the error message displayed when the upload limit is exceeded, add the following key to your `messages_[languagecode].properties` file under `srv/src/main/resources`:
470+
471+
```properties
472+
SDM.maxCountErrorMessage = Maximum number of attachments reached
473+
```
474+
475+
Example for German language in `messages_de.properties`:
476+
```properties
477+
SDM.maxCountErrorMessage = Maximale Anzahl von Anhängen erreicht
478+
```
479+
467480
> **Note**
468481
>
469482
> Once the maxCount is configured, it is recommended not to alter it. If the maxCount is altered, the previously uploaded documents will still be visible.
@@ -862,25 +875,39 @@ annotate Attachments with @Common: {SideEffects #ContentChanged: {
862875
- Repeat for other entities and elements if you have defined multiple `composition of many Attachments`.
863876

864877
## Support for Localization
865-
If the UI fields have to be available in the local language of the leading application ensure to add the below fields in the i18n_[languagecode].properties file under app/_i18n folder.
866-
Default language translations are present in i18n.properties files. If leading application does not provide any keys and values in their language properties files then default english language messages are shown to the user.
867878

868-
Example i18n_de.properties for german language.
869-
```
879+
This plugin supports internationalization (i18n) for both UI fields and error messages, allowing you to provide translations in the local language of your leading application.
880+
881+
### UI Fields Localization
882+
883+
To translate UI fields, add the following keys to your `i18n_[languagecode].properties` file located under `app/_i18n` folder.
884+
885+
Default language translations are present in `i18n.properties` files. If the leading application does not provide translations in their language-specific properties files, default English language messages are shown to the user.
886+
887+
Example `i18n_de.properties` for German language:
888+
```properties
870889
Attachment=Attachment
871890
Attachments=Attachments
872-
Note= Attachment Note
891+
Note=Attachment Note
873892
Filename=File Name
874893
linkUrl=Link Url
875894
type=Type
876-
```
877-
For the exception messages as well the translation can be done by adding the translation to messages_[languagecode].properties files present under srv/src/main/resources.
878-
Default language translations are present in messages.properties. If leading application does not provide any keys and values in their language properties files then default english language messages are shown to the user.
895+
```
896+
897+
### Error Messages Localization
879898

880-
Example for german language
899+
The plugin provides error message keys in the `SDMErrorKeys` [class](https://github.com/cap-java/sdm/blob/develop/sdm/src/main/java/com/sap/cds/sdm/constants/SDMErrorKeys.java). You can override these messages by adding translations to `messages_[languagecode].properties` files in your leading application under `srv/src/main/resources`.
900+
901+
Default messages are present in `SDMErrorMessages` [class](https://github.com/cap-java/sdm/blob/develop/sdm/src/main/java/com/sap/cds/sdm/constants/SDMErrorMessages.java). If the leading application does not provide translations in their language-specific properties files, these default English language messages are shown to the user.
902+
903+
Example `messages_de.properties` for German language:
904+
```properties
905+
SDM.virusRepoErrorMoreThan400MB=Sie können keine Dateien hochladen, die größer als 400 MB sind
906+
SDM.userNotAuthorisedError=Sie verfügen nicht über die erforderlichen Berechtigungen zum Hochladen von Anhängen
907+
SDM.mimetypeInvalidError=Der Dateityp ist nicht zulässig
908+
SDM.maxCountErrorMessage=Maximale Anzahl von Anhängen erreicht
881909
```
882-
SDM.Attachments.maxCountError = Maximum number of attachments reached in German......
883-
```
910+
884911
## Known Restrictions
885912

886913
- UI5 Version 1.135.0: This version causes error in upload of attachments.

0 commit comments

Comments
 (0)