Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ruslan-kurchenko/lwc-polyglot
Salesforce Lightning Web Component to facilitate multilingual applications development
https://github.com/ruslan-kurchenko/lwc-polyglot
Last synced: 9 days ago
JSON representation
Salesforce Lightning Web Component to facilitate multilingual applications development
- Host: GitHub
- URL: https://github.com/ruslan-kurchenko/lwc-polyglot
- Owner: ruslan-kurchenko
- License: mit
- Created: 2020-02-21T22:49:06.000Z (over 4 years ago)
- Default Branch: dev
- Last Pushed: 2020-09-03T19:08:48.000Z (about 4 years ago)
- Last Synced: 2024-08-02T12:21:28.185Z (3 months ago)
- Language: Apex
- Homepage:
- Size: 38.1 KB
- Stars: 19
- Watchers: 4
- Forks: 2
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-lwc - Polyglot - kurchenko](https://github.com/ruslan-kurchenko)) (On Platform Community Repos)
README
# Polyglot
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/2ab1efe399f34f45936a98cda366c2c2)](https://app.codacy.com/manual/ruslan-kurchenko/lwc-polyglot?utm_source=github.com&utm_medium=referral&utm_content=ruslan-kurchenko/lwc-polyglot&utm_campaign=Badge_Grade_Dashboard)
Salesforce Lightning Web Component to facilitate multilingual applications development
## Features
- Dynamically resolve Custom Label value by name
- (in development...): Resolve Field Label
- (in development...): Resolve Object Label
- (in development...): Resolve Picklist Options## Usage
Resolve Custom Label
```javascript
import { LightningElement } from 'lwc';
import { Polyglot } from 'c/polyglot';const polyglot = new Polyglot();
export default class Examples extends LightningElement {
connectedCallback() {
const validLabel = 'Greetings';
const invalidLabel = 'InvalidName';polyglot.getCustomLabels([validLabel, invalidLabel]).then((result) => {
/*
result: CustomLabels
success: false
messages: {
InvalidName: "Field $Label.InvalidName does not exist. Check spelling"
},
labels: {
InvalidName: "InvalidName",
Greetings: "Hello!"
}
*/
});
}
}
```Custom Labels Resolve Result
- `success` - `true/false` meta information to indicate if one of labels is invalid
- `messages` - meta information to get key/value storage of messages related to invalid labels
- `labels` - a custom label values stored in object by their names## License
[MIT](https://github.com/ruslan-kurchenko/sfdc-lax/blob/master/docs/LICENSE)