• Avinash Gadgil 3
  • NEWBIE
  • 0 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 0
    Replies


JS code for lwc component

import LANG from '@salesforce/i18n/lang';
import DIR from '@salesforce/i18n/dir';


export default class multiPageForm2 extends NavigationMixin(LightningElement) {
  lang = LANG;
  dir = DIR;
 

HTML code used for i18n

 <div><p><lightning-input lang={lang} dir={dir}
                    label="Last Name" type="text" value={infoOblName} name="oblName" required=""
                    onchange={scoreHandleChange}></lightning-input></p></div>

1
Here the combobox options are getting translated but other labels are not getting translated into selected languages
Apex Code: 
public with sharing class userListApexClassForLWC {
    @AuraEnabled(cacheable=true)
    public static List<User> userList() {
        return [Select Id, FirstName, LastName, Email, profile.Name, IsActive FROM  User Where IsActive=true LIMIT 5];
    }
}

LWC JS:

import { LightningElement, wire, track} from 'lwc';
import userListApexClassForLWC1 from '@salesforce/apex/userListApexClassForLWC.userList';
export default class UserListInLWC extends LightningElement {
  
    @track error;
    @track FirstName;
    @track LastName;
    @track Email;
    @track profile;
    @track IsActive;
    profileName;
   
    data=[]
    columns = []
   
     @track columns = [
        { label: 'First Name', fieldName: 'FirstName', type: 'text'  },
        { label: 'Last Name', fieldName: 'LastName', type: 'text' },
        { label: 'Email', fieldName: 'Email', type: 'email' },
        { label: 'Profile', fieldName: 'profileName', type: 'string' },
        { label: 'IsActive', fieldName: 'IsActive', type: 'boolean' },
    ];
    @wire(userListWrapper, {currentRecordId: '$recordId'})
    dataFn({data}){
        this.data = data;
    }
    @wire (userListApexClassForLWC1) wireduser ({error,data})
    {
        if (error) {
           this.error = error ;
        } else if (data) {
            this.data = data;
            profileName= data.profile.name;
            console.log(data);
        }
    }
}

LWC HTML:

<template>
    <lightning:card>
    <div style="height: 500px;">
        <template if:true={data}>
            <lightning-datatable
                     key-field="id"
                     data={data}
                     columns={columns}>
        </lightning-datatable>
        </template>
        </div>
    </lightning:card>
</template>