Skip to content

Commit 3bb778b

Browse files
committed
LWC documentation translation support.
1 parent ea1bc1e commit 3bb778b

File tree

19 files changed

+215
-48
lines changed

19 files changed

+215
-48
lines changed

examples/translation/apexdocs.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ const spanishTranslations: UserTranslations['markdown'] = {
3030
inheritance: 'Herencia',
3131
implements: 'Implementa',
3232
},
33+
lwc: {
34+
exposed: 'Expuesto',
35+
targets: 'Objetivos',
36+
targetConfigs: 'Configuraciones de Objetivos',
37+
properties: 'Propiedades',
38+
},
3339
};
3440

3541
export default {

examples/translation/docs/index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ Custom object for tracking sales orders.
3030

3131
Represents a speaker at an event.
3232

33+
## Lightning Web Components
34+
35+
### [accordion](lightning-web-components/accordion.md)
36+
37+
Accordion
38+
3339
## Miscellaneous
3440

3541
### [BaseClass](miscellaneous/BaseClass.md)
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# accordion
2+
3+
`Expuesto`
4+
5+
Accordion
6+
7+
## Objetivos
8+
- lightningCommunity__Default
9+
- lightningCommunity__Page
10+
11+
## Configuraciones de Objetivos
12+
13+
### lightningCommunity__Default
14+
15+
#### Propiedades
16+
17+
**Context URL Parameter** `contextUrlParam`
18+
19+
Optional - The name of the URL parameter that contains the context ID.
20+
21+
- **Tipo:** String
22+
- **Requerido:** false
23+
24+
**Preview Context ID** `previewContextId`
25+
26+
Optional - The ID of the context record to use when previewing the component in the builder.
27+
28+
- **Tipo:** String
29+
- **Requerido:** false
30+
31+
**Formula Expression** `expr`
32+
33+
Formula expression to be evaluated.
34+
35+
- **Tipo:** String
36+
- **Requerido:** true
37+
38+
**Respect Sharing** `respectSharing`
39+
40+
Whether to run the evaluation with or without sharing.
41+
42+
- **Tipo:** Boolean
43+
- **Requerido:** false
44+
45+
**Auto Collapse** `autoCollapse`
46+
47+
Whether to automatically collapse the accordion when a new section is expanded.
48+
49+
- **Tipo:** Boolean
50+
- **Requerido:** false
51+
52+
**Flush Style** `flushStyle`
53+
54+
Removes the background color and rounded borders from the accordion component.
55+
56+
- **Tipo:** Boolean
57+
- **Requerido:** false

examples/translation/docs/miscellaneous/SampleException.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This is a sample exception.
44

5-
**Usage**
5+
**Usage**
66

77
You can use the exception the following way.
88
You can also take a look at [SampleClass](../samplegroup/SampleClass.md) to see how it is used.

examples/translation/docs/miscellaneous/SampleInterface.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
This is a sample interface
66

7-
**Mermaid**
7+
**Mermaid**
88

99
graph TD
1010
A[SampleInterface] -->|extends| B[ParentInterface]
@@ -33,15 +33,15 @@ sampleInterface.sampleMethod();
3333

3434
This is a sample method
3535

36-
**Custom Tag**
36+
**Custom Tag**
3737

3838
This is a custom tag
3939

40-
**Another Custom Tag**
40+
**Another Custom Tag**
4141

4242
This is another custom tag
4343

44-
**Mermaid**
44+
**Mermaid**
4545

4646
graph TD
4747
A[SampleInterface] -->|extends| B[ParentInterface]

examples/translation/docs/miscellaneous/Url.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Represents a uniform resource locator (URL) and provides access to parts of the URL.
44
Enables access to the base URL used to access your Salesforce org.
55

6-
**Usage**
6+
**Usage**
77

88
Use the methods of the `System.URL` class to create links to objects in your organization. Such objects can be files, images,
99
logos, or records that you want to include in external emails, in activities, or in Chatter posts. For example, you can create
@@ -28,7 +28,7 @@ Account acct = [SELECT Id FROM Account WHERE Name = 'Acme' LIMIT 1];
2828
String fullRecordURL = URL.getOrgDomainURL().toExternalForm() + '/' + acct.Id;
2929
```
3030

31-
**Version Behavior Changes**
31+
**Version Behavior Changes**
3232

3333
In API version 41.0 and later, Apex URL objects are represented by the java.net.URI type, not the java.net.URL type.
3434

@@ -95,7 +95,7 @@ global Url(String spec)
9595

9696
Creates a new instance of the URL class by parsing the specified spec within the specified context.
9797

98-
**Usage**
98+
**Usage**
9999

100100
The new URL is created from the given context URL and the spec argument as described in RFC2396 "Uniform Resource Identifiers : Generic * Syntax" :
101101
```xml
@@ -174,7 +174,7 @@ The authority portion of the current URL.
174174

175175
Returns the URL of an entire request on a Salesforce instance.
176176

177-
**Usage**
177+
**Usage**
178178

179179
An example of a URL for an entire request is https://yourInstance.salesforce.com/apex/myVfPage.apexp.
180180

@@ -194,7 +194,7 @@ The URL of the entire request.
194194

195195
Returns the default port number of the protocol associated with the current URL.
196196

197-
**Usage**
197+
**Usage**
198198

199199
Returns -1 if the URL scheme or the stream protocol handler for the URL doesn't define a default port number.
200200

@@ -274,15 +274,15 @@ The host name of the current URL.
274274

275275
Returns the canonical URL for your org. For example, https://MyDomainName.my.salesforce.com.
276276

277-
**Usage**
277+
**Usage**
278278

279279
Use getOrgDomainUrl() to interact with Salesforce REST and SOAP APIs in Apex code. Get endpoints for User Interface API calls, for creating and customizing picklist value sets and custom fields, and more.
280280

281281
`getOrgDomainUrl()` can access the domain URL only for the org in which the Apex code is running.
282282

283283
You don't need a RemoteSiteSetting for your org to interact with the Salesforce APIs using domain URLs retrieved with this method.
284284

285-
**See Also**
285+
**See Also**
286286

287287
* [Lightning Aura Components Developer Guide: Making API Calls from Apex](https://developer.salesforce.com/docs/atlas.en-us.250.0.lightning.meta/lightning/apex_api_calls.htm)
288288

examples/translation/docs/sample-enums/SampleEnum.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ This is a sample enum. This references [ReferencedEnum](../miscellaneous/Referen
66

77
This description has several lines
88

9-
**Some Custom**
9+
**Some Custom**
1010

1111
Test. I can also have a [ReferencedEnum](../miscellaneous/ReferencedEnum.md) here.
1212
And it can be multiline.
1313

14-
**Mermaid**
14+
**Mermaid**
1515

1616
graph TD
1717
A[SampleEnum] -->|references| B[ReferencedEnum]

examples/translation/docs/samplegroup/SampleClass.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
aliquip ex sunt officia ullamco anim deserunt magna aliquip nisi eiusmod in sit officia veniam ex
55
**deserunt** ea officia exercitation laboris enim in duis quis enim eiusmod eu amet cupidatat.
66

7-
**Internal**
7+
**Internal**
88

99
This should not appear in the docs
1010

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<template>
2+
<c-expression-element-container cannot-show-preview={cannotShowPreview} error={error} loading={loading}>
3+
<div if:true={ready}>
4+
<c-accordion-base items={computed} auto-collapse={autoCollapse} flush-style={flushStyle}></c-accordion-base>
5+
</div>
6+
</c-expression-element-container>
7+
</template>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import ExpressionSiteElement from "c/expressionSiteElement";
2+
import {api} from "lwc";
3+
import {z} from 'c/zod';
4+
5+
export default class Accordion extends ExpressionSiteElement {
6+
@api contextUrlParam;
7+
@api previewContextId;
8+
@api expr;
9+
@api respectSharing;
10+
@api autoCollapse;
11+
@api flushStyle;
12+
13+
validate() {
14+
if (!this.computed) {
15+
return;
16+
}
17+
18+
const accordionSchema = z.array(
19+
z.object({
20+
title: z.string(),
21+
content: z.string(),
22+
})
23+
);
24+
const validationResult = accordionSchema.safeParse(this.computed);
25+
if (!validationResult.success) {
26+
this.error = {
27+
message: 'Accordion component requires an array of objects with "title" and "content" properties.',
28+
rawError: JSON.stringify(validationResult.error.format(), null, 2),
29+
};
30+
return;
31+
}
32+
}
33+
}

0 commit comments

Comments
 (0)