-1

I have created a sample LWC component and trying to use Internationalization Properties to change the LWC component's viewing language from English to any end-user language.

I have followed this document - https://developer.salesforce.com/docs/platform/lwc/guide/create-i18n.html

My JS Code is -

// languageExample.js
import { LightningElement } from "lwc";
import LANG from "@salesforce/i18n/lang";
import DIR from "@salesforce/i18n/dir";

export default class LanguageExample extends LightningElement {
   lang = LANG;
   dir = DIR;
}

My HTML Code is -

<!-- languageExample.html -->
<template>
    <p lang={lang} dir={dir}><!-- Localized text in a paragraph --></p>
</template>

I am trying to convert paragraph tag content into Other language from by default English language. I have followed the document but its not working.

Can anyone suggest what I might be doing wrong. Thanks in Advance.

4
  • 1
    "I have followed the document but its not working." OK, but what is actually happening? Can you provide specific detail to help us better understand?
    – Phil W
    Nov 21 at 16:08
  • Parvez, I think you misunderstood the capabilities of Salesforce. Salesforce doesn't "convert paragraph tag content into another language". It just gives some i18n specific tags values. E.g. if your language is Tamil, it might add lang="ta" to the <p> tag (if you are lucky). Maybe you hoped for too much? Nov 21 at 21:31
  • @FelixvanHove thanks for your response. Is there any other way to achieve this? Nov 22 at 7:13
  • Salesforce does not translate anything automatically but their own Salesforce labels and texts. You might need to ask your users to configure their browser to auto translate viewed web pages. Nov 22 at 7:35

0

You must log in to answer this question.

Browse other questions tagged .