Skip to content

Commit 55701d4

Browse files
committed
adding localized value information
1 parent 761dc3a commit 55701d4

File tree

3 files changed

+86
-6
lines changed

3 files changed

+86
-6
lines changed

powerapps-docs/developer/common-data-service/create-custom-api-solution.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,27 @@ Open the solution you created and verify that the Custom API and the associated
214214
At this point, you can test your API using the steps describe in [Test your Custom API](create-custom-api-maker-portal.md#test-your-custom-api)
215215

216216

217+
## Providing Localized Labels with the solution
218+
219+
As an alternative to using the process described in [Localized values](custom-api.md#localized-values), if you are editing the solution files for Custom API entities, you can provide translations directly in these files. For example if you want to provide Japanese localized labels for your Custom API, you can provide them for the `description` and `displayname` properties as shown below
220+
221+
```xml
222+
<customapi uniquename="sample_CustomAPIExample">
223+
<allowedcustomprocessingsteptype>0</allowedcustomprocessingsteptype>
224+
<bindingtype>0</bindingtype>
225+
<description default="A simple example of a Custom API">
226+
<label description="A simple example of a Custom API" languagecode="1033" />
227+
<label description="カスタムAPIの簡単な例" languagecode="1041" />
228+
</description>
229+
<displayname default="Custom API Example">
230+
<label description="Custom API Example" languagecode="1033" />
231+
<label description="カスタムAPIの例" languagecode="1041" />
232+
</displayname>
233+
<isfunction>0</isfunction>
234+
<name>sample_CustomAPIExample</name>
235+
</customapi>
236+
```
237+
217238
### See also
218239

219240
[Create and use Custom APIs](custom-api.md)<br />

powerapps-docs/developer/common-data-service/custom-api.md

Lines changed: 65 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -259,15 +259,74 @@ FROM customapi AS api
259259
ON api.plugintypeid = type.plugintypeid
260260
```
261261

262-
## Frequently Asked Questions (FAQs)
262+
## Localized values
263+
264+
You can localize the values using the steps documented here: [Translate localizable text for model-driven apps](../../maker/model-driven-apps/translate-localizable-text.md) and [Translating labels and display strings](/power-platform/alm/create-solutions-support-multiple-languages#translating-labels-and-display-strings).
265+
266+
This process involves exporting a file that contains the base language values and will include a column for each additional language enabled. You can then edit the values in Excel. After you complete the process to import the translations the labels will be included in your solution.
267+
268+
The following example shows editing the Excel worksheet to add Japanese translations for the English values.
269+
270+
:::image type="content" source="media/solution-strings-for-translation.png" alt-text="Shows how labels are localized":::
263271

264-
### Q: Do I have to provide localized display names and descriptions for my Custom API, parameters, and response properties?
272+
> [!TIP]
273+
> If you are editing the solution files to create your Custom APIs, you can provide the localized labels directly. More information: [Providing Localized Labels with the solution](create-custom-api-solution.md#providing-localized-labels-with-the-solution)
265274
266-
A: No, you don’t but it is strongly recommended.
275+
### Retrieving localized values
267276

268-
### Q: How to provide localized values for the localized display names?
277+
To retrieve the localized labels use the `RetrieveLocLabels` message using either the Web API [RetrieveLocLabels Function](/dynamics365/customer-engagement/web-api/retrieveloclabels) or the Organization Service <xref:Microsoft.Crm.Sdk.Messages.RetrieveLocLabelsRequest>.
278+
279+
The following example shows using the RetrieveLocLabels Function to retrieve the labels for the the `displayname` property of a Custom API with the `customapiid` of `88602189-183d-4584-ba4b-8b60f0f5b89f`
280+
281+
**Request**
282+
283+
```http
284+
GET [Organization URI]/api/data/v9.1/RetrieveLocLabels(EntityMoniker=@p1,AttributeName=@p2,IncludeUnpublished=@p3)?
285+
@p1={'@odata.id':'customapis(88602189-183d-4584-ba4b-8b60f0f5b89f)'}&
286+
@p2='displayname'&
287+
@p3=false HTTP/1.1
288+
289+
```
290+
291+
**Response**
292+
293+
```http
294+
HTTP/1.1 200 OK
295+
OData-Version: 4.0
296+
297+
{
298+
"@odata.context": "[Organization URI]/api/data/v9.1/$metadata#Microsoft.Dynamics.CRM.RetrieveLocLabelsResponse",
299+
"Label": {
300+
"LocalizedLabels": [
301+
{
302+
"Label": "Custom API Example",
303+
"LanguageCode": 1033,
304+
"IsManaged": null,
305+
"MetadataId": null,
306+
"HasChanged": null
307+
},
308+
{
309+
"Label": "カスタムAPIの例",
310+
"LanguageCode": 1041,
311+
"IsManaged": null,
312+
"MetadataId": null,
313+
"HasChanged": null
314+
}
315+
],
316+
"UserLocalizedLabel": {
317+
"Label": "Custom API Example",
318+
"LanguageCode": 1033,
319+
"IsManaged": null,
320+
"MetadataId": null,
321+
"HasChanged": null
322+
}
323+
}
324+
}
325+
```
326+
327+
## Frequently Asked Questions (FAQs)
269328

270-
A: You don’t need to provide the localized values. These values are typically localized on a per environment case depending on the additional languages they have enabled. But if you wish to include them in your solution you can. More information: [Translating labels and display strings](/alm/create-solutions-support-multiple-languages#translating-labels-and-display-strings)
329+
The following represent questions you may have:
271330

272331
### Q: Can I create a new privilege for my Custom API?
273332

@@ -282,7 +341,7 @@ A: You cannot. Although these records have the common **Status** and **Status Re
282341

283342
### Q: How can I use my private messages if they are not included in the Web API $metadata service document?
284343

285-
A: Your private messages will work regardless of whether they are advertised in the Web API [CSDL $metadata document](webapi/web-api-types-operations.md#csdl-metadata-document) or not. While you develop your solution, you can leave the `IsPrivate` value set to `false`. This way you can refer to the `$metadata` listing and use code generation tools that depend on this data. However, you should set the `CustomAPI.IsPrivate` value to `false` before you ship your solution for others to use. If you later decide that you wish to support other applications to use the message, you can change the `CustomAPI.IsPrivate` value to `true`.
344+
A: Your private messages will work regardless of whether they are advertised in the Web API [CSDL $metadata document](webapi/web-api-types-operations.md#csdl-metadata-document) or not. While you develop your solution, you can leave the `IsPrivate` value set to `false`. This way you can refer to the `$metadata` listing and use code generation tools that depend on this data. However, you should set the `CustomAPI.IsPrivate` value to `false` before you ship your solution for others to use. If you later decide that you wish to support other applications to use the message, you can change the `CustomAPI.IsPrivate` value to `true`. More information: [Private Messages](org-service/use-messages.md#private-messages)
286345

287346
## Known issues with Custom APIs
288347

40.1 KB
Loading

0 commit comments

Comments
 (0)