Skip to content

Commit cd9d3b8

Browse files
Removing locale references for SPFx test components, to allow local running of the Controls in any language (#1882)
1 parent 1bd4601 commit cd9d3b8

File tree

12 files changed

+27
-85
lines changed

12 files changed

+27
-85
lines changed

config/config.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@
3737
},
3838
"externals": {},
3939
"localizedResources": {
40-
"ControlStrings": "lib/loc/{locale}.js",
41-
"ControlsTestWebPartStrings": "lib/webparts/controlsTest/loc/{locale}.js",
42-
"ControlsTestFormCustomizerStrings": "lib/extensions/testForm/loc/{locale}.js",
43-
"TestApplicationCustomizerStrings": "lib/extensions/testApp/loc/{locale}.js"
40+
"ControlStrings": "lib/loc/{locale}.js"
4441
}
4542
}

docs/documentation/docs/guides/mpa.md

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,59 +4,66 @@ The shortest way to prepare your local copy of the project for development and t
44

55
## Install prerequisites
66

7-
Before you start contributing to this project, you will need Node.js. This project has been tested with the 10.x version of Node.js and the version of NPM that comes with it. You can use [Node Version Manager](https://github.com/nvm-sh/nvm) to switch between different versions of Node.js.
7+
Before you start contributing to this project, you will need Node.js. This project (current version 3.x) has been tested with the 18.x version of Node.js and the version of NPM that comes with it. You can use [Node Version Manager](https://github.com/nvm-sh/nvm) or [Node Version Switcher](https://github.com/jasongin/nvs) to switch between different versions of Node.js.
88

99
## Get the local version of the project
1010

1111
- fork this repository
1212
- clone your fork
1313
- in the command line, run the following commands:
14-
- `npm install` to restore dependencies
15-
- `npm install -g gulp-cli` in order to run `gulp` commands (run `npm list -g gulp-cli` to check if already installed on your machine or not)
16-
- `gulp serve` to serve your project (or `npm run serve` if you want to use [`spfx-fast-serve`](https://github.com/s-KaiNet/spfx-fast-serve))
14+
- `npm install` to restore dependencies
15+
- `npm install -g gulp-cli` in order to run `gulp` commands (run `npm list -g gulp-cli` to check if already installed on your machine or not)
16+
- `gulp serve` to serve your project (or `npm run serve` if you want to use [`spfx-fast-serve`](https://github.com/s-KaiNet/spfx-fast-serve))
1717
- Start making your changes
1818

1919
### Run the project locally
2020

2121
As this project embeds a SPFx solution, you have the ability to test all the controls on your machine.
2222

23+
You can also debug the controls in any supported language by running one of the following commands (for example in _french_):
24+
25+
- `gulp serve --locale=fr-fr`
26+
- `npx fast-serve --locale=fr-fr` (if using `spfx-fast-serve`)
27+
28+
Beware that both argument and value have to be lower case. Supported locales are listed in the following project's path: `src\loc`.
29+
2330
!!! warning
2431
As long as you have access to a SharePoint Online environment (for v2 and after), you can test the components from your machine. But to test the web part as a Teams Tab, you have to first deploy the SPFx solution (and sync it to Teams). You also have to deploy the [SharePoint Framework library for Microsoft Graph Toolkit](https://learn.microsoft.com/en-us/graph/toolkit/get-started/mgt-spfx) v2.9.0. So be sure to be at least **SharePoint Administrator**.
2532

2633
#### SPFx web part
2734

28-
The web part is called *ControlsTest* and is available for both SharePoint Online and Teams. To test it on SharePoint, go to the workbench page [https://[SHAREPOINT_SITE].sharepoint.com/_layouts/15/workbench.aspx](https://SHAREPOINT_SITE.sharepoint.com/_layouts/15/workbench.aspx) and add the web part.
35+
The web part is called _ControlsTest_ and is available for both SharePoint Online and Teams. To test it on SharePoint, go to the workbench page [https://[SHAREPOINT_SITE].sharepoint.com/_layouts/15/workbench.aspx](https://SHAREPOINT_SITE.sharepoint.com/_layouts/15/workbench.aspx) and add the web part.
2936

3037
To test it on Teams, once the project deployed on the tenant accordingly, add the web part as a Tab (from a team for example).
3138

32-
To update the host component, open the *ControlsTest* React component located in the following project's relative path: *src\webparts\controlsTest\components\ControlsTest.tsx*.
39+
To update the host component, open the _ControlsTest_ React component located in the following project's relative path: _src\webparts\controlsTest\components\ControlsTest.tsx_.
3340

3441
#### SPFx application customizer
3542

36-
This extension is called *TestApplicationCustomizer*. To test it, go to the following URL (after updating the parameters):
43+
This extension is called _TestApplicationCustomizer_. To test it, go to the following URL (after updating the parameters):
3744

3845
[https://[SHAREPOINT_SITE].sharepoint.com?loadSPFX=true&debugManifestsFile=https://localhost:4321/temp/manifests.js&customActions={"ca9eac70-7343-4972-88d6-672d50e9cf38":{"location":"ClientSideExtension.ApplicationCustomizer"}}](https://SHAREPOINT_SITE.sharepoint.com?loadSPFX=true&debugManifestsFile=https://localhost:4321/temp/manifests.js&customActions={"ca9eac70-7343-4972-88d6-672d50e9cf38":{"location":"ClientSideExtension.ApplicationCustomizer"}})
3946

40-
To update the host component, open the *TestApp* React component located in the following project's relative path: *src\extensions\testApp\TestApp.tsx*.
47+
To update the host component, open the _TestApp_ React component located in the following project's relative path: _src\extensions\testApp\TestApp.tsx_.
4148

4249
#### SPFx form customizer
4350

44-
This extension is called *TestForm*. To test it, you have to configure it first:
51+
This extension is called _TestForm_. To test it, you have to configure it first:
4552

46-
1. Open the *serve.json* file (located in the *config* folder)
53+
1. Open the _serve.json_ file (located in the _config_ folder)
4754
2. Replace the `rootFolder` property (under `serveConfigurations` ==> `default` ==> `formCustomizer`), which contains a server relative URL, to target the list on which you want to test the extension
4855

4956
Then go to the following URL (after updating the parameters):
5057

5158
[https://[SHAREPOINT_SITE].sharepoint.com/_layouts/15/SPListForm.aspx?debugManifestsFile=https://localhost:4321/temp/manifests.js&loadSPFX=true&componentId=f9c6b930-8d5d-4550-bfd9-ed5f6ca443a8&PageType=8&RootFolder=[OPTIONAL_SERVER_RELATIVE_URL]/Lists/[LIST_NAME]](https://SHAREPOINT_SITE.sharepoint.com/_layouts/15/SPListForm.aspx?debugManifestsFile=https://localhost:4321/temp/manifests.js&loadSPFX=true&componentId=f9c6b930-8d5d-4550-bfd9-ed5f6ca443a8&PageType=8&RootFolder=OPTIONAL_SERVER_RELATIVE_URL/Lists/LIST_NAME)
5259

53-
To update the host component, open the *TestForm* React component located in the following project's relative path: *src\extensions\testForm\components\TestForm.tsx*.
60+
To update the host component, open the _TestForm_ React component located in the following project's relative path: _src\extensions\testForm\components\TestForm.tsx_.
5461

5562
### Documentation
5663

57-
SharePoint Framework React Controls uses [MkDocs](http://www.mkdocs.org) to publish documentation pages. See more information about installing MkDocs on your operating system at http://www.mkdocs.org/#installation.
64+
SharePoint Framework React Controls uses [MkDocs](http://www.mkdocs.org) to publish documentation pages. See more information about installing MkDocs on your operating system at <http://www.mkdocs.org/#installation>.
5865

59-
Also, documentation uses custom MkDocs theme that should be installed as well. See [Material theme for MkDocs](https://squidfunk.github.io/mkdocs-material/).
66+
Also, documentation uses custom MkDocs theme that should be installed as well. See [Material theme for MkDocs](https://squidfunk.github.io/mkdocs-material/). Currently, documentation is working with version 3.1.0.
6067

6168
Once you have MkDocs installed on your machine, in the command line:
6269

src/extensions/testApp/TestApplicationCustomizer.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
BaseApplicationCustomizer, PlaceholderContent, PlaceholderName
66
} from '@microsoft/sp-application-base';
77

8-
import * as strings from 'TestApplicationCustomizerStrings';
98
import TestApp, { ITestAppProps as ITestAppProps } from './TestApp';
109

1110
const LOG_SOURCE: string = 'TestApplicationCustomizer';
@@ -27,7 +26,7 @@ export default class TestApplicationCustomizer
2726
private _topPlaceHolder: PlaceholderContent | undefined;
2827

2928
public onInit(): Promise<void> {
30-
Log.info(LOG_SOURCE, `Initialized ${strings.Title}`);
29+
Log.info(LOG_SOURCE, `Initialized TestApplicationCustomizer`);
3130

3231
this.context.placeholderProvider.changedEvent.add(this, this._renderPlaceHolders);
3332

src/extensions/testApp/loc/en-us.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/extensions/testApp/loc/myStrings.d.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/extensions/testForm/loc/en-us.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/extensions/testForm/loc/myStrings.d.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/webparts/controlsTest/ControlsTestWebPart.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import * as React from 'react';
22
import * as ReactDom from 'react-dom';
33

4-
import * as strings from 'ControlsTestWebPartStrings';
5-
64
import {
75
IReadonlyTheme,
86
ThemeChangedEventArgs,
@@ -135,11 +133,11 @@ export default class ControlsTestWebPart extends BaseClientSideWebPart<IControls
135133
pages: [
136134
{
137135
header: {
138-
description: strings.PropertyPaneDescription
136+
description: 'Change settings below'
139137
},
140138
groups: [
141139
{
142-
groupName: strings.ControlSettingsGroupName,
140+
groupName: 'Control Settings',
143141
groupFields: [
144142
PropertyPaneTextField('title', {
145143
label: 'Web Part Title'
@@ -179,7 +177,7 @@ export default class ControlsTestWebPart extends BaseClientSideWebPart<IControls
179177
]
180178
},
181179
{
182-
groupName: strings.ControlsGroupName,
180+
groupName: 'Controls',
183181
groupFields: [
184182
new PropertyPaneControlToggles('controlVisibility', {
185183
controlVisibility: this.properties.controlVisibility,

src/webparts/controlsTest/components/ControlsTest.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ import { IPersonaProps, Toggle } from "@fluentui/react";
200200
import { ListItemComments } from "../../../ListItemComments";
201201
import { ViewPicker } from "../../../controls/viewPicker";
202202
import { GeneralHelper } from "../../../Utilities";
203-
203+
import { ListItemAttachments } from "../../../ListItemAttachments";
204204

205205

206206
// Used to render document card
@@ -971,6 +971,7 @@ export default class ControlsTest extends React.Component<IControlsTestProps, IC
971971
<div className={`${styles.row} ${styles.controlFiltersContainer}`}>
972972
<PrimaryButton text="Open Web Part Settings" iconProps={{ iconName: 'Settings' }} onClick={this.props.onOpenPropertyPane} />
973973
</div>
974+
<ListItemAttachments listId='e7a3ef63-70f6-4cc1-b95c-1f9eb8af2c8c' context={this.props.context} />
974975
</div>
975976
<div id="WebPartTitleDiv" className={styles.container} hidden={!controlVisibility.WebPartTitle}>
976977
<WebPartTitle displayMode={this.props.displayMode}

src/webparts/controlsTest/loc/en-us.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)