Skip to content

Commit

Permalink
Merge pull request #98 from estruyf/dev
Browse files Browse the repository at this point in the history
Merge for 1.11.0
  • Loading branch information
estruyf authored Mar 25, 2021
2 parents 71304a3 + 349ffca commit df8dc25
Show file tree
Hide file tree
Showing 29 changed files with 527 additions and 2,780 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,12 @@ jobs:
doctor publish -a password --username "${{ secrets.USERNAME }}" --password "${{ secrets.PASSWORD }}" -u "${{ secrets[matrix.siteUrl] }}" --retryWhenFailed --cleanQuickLaunch --cleanEnd --confirm $startClean $skipPages
env:
DEBUG: ${{ secrets.DEBUG }}
TRANSLATOR_KEY: ${{ secrets.TRANSLATOR_KEY }}


#############################################
### Publishing on Windows with PowerShell ###
############################################
#############################################
build_pwsh:
name: Build windows-latest - powershell
runs-on: windows-latest
Expand Down Expand Up @@ -143,6 +144,7 @@ jobs:
shell: powershell
env:
DEBUG: ${{ secrets.DEBUG }}
TRANSLATOR_KEY: ${{ secrets.TRANSLATOR_KEY }}


######################################
Expand Down Expand Up @@ -198,6 +200,7 @@ jobs:
shell: cmd
env:
DEBUG: ${{ secrets.DEBUG }}
TRANSLATOR_KEY: ${{ secrets.TRANSLATOR_KEY }}


##################################
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [1.11.0]


- [#89](https://github.com/estruyf/doctor/issues/89): [Enhancement]: Use Cognitive Service Translation API connection for machine translations
- [#90](https://github.com/estruyf/doctor/issues/90): [Enhancement]: Custom colors for callouts

## [1.10.0]


Expand Down
7 changes: 7 additions & 0 deletions changelog.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
{ "id": null, "title": "" }
]
},
{
"title": "1.11.0",
"updates": [
{ "id": 89, "title": "[Enhancement]: Use Cognitive Service Translation API connection for machine translations" },
{ "id": 90, "title": "[Enhancement]: Custom colors for callouts" }
]
},
{
"title": "1.10.0",
"updates": [
Expand Down
12 changes: 10 additions & 2 deletions cypress/integration/shortcodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ describe('Doctor shortcodes', function() {
it('4. Check if callout tip exists', () => {
cy.get(`.callout-tip`)
.should('exist')
.should("have.length", 2)
.should("have.length", 3)
.first()
.should('have.css', 'background-color', 'rgb(186, 216, 10)');

cy.get(`.callout-tip h5`)
.last()
.eq(1)
.should('contain.text', 'OVERRIDE THE TITLE');
});

Expand Down Expand Up @@ -72,4 +72,12 @@ describe('Doctor shortcodes', function() {
.should('contain.text', 'HTML: Content of the external shortcode');
});

it('9. check callout with custom background and foreground', () => {
cy.get(`.callout-tip`)
.should('exist')
.last()
.should('have.css', 'background-color', 'rgb(70, 39, 73)')
.should('have.css', 'color', 'rgb(253, 236, 239)');
});

});
25 changes: 25 additions & 0 deletions cypress/integration/translator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/// <reference types="cypress" />
/// <reference types="../support" />

describe('Multilingual validation', function() {
const PAGE_URL = "sitepages/doctor/nl/page-creation.aspx";

/**
* Before visiting SharePoint, we first need to authenticate
*/
before(() => {
cy.visitSP(PAGE_URL);
});

after(() => {
cy.screenshot();
});

it('1. Check if language selector is available on the page', () => {
cy.get(`[data-automation-id="LanguageSelector"]`).should('exist').should("contain.text", "Dutch");
});

it('2. Check if the page contains the right language contents', () => {
cy.get(`h2#page-creation`).should('exist');
});
});
6 changes: 6 additions & 0 deletions docs/content/changelog/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ description: The changelog of Doctor
type: docs-main
---

## [1.11.0]


- [#89](https://github.com/estruyf/doctor/issues/89): [Enhancement]: Use Cognitive Service Translation API connection for machine translations
- [#90](https://github.com/estruyf/doctor/issues/90): [Enhancement]: Custom colors for callouts

## [1.10.0]


Expand Down
37 changes: 35 additions & 2 deletions docs/content/docs/multilingual/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ Example setup:
"languages": [
1043
],
"overwriteTranslationsOnChange": true
"overwriteTranslationsOnChange": true,
"translator:" null
}
}
```
Expand Down Expand Up @@ -64,4 +65,36 @@ For the translation page, `home.nl.lang.md` in the above example, you should set

By default, SharePoint will copy the header settings from the source page. If you want to override these settings, you can add the same options as all other pages as long as you make sure `type: translation` is set for these pages.

> **Info**: Sample of how you can use multilingual with `doctor` has been provided in [https://github.com/estruyf/doctor-sample](https://github.com/estruyf/doctor-sample).
> **Info**: Sample of how you can use multilingual with `doctor` has been provided in [https://github.com/estruyf/doctor-sample](https://github.com/estruyf/doctor-sample).

## Using Azure Translator service

If you want to make use of the Azure Translator service which is part of the [Azure Cognitive Services](https://azure.microsoft.com/en-us/services/cognitive-services/) family. You will first need to create the translator service in your Azure tenant and provide the following config:

```json
{
"multilingual": {
"enableTranslations": true,
"languages": [
1043
],
"overwriteTranslationsOnChange": true,
"translator:" {
"key": "<subscription key>",
"endpoint": "https://api.cognitive.microsofttranslator.com/",
"region": "<region name, example: westeurope>"
}
}
}
```

### Automatically translate pages

When you want to make use of this APIs for page translations. All you need to do is specifying the `localization` property to its front matter of the page. In this case, you do not need to specify the path to the page. As the page will be translated on the fly.

```yaml
localization:
"nl-nl":
```

> **Info**: When you are going to run `doctor`. There will be `*.machinetranslated.md` pages created next to the parent page. This is done to not create any conflicts with the referenced pages and images. At the end of the process, `doctor` will remove these generated pages. During a `debug` run, they will not be removed.
25 changes: 23 additions & 2 deletions docs/content/docs/options/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,24 @@ You can provide the same flags and values like in the parameters. Parameters can
- **enableTranslations**: `boolean` - Specifies if you want to enable or disable multilingual features on the site. Default: `false`.
- **languages**: `number[]` - Locale IDs (or LCIDs) to enable on the site. An overview of the supported LCIDs for SharePoint can be found on [Supported LCIDs by SharePoint](https://github.com/pnp/PnP-PowerShell/wiki/Supported-LCIDs-by-SharePoint).
- **overwriteTranslationsOnChange**: `boolean` - Specify whether the changes made to user-specified text in the default language should automatically overwrite the existing translations made in all alternate languages.
- **translator**: `Translator` - This property allows you to specify the Azure Translator Cognitive Service. When Specified, you allow `doctor` to use the translator APIs to machine translate your pages.

Example:
Manual translation example:

```json
{
"multilingual": {
"enableTranslations": true,
"languages": [
1043
],
"overwriteTranslationsOnChange": true,
"translator:" null
}
}
```

Machine translation example:

```json
{
Expand All @@ -141,7 +157,12 @@ Example:
"languages": [
1043
],
"overwriteTranslationsOnChange": true
"overwriteTranslationsOnChange": true,
"translator:" {
"key": "<subscription key>",
"endpoint": "https://api.cognitive.microsofttranslator.com/",
"region": "<region name, example: westeurope>"
}
}
}
```
Expand Down
6 changes: 5 additions & 1 deletion docs/content/docs/shortcodes/callout/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Example:
<callout type="danger">The danger content</callout>

<callout type="tip" title="Override the title">Tip content with a custom title</callout>

<callout type="tip" title="Custom background and foreground color" bgColor=#462749" fgColor="#FDECEF">A callout to test the background and foreground colors.</callout>
```
The following HTML attributes are supported for the `callout`:
Expand All @@ -36,4 +38,6 @@ The following HTML attributes are supported for the `callout`:
- info
- caution
- danger
- **title**: Allows you to specify a custom callout title
- **title**: Allows you to specify a custom callout title
- **bgColor**: Allows you to specify a custom background color
- **fgColor**: Allows you to specify a custom foreground color
Binary file modified docs/content/docs/shortcodes/callout/assets/callouts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/data/upcomingVersion.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"title":"1.10.0","updates":[{"id":82,"title":"[Enhancement]: Allow comments to be disabled at global level"},{"id":83,"title":"[Enhancement]: New implementation of the retry logic"},{"id":84,"title":"[BUG]: Issue with skipping pages and multilingual"},{"id":85,"title":"[BUG]: Fix recording video bug in Cypress during tests"},{"id":95,"title":"[Enhancement]: Add test results to the documentation to gain a better view on how they perform"}]}
{"title":"1.11.0","updates":[{"id":89,"title":"[Enhancement]: Use Cognitive Service Translation API connection for machine translations"},{"id":90,"title":"[Enhancement]: Custom colors for callouts"}]}
2 changes: 1 addition & 1 deletion docs/layouts/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</div>
<div class="col-md-4 text-md-right text-center">
<ul class="list-inline">
<li class="list-inline-item align-middle"><img src="http://estruyf-github.azurewebsites.net/api/VisitorHit?user=estruyf&repo=doctor&countColor=%2324BAA4" /></li>
<li class="list-inline-item align-middle"><img src="https://estruyf-github.azurewebsites.net/api/VisitorHit?user=estruyf&repo=doctor&countColor=%2324BAA4" /></li>
{{ range .Site.Params.social }}
<li class="list-inline-item"><a class="text-color d-inline-block p-2" href="{{ .link | safeURL }}"><i class="{{ .icon }}"></i></a></li>
{{ end }}
Expand Down
Loading

1 comment on commit df8dc25

@vercel
Copy link

@vercel vercel bot commented on df8dc25 Mar 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.