Skip to content

Commit b3da46f

Browse files
author
Hugo Bernier
committed
chore: sample prep
1 parent e7e2f3d commit b3da46f

3 files changed

Lines changed: 112 additions & 16 deletions

File tree

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
[
2+
{
3+
"name": "pnp-sp-dev-spfx-extensions-react-command-document-translation",
4+
"source": "pnp",
5+
"title": "Command Document Translation",
6+
"shortDescription": "A SharePoint Framework (SPFx) List View Command Set extension that enables users to translate documents from one language to another using Azure Document Translation Service. Users can select one or more documents from a SharePoint document library and translate them into multiple target languages simultaneously.",
7+
"url": "https://github.com/pnp/sp-dev-fx-extensions/tree/main/samples/react-command-document-translation",
8+
"longDescription": [
9+
"A SharePoint Framework (SPFx) List View Command Set extension that enables users to translate documents from one language to another using Azure Document Translation Service. Users can select one or more documents from a SharePoint document library and translate them into multiple target languages simultaneously."
10+
],
11+
"creationDateTime": "2025-11-12",
12+
"updateDateTime": "2025-11-12",
13+
"products": [
14+
"SharePoint"
15+
],
16+
"metadata": [
17+
{
18+
"key": "CLIENT-SIDE-DEV",
19+
"value": "React"
20+
},
21+
{
22+
"key": "SPFX-VERSION",
23+
"value": "1.21.1"
24+
}
25+
],
26+
"tags": [],
27+
"categories": [
28+
"SPFX-APPLICATION-EXTENSION"
29+
30+
],
31+
"thumbnails": [
32+
{
33+
"type": "image",
34+
"order": 100,
35+
"url": "https://github.com/pnp/sp-dev-fx-extensions/raw/main/samples/react-command-document-translation/assets/demo.gif",
36+
"alt": "Preview"
37+
}
38+
],
39+
"authors": [
40+
{
41+
"gitHubAccount": "ramin-ahmadi",
42+
"pictureUrl": "https://github.com/ramin-ahmadi.png",
43+
"name": "Ramin Ahmadi"
44+
}
45+
],
46+
"references": [
47+
{
48+
"name": "Overview of SharePoint Framework Extensions",
49+
"description": "You can use SharePoint Framework (SPFx) Extensions to extend the SharePoint user experience. With SPFx Extensions, you can customize more facets of the SharePoint experience, including notification areas, toolbars, and list data views. SPFx Extensions are available in all Microsoft 365 subscriptions for production usage.",
50+
"url": "https://learn.microsoft.com/sharepoint/dev/spfx/extensions/overview-extensions?WT.mc_id=m365-15741-cxa"
51+
},
52+
{
53+
"name": "Use page placeholders from Application Customizer",
54+
"description": "Application Customizers provide access to well-known locations on SharePoint pages that you can modify based on your business and functional requirements. For example, you can create dynamic header and footer experiences that render across all the pages in SharePoint Online.",
55+
"url": "https://learn.microsoft.com/sharepoint/dev/spfx/extensions/get-started/using-page-placeholder-with-extensions?WT.mc_id=m365-15741-cxa"
56+
}
57+
]
58+
}
59+
]

samples/react-command-document-translation/README.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,26 @@
44

55
A SharePoint Framework (SPFx) List View Command Set extension that enables users to translate documents from one language to another using Azure Document Translation Service. Users can select one or more documents from a SharePoint document library and translate them into multiple target languages simultaneously.
66

7-
![Document Translation](./Assets/demo.gif)
7+
![Document Translation](./assets/demo.gif)
88

9-
## Used SharePoint Framework Version
9+
## Compatibility
1010

11-
![version](https://img.shields.io/badge/version-1.21.1-green.svg)
11+
| :warning: Important |
12+
|:---------------------------|
13+
| Every SPFx version is optimally compatible with specific versions of Node.js. In order to be able to Toolchain this sample, you need to ensure that the version of Node on your workstation matches one of the versions listed in this section. This sample will not work on a different version of Node.|
14+
|Refer to <https://aka.ms/spfx-matrix> for more information on SPFx compatibility. |
15+
16+
This sample is optimally compatible with the following environment configuration:
17+
18+
![SPFx 1.21.1](https://img.shields.io/badge/SPFx-1.21.1-green.svg)
19+
![Node.js v22](https://img.shields.io/badge/Node.js-v22-green.svg)
20+
![Toolchain: Heft](https://img.shields.io/badge/Toolchain-Heft-green.svg)
21+
![Compatible with SharePoint Online](https://img.shields.io/badge/SharePoint%20Online-Compatible-green.svg)
22+
![Does not work with SharePoint 2019](https://img.shields.io/badge/SharePoint%20Server%202019-Incompatible-red.svg "SharePoint Server 2019 requires SPFx 1.4.1 or lower")
23+
![Does not work with SharePoint 2016 (Feature Pack 2)](https://img.shields.io/badge/SharePoint%20Server%202016%20(Feature%20Pack%202)-Incompatible-red.svg "SharePoint Server 2016 Feature Pack 2 requires SPFx 1.1")
24+
![Local Workbench Unsupported](https://img.shields.io/badge/Local%20Workbench-Unsupported-red.svg "Local workbench is no longer available as of SPFx 1.13 and above")
25+
![Hosted Workbench Compatible](https://img.shields.io/badge/Hosted%20Workbench-Compatible-green.svg)
26+
![Compatible with Remote Containers](https://img.shields.io/badge/Remote%20Containers-Compatible-green.svg)
1227

1328
## Applies to
1429

@@ -74,18 +89,21 @@ A SharePoint Framework (SPFx) List View Command Set extension that enables users
7489
### Part 1: SPFx Extension Setup
7590

7691
1. **Clone or Download the Repository**
92+
7793
```bash
7894
cd react-command-document-translation/SPFx
7995
```
8096

8197
2. **Install Dependencies**
98+
8299
```bash
83100
npm install
84101
```
85102

86103
3. **Update Configuration**
87104

88105
Edit `config/serve.json` for local testing:
106+
89107
```json
90108
{
91109
"customActions": {
@@ -104,6 +122,7 @@ A SharePoint Framework (SPFx) List View Command Set extension that enables users
104122
```
105123

106124
4. **Build the Extension**
125+
107126
```bash
108127
gulp bundle --ship
109128
gulp package-solution --ship
@@ -118,6 +137,7 @@ A SharePoint Framework (SPFx) List View Command Set extension that enables users
118137
### Part 2: Azure Function Backend Setup
119138

120139
1. **Navigate to Azure Function Directory**
140+
121141
```bash
122142
cd ../AzureFunction/DocumentTranslationApp
123143
```
@@ -127,11 +147,13 @@ A SharePoint Framework (SPFx) List View Command Set extension that enables users
127147
- Copy and adapt C# files from `react-command-documents-redaction/AzureFunction`
128148

129149
3. **Install NuGet Packages**
150+
130151
```bash
131152
dotnet restore
132153
```
133154

134155
4. **Configure local.settings.json**
156+
135157
```json
136158
{
137159
"IsEncrypted": false,
@@ -177,13 +199,15 @@ A SharePoint Framework (SPFx) List View Command Set extension that enables users
177199
- **Host.CORS**: Set to SharePoint domain in production (e.g., `"https://yourtenant.sharepoint.com"`)
178200

179201
5. **Test Locally**
202+
180203
```bash
181204
dotnet run
182205
# Or use Azure Functions Core Tools
183206
func start
184207
```
185208

186209
6. **Deploy to Azure**
210+
187211
```bash
188212
func azure functionapp publish <your-function-app-name>
189213
```
@@ -207,6 +231,7 @@ A SharePoint Framework (SPFx) List View Command Set extension that enables users
207231
### Azure Document Translation API
208232

209233
**Start Translation Job**
234+
210235
```http
211236
POST https://{endpoint}/translator/document/batches?api-version=2024-05-01
212237
Headers:
@@ -232,6 +257,7 @@ Body:
232257
```
233258

234259
**Get Translation Status**
260+
235261
```http
236262
GET https://{endpoint}/translator/document/batches/{id}?api-version=2024-05-01
237263
Headers:

samples/react-command-document-translation/SPFx/README.md

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
1-
# react-command-document-translation
1+
# Command Document Translation
22

33
## Summary
44

5-
Short summary on functionality and used technologies.
5+
A SharePoint Framework (SPFx) List View Command Set extension that enables users to translate documents from one language to another using Azure Document Translation Service. Users can select one or more documents from a SharePoint document library and translate them into multiple target languages simultaneously.
66

7-
[picture of the solution in action, if possible]
7+
## Compatibility
88

9-
## Used SharePoint Framework Version
9+
| :warning: Important |
10+
|:---------------------------|
11+
| Every SPFx version is optimally compatible with specific versions of Node.js. In order to be able to Toolchain this sample, you need to ensure that the version of Node on your workstation matches one of the versions listed in this section. This sample will not work on a different version of Node.|
12+
|Refer to <https://aka.ms/spfx-matrix> for more information on SPFx compatibility. |
13+
14+
This sample is optimally compatible with the following environment configuration:
15+
16+
![SPFx 1.21.1](https://img.shields.io/badge/SPFx-1.21.1-green.svg)
17+
![Node.js v22](https://img.shields.io/badge/Node.js-v22-green.svg)
18+
![Toolchain: Heft](https://img.shields.io/badge/Toolchain-Heft-green.svg)
19+
![Compatible with SharePoint Online](https://img.shields.io/badge/SharePoint%20Online-Compatible-green.svg)
20+
![Does not work with SharePoint 2019](https://img.shields.io/badge/SharePoint%20Server%202019-Incompatible-red.svg "SharePoint Server 2019 requires SPFx 1.4.1 or lower")
21+
![Does not work with SharePoint 2016 (Feature Pack 2)](https://img.shields.io/badge/SharePoint%20Server%202016%20(Feature%20Pack%202)-Incompatible-red.svg "SharePoint Server 2016 Feature Pack 2 requires SPFx 1.1")
22+
![Local Workbench Unsupported](https://img.shields.io/badge/Local%20Workbench-Unsupported-red.svg "Local workbench is no longer available as of SPFx 1.13 and above")
23+
![Hosted Workbench Compatible](https://img.shields.io/badge/Hosted%20Workbench-Compatible-green.svg)
24+
![Compatible with Remote Containers](https://img.shields.io/badge/Remote%20Containers-Compatible-green.svg)
1025

11-
![version](https://img.shields.io/badge/version-1.21.1-green.svg)
1226

1327
## Applies to
1428

@@ -21,18 +35,15 @@ Short summary on functionality and used technologies.
2135

2236
> Any special pre-requisites?
2337
24-
## Solution
38+
## Contributors
2539

26-
| Solution | Author(s) |
27-
| ----------- | ------------------------------------------------------- |
28-
| folder name | Author details (name, company, twitter alias with link) |
40+
- [Ramin Ahmadi](https://github.com/AhmadiRamin)
2941

3042
## Version history
3143

3244
| Version | Date | Comments |
3345
| ------- | ---------------- | --------------- |
34-
| 1.1 | March 10, 2021 | Update comment |
35-
| 1.0 | January 29, 2021 | Initial release |
46+
| 1.0 | November 12, 2025 | Initial release |
3647

3748
## Disclaimer
3849

@@ -45,8 +56,8 @@ Short summary on functionality and used technologies.
4556
- Clone this repository
4657
- Ensure that you are at the solution folder
4758
- in the command-line run:
48-
- **npm install**
49-
- **gulp serve**
59+
- `npm install`
60+
- `gulp serve`
5061

5162
> Include any additional steps as needed.
5263

0 commit comments

Comments
 (0)