Skip to content

Commit

Permalink
Merge pull request #5233 from newrelic/clang/mt-disclaimer
Browse files Browse the repository at this point in the history
Add machine translation disclaimer
  • Loading branch information
roadlittledawn committed Dec 10, 2021
2 parents 6560a3b + a61585c commit 68f2949
Show file tree
Hide file tree
Showing 10 changed files with 139 additions and 6 deletions.
11 changes: 11 additions & 0 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
frontmatter {
type
subject
translationType
}
}
}
Expand Down Expand Up @@ -291,8 +292,12 @@ exports.createSchemaCustomization = ({ actions }) => {
type MarkdownRemark implements Node {
frontmatter: Frontmatter
}
type Mdx implements Node {
frontmatter: Frontmatter
}
type Frontmatter {
isFeatured: Boolean
translationType: String
}
`;

Expand Down Expand Up @@ -321,6 +326,12 @@ exports.createResolvers = ({ createResolvers }) => {
resolve: (source) =>
hasOwnProperty(source, 'isFeatured') ? source.isFeatured : false,
},
translationType: {
resolve: (source) =>
hasOwnProperty(source, 'translationType')
? source.translationType
: null,
},
},
});
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"@github-docs/frontmatter": "^1.3.1",
"@mdx-js/mdx": "^2.0.0-next.8",
"@mdx-js/react": "^2.0.0-next.8",
"@newrelic/gatsby-theme-newrelic": "^3.3.4",
"@newrelic/gatsby-theme-newrelic": "^4.1.6",
"@splitsoftware/splitio-react": "^1.2.4",
"babel-jest": "^26.3.0",
"common-tags": "^1.8.0",
Expand Down
7 changes: 7 additions & 0 deletions src/@newrelic/gatsby-theme-newrelic/icons/feather.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,13 @@ export default {
folder: (
<path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z" />
),
globe: (
<>
<circle cx="12" cy="12" r="10" />
<line x1="2" y1="12" x2="22" y2="12" />
<path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z" />
</>
),
'help-circle': (
<>
<circle cx="12" cy="12" r="10" />
Expand Down
76 changes: 76 additions & 0 deletions src/components/MachineTranslationCallout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import React from 'react';
import PropTypes from 'prop-types';
import { css } from '@emotion/react';
import {
Callout,
CreateIssueButton,
Icon,
Trans,
useTranslation,
Link,
} from '@newrelic/gatsby-theme-newrelic';

const MachineTranslationCallout = ({ englishHref }) => {
const { t } = useTranslation();
return (
<Callout
variant="important"
title=" "
css={css`
margin: 2em 0;
padding: 0.5em;
`}
>
<div
css={css`
display: flex;
align-items: center;
> * {
margin: 0 1em;
}
@media screen and (max-width: 1240px) {
flex-direction: column;
align-items: flex-start;
> * {
margin: 1em 0;
}
> :last-child {
align-self: flex-end;
}
}
`}
>
<Icon name="globe" size="2em" />
<div>
<h4>{t('machineTranslation.calloutHeading')}</h4>
<Trans i18nKey="machineTranslation.calloutBody" parent="p">
In the event of any inconsistency between the English version and
the translated version, the{' '}
<Link to={englishHref} shouldAutoLocalize={false}>
English version
</Link>
shall prevail. Please visit{' '}
<Link to="/docs/licenses/translated-documentation/translation-disclaimer/">
this page
</Link>{' '}
for more information.
</Trans>
</div>
<CreateIssueButton
variant="outline"
css={css`
border-color: #8a7800;
`}
labels={['i18n']}
instrumentation={{ component: 'MachineTranslationCallout' }}
/>
</div>
</Callout>
);
};

MachineTranslationCallout.propTypes = {
englishHref: PropTypes.string.isRequired,
};

export default MachineTranslationCallout;
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: Translation disclaimer
tags:
- Licenses
- License information
- Translation
metaDescription: 'Information about translations of New Relic documents'
---

The official version of the Documentation is in English. Portions of the New Relic Documentation may be translated for your convenience as shown on this site.

Translated content may contain errors, discrepancies, or differences created in the translation, are not binding, and have no legal effect for enforcement or compliance purposes. New Relic does not make any warranty, express or implied, as to the accuracy, reliability, or correctness of any translated Documentation from the English original to any other language.

Any guarantees or commitments in your Agreement with New Relic that the Services, products, or other offerings conform or are consistent with the Documentation do not apply to the extent to which the Documentation has been translated.
4 changes: 4 additions & 0 deletions src/i18n/translations/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,5 +180,9 @@
"filter": {
"placeholder": "Filter navigation"
}
},
"machineTranslation": {
"calloutHeading": "This machine translation is provided for your convenience.",
"calloutBody": "In the event of any inconsistency between the English version and the translated version, the <2>English version</2> shall prevail. Please visit <4>this page</4> for more information."
}
}
4 changes: 4 additions & 0 deletions src/i18n/translations/jp/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,5 +170,9 @@
"filter": {
"placeholder": "ナビゲーションの絞り込み"
}
},
"machineTranslation": {
"calloutHeading": "本書は、お客様のご参考のために原文の英語版を機械翻訳したものです。",
"calloutBody": "英語版と齟齬がある場合、<2>英語版</2>の定めが優先するものとします。より詳しい情報については、<5>本リンク</5>をご参照ください。"
}
}
4 changes: 4 additions & 0 deletions src/nav/licenses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,7 @@ pages:
path: /docs/licenses/license-information/referenced-policies/service-level-availability-commitment
- title: Pre-release policy
path: /docs/licenses/license-information/referenced-policies/new-relic-pre-release-policy
- title: Translated documentation
pages:
- title: Translation disclaimer
path: /docs/licenses/translated-documentation/translation-disclaimer
15 changes: 14 additions & 1 deletion src/templates/docPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
TableOfContents,
useTranslation,
} from '@newrelic/gatsby-theme-newrelic';
import MachineTranslationCallout from '../components/MachineTranslationCallout';
import DefaultRelatedContent from '../components/DefaultRelatedContent';
import SEO from '../components/SEO';
import GithubSlugger from 'github-slugger';
Expand Down Expand Up @@ -62,7 +63,7 @@ const BasicDoc = ({ data, location, pageContext }) => {
}, [mdxAST, moreHelpHeading, t]);

const isMobileScreen = useMedia('(max-width: 1240px)');
const { title, metaDescription, type, tags } = frontmatter;
const { title, metaDescription, type, tags, translationType } = frontmatter;

return (
<>
Expand All @@ -78,21 +79,32 @@ const BasicDoc = ({ data, location, pageContext }) => {
css={css`
display: grid;
grid-template-areas:
'mt-disclaimer mt-disclaimer'
'page-title page-title'
'content page-tools';
grid-template-columns: minmax(0, 1fr) 320px;
grid-column-gap: 2rem;
@media screen and (max-width: 1240px) {
grid-template-areas:
'mt-disclaimer'
'page-title'
'content'
'page-tools';
grid-template-columns: minmax(0, 1fr);
}
`}
>
{translationType === 'machine' && (
<MachineTranslationCallout
englishHref={location.pathname.replace(
`/${pageContext.locale}`,
''
)}
/>
)}
<PageTitle>{title}</PageTitle>

<Layout.Content>
<MDXContainer body={body}>
{moreHelpHeading ? null : <DefaultRelatedContent />}
Expand Down Expand Up @@ -143,6 +155,7 @@ export const pageQuery = graphql`
metaDescription
type
tags
translationType
}
fields {
fileRelativePath
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1975,10 +1975,10 @@
eslint-plugin-promise "^4.2.1"
eslint-plugin-react "^7.14.3"

"@newrelic/gatsby-theme-newrelic@^3.3.4":
version "3.3.4"
resolved "https://registry.yarnpkg.com/@newrelic/gatsby-theme-newrelic/-/gatsby-theme-newrelic-3.3.4.tgz#b55651187f8bf14afd63c63a7370bb6f83c36b3c"
integrity sha512-J4nG32qiduqctZrTsoEG1fRQvs7KxI8W7Vza8YjhwcpLVUdKt13LS9s0pP6BbZBHmOXHy9SXSCA37wPvtQ6REA==
"@newrelic/gatsby-theme-newrelic@^4.1.6":
version "4.1.6"
resolved "https://registry.yarnpkg.com/@newrelic/gatsby-theme-newrelic/-/gatsby-theme-newrelic-4.1.6.tgz#1687dc086bc362ee42fb66a72aefdf873ac6828f"
integrity sha512-q6R9R/UYmO5dv47zwVbZgoea3NhQQzMKc37H7GssXjjR0RY2ekvzFYjIH/GTJzPTq2rlUxSYdFW++jCqfEYIWQ==
dependencies:
"@wry/equality" "^0.4.0"
"@xstate/react" "^1.3.1"
Expand Down

0 comments on commit 68f2949

Please sign in to comment.