I created a lightning web component(LWC) with custom labels.
And I also set translation with these labels. (My default lang is Japanese, and translation is English).
But I found these labels is always showing itself in English, even though lang and locale is set to ja and ja_JP correctly.
This behavior is same on LightningApp and Visualforce with lightningOut.
How can I get the correctly tranlated labels?
Here is sample code and meta.
force-app/main/default/lwc/labelTest/labelTest.js
import { LightningElement, track } from 'lwc';
import translate from '@salesforce/label/c.translate';
import lang from '@salesforce/i18n/lang';
import locale from '@salesforce/i18n/locale';
export default class LabelTest extends LightningElement {
@track translate = translate;
@track info = {
lang,
locale,
}
}
force-app/main/default/labels/CustomLabels.labels-meta.xml
<?xml version="1.0" encoding="UTF-8"?>
<CustomLabels xmlns="http://soap.sforce.com/2006/04/metadata">
<labels>
<fullName>translate</fullName>
<language>ja</language>
<protected>true</protected>
<shortDescription>翻訳</shortDescription>
<value>翻訳する</value>
</labels>
</CustomLabels>
force-app/main/default/translations/en_US.translation-meta.xml
<?xml version="1.0" encoding="UTF-8"?>
<Translations xmlns="http://soap.sforce.com/2006/04/metadata">
<customLabels>
<label>Translate</label>
<name>translate</name>
</customLabels>
...
</Translations>
force-app/main/default/translations/ja.translation-meta.xml
<?xml version="1.0" encoding="UTF-8"?>
<Translations xmlns="http://soap.sforce.com/2006/04/metadata">
<customLabels>
<label><!-- 翻訳する --></label>
<name>translate</name>
</customLabels>
...
</Translations>
Please help me!