14
votes
Retrieve custom translations for a custom label via the metadata API
You need to use both CustomLabel and Translations.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/...
9
votes
Accepted
APEX: how to get Custom Label's text dynamically?
You cant get dynamic custom labels in Apex:
Check out this idea
check out this link has a workaround solution which you can try in VF context:
public static String getLabelString(String labelName )...
8
votes
Accepted
Deployment error regarding translations when generating package version
There are two things you have to do:
enable Translations in your Scratch-Org-Def (I guess, you already did).
let package-version-create use this scratch org def (I guess, that you didn't)
So you ...
8
votes
Accepted
Where in the SFDX tree do translations of quick actions go?
The translations for QuickActions are included as part of the objectTranslation metadata. So for each object, you can include translations of quickActions as follows:
<?xml version="1.0" ...
7
votes
Accepted
Translate navigation menu in partner community
There is a known issue stating that the translation should be updated in the community 24 hours after you've updated the translation and published your community.
7
votes
Accepted
Why does the LIKE SOQL operator implicitly translate picklist values?
This is what I thought was the reason for the LIKE operator to automatically translate picklist values, and that has been confirmed on the documentation since Spring '21: The LIKE operator is used to ...
7
votes
Why does the LIKE SOQL operator implicitly translate picklist values?
UPDATE
Since Spring 21 (API Version 51.0) the Translate Returned SOQL Results paragraph of Apex Docs was updated by adding the limitations:
The LIKE operator can only query on the label of the ...
6
votes
Accepted
How to get translation of field label based on language and locale?
Here are 2 possible coding options to retrieve translated field label based on current user language
In APEX
Using Schema describe methods, the field label is translated based on user language
Map<...
5
votes
Accepted
Get ToLabel of old value in trigger
In Apex, picklist fields on objects are just plain strings, and lack a method to get the label.
You also can't query the previous state of the database.
You will have to use the system describe ...
5
votes
Accepted
Retrieve custom translations for a custom label via the metadata API
I retrieved the details using the apex-mdapi. Example code below:
List<String> labels = new List<String>{'Demo1'};
MetadataService.MetadataPort service = new MetadataService.MetadataPort()...
5
votes
Accepted
CustomObjectTranslation invalid characters
Well, we figured it out.
It turns out that the two objects in question (one of them actually a Custom Setting) had the _ character in their names. The display name, not the API name.
My_Custom_Object ...
4
votes
Get Label value for specified language
Summer '23 added such a feature:
Label.translationExists(namespace, label, language)
Label.get(namespace, label, language)
This is based on this Idea.
4
votes
How to set the language for API Rest or SOAP?
I know this is an old question. So I add this comment just to help others that are in my situation.
I was struggling to find out how to get translated texts for picklists through the REST API. We ...
4
votes
Accepted
How to remove all translations from Translation Workbench?
I just found an answer to this in the docs (Translation Files):
Delete a translation by replacing the desired value in the TRANSLATION column in either section with a left and right angle bracket
...
4
votes
Lightning components: Custom label translation not working in managed package
My current workaround for this is to add a server side action (custom labels work in apex) that would return a map of all the custom labels used in the component and then set it as an attribute of ...
4
votes
Accepted
How to deploy translation
Following salesforce article says
In order for translated terms to be migrated via change set, both the
language translation and the component being translated must be
included in the change ...
4
votes
Accepted
APEX: get a Custom Label translation in a certain language which is not equal to the current user's language?
In apex:page there is an attribute 'language' which you can set as the language of your choice/requirement to override the users language.
Check this link
language
The language used to display ...
4
votes
Accepted
How to retrieve languages in which a Knowledge Article is translated
A way to fetch what other languages it has been translated to is to filter on the knowledgearticleid or Id in your soql.
As per the SOAP API Developer Guide documentation on KnowledgeArticleVersion:
...
4
votes
Why does the LIKE SOQL operator implicitly translate picklist values?
I don't have a why for you, but if you have a scenario where LIKE needs to match the API name, you could create a formula field targeting the same picklist. FFs always return API name not label.
4
votes
Accepted
How to deploy Custom Label Translations
In order to deploy Custom Label translations, it is necessary to include Language Translation to changeset.
Check the screenshot below:
4
votes
Apex Trigger error message working for all languages except for one
You should use getRecordTypeInfosByDeveloperName rather than getRecordTypeInfosByName. The latter would be affected by translations as well, but the DeveloperName does not change.
3
votes
lightning page custom tabs translation
From what I can tell, lightning tab translations are not directly supported in Translation Workbench, but there's a workaround.
The code for a Lightning Tab looks something like this:
<lightning:...
3
votes
Accepted
'No data to import' when importing .stf with Translation Workbench
OK, I think I've got it. From the help page explaining what 'No data to import' message means:
The file you’re trying to import is empty or
does not contain any translation changes.
It turned ...
3
votes
Accepted
Deployment of translations of custom labels using ANT
This is how it happens:
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>en_US</members&...
3
votes
How to set the language for API Rest or SOAP?
With SOAP API, you can set LocaleOptions in the request header.
LocaleOptions
Specifies the language of the labels returned.
Note that it will only work for certain 'describe' calls. I haven't ...
3
votes
toLabel() in aggregate query
SELECT toLabel(Equipment__r.technical_Platform__c) aliasTECPROB FROM Maintenance_Schedule__c GROUP BY Equipment__r.technical_Platform__c
Use Alias it will work out
3
votes
Accepted
How do I translate RecordType descriptions?
Translation of RecordType Descriptions is by now possible in the Translation Workbench.
3
votes
Retrieving Local Translations from Metadata API call
The Custom Label values coming from the managed package cannot be retrieved, but once they are overridden, they fall under the category of Local Translations / Overrides; now, by retrieving the ...
3
votes
How to see Translation for Custom Label in Lightning Component?
Probably this is a Salesforce bug. I have a similar problem. I'm developing a component as part of managed package. Translations work when I'm inside the development org, but I get only English values ...
3
votes
Translate navigation menu in partner community
You could try adding another language to your community to see if this solves your problem. I recently had the same issue and contacted Salesforce support to get some help (to confirm if it's the ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
translation × 250translation-workbench × 70
customlabel × 41
apex × 36
visualforce × 25
picklist × 25
metadata-api × 19
language × 17
community × 12
lightning-aura-components × 11
lightning-web-components × 10
deployment × 9
salesforcedx × 8
managed-package × 8
metadata × 8
lightning × 7
soql × 7
custom-object × 6
knowledge × 6
label × 5
rest-api × 4
force.com-sites × 4
customer-community × 4
scratch-org × 4
country-and-state × 4