Skip to content

Commit

Permalink
Merge pull request #19989 from newrelic/feat/french
Browse files Browse the repository at this point in the history
Feat/french
  • Loading branch information
akashreddy-nr authored Feb 19, 2025
2 parents e4a85b5 + 39a65e1 commit 2378417
Show file tree
Hide file tree
Showing 10 changed files with 264 additions and 15 deletions.
2 changes: 1 addition & 1 deletion gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ module.exports = {
},
i18n: {
translationsPath: `${__dirname}/src/i18n/translations`,
additionalLocales: LOCALES,
additionalLocales: ['jp', 'kr', 'pt', 'es'],
},
prism: {
languages: [
Expand Down
17 changes: 17 additions & 0 deletions scripts/actions/__tests__/add-files-to-translation-queue.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const MOCK_CONSTANTS = {
kr: 'ko-KR',
es: 'es-LA',
pt: 'pt-BR',
fr: 'fr-FR',
},
};

Expand Down Expand Up @@ -46,12 +47,14 @@ describe('add-files-to-translation-queue tests', () => {
'ko-KR': ['excluded/path'],
'es-LA': ['excluded/path'],
'pt-BR': ['excluded/path'],
'fr-FR': ['excluded/path'],
},
excludeType: {
'ja-JP': ['excludedType'],
'ko-KR': ['excludedType'],
'es-LA': ['excludedType'],
'pt-BR': ['excludedType'],
'fr-FR': ['excludedType'],
},
};
const originalAdd = jest.requireActual('../utils/constants.js');
Expand All @@ -77,6 +80,7 @@ describe('add-files-to-translation-queue tests', () => {
{ filename: '/content/bar.mdx', locale: 'ko-KR', project_id: 'MT_ID' },
{ filename: '/content/bar.mdx', locale: 'es-LA', project_id: 'MT_ID' },
{ filename: '/content/bar.mdx', locale: 'pt-BR', project_id: 'MT_ID' },
{ filename: '/content/bar.mdx', locale: 'fr-FR', project_id: 'MT_ID' },
]);
});

Expand All @@ -91,6 +95,7 @@ describe('add-files-to-translation-queue tests', () => {
{ filename: '/content/bar.mdx', locale: 'ko-KR', project_id: 'MT_ID' },
{ filename: '/content/bar.mdx', locale: 'es-LA', project_id: 'MT_ID' },
{ filename: '/content/bar.mdx', locale: 'pt-BR', project_id: 'MT_ID' },
{ filename: '/content/bar.mdx', locale: 'fr-FR', project_id: 'MT_ID' },
]);
});

Expand Down Expand Up @@ -137,6 +142,11 @@ describe('add-files-to-translation-queue tests', () => {
locale: 'pt-BR',
project_id: 'MT_ID',
},
{
filename: '/content/bar.mdx',
locale: 'fr-FR',
project_id: 'MT_ID',
},
]);
});

Expand All @@ -146,6 +156,7 @@ describe('add-files-to-translation-queue tests', () => {
{ filename: 'included/path/content/foo.mdx', locale: 'ko-KR' },
{ filename: 'included/path/content/bar.mdx', locale: 'es-LA' },
{ filename: 'included/path/content/foo.mdx', locale: 'pt-BR' },
{ filename: 'included/path/content/foo.mdx', locale: 'fr-FR' },
];
setup();
const { excludeFiles } = require('../add-files-to-translation-queue');
Expand All @@ -157,6 +168,7 @@ describe('add-files-to-translation-queue tests', () => {
{ filename: 'included/path/content/foo.mdx', locale: 'ko-KR' },
{ filename: 'included/path/content/bar.mdx', locale: 'es-LA' },
{ filename: 'included/path/content/foo.mdx', locale: 'pt-BR' },
{ filename: 'included/path/content/foo.mdx', locale: 'fr-FR' },
]);
});

Expand Down Expand Up @@ -236,6 +248,11 @@ describe('add-files-to-translation-queue tests', () => {
contentType: 'doc',
locale: 'ja-JP',
},
{
filename: 'excluded/path/content/bar.mdx',
contentType: 'doc',
locale: 'fr-FR',
},
];
setup();

Expand Down
1 change: 1 addition & 0 deletions scripts/actions/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const LOCALE_IDS = {
kr: 'ko-KR',
es: 'es-LA',
pt: 'pt-BR',
fr: 'fr-FR',
};

const LOCALES = Object.keys(LOCALE_IDS);
Expand Down
26 changes: 26 additions & 0 deletions scripts/actions/utils/docs-content-tools/i18n-exclusions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,34 @@ excludePath:
- src/content/docs/apm/agents/net-agent/getting-started/net-agent-eol-policy.mdx
- src/content/docs/new-relic-solutions/build-nr-ui/sdk-component

fr-FR:
- src/announcements
- src/content/eol
- src/content/whats-new
- src/content/docs/release-notes
- src/content/docs/licenses
- src/content/docs/style-guide
- src/content/docs/agile-handbook
- src/data-dictionary
- src/i18n
- src/content/docs/security/security-privacy/data-privacy
- src/content/docs/security/security-privacy/compliance
- scripts/actions/__tests__/kitchen-sink.mdx
- src/install
- src/content/docs/mdx-test-page
- src/content/docs/apm/agents/go-agent/get-started/go-agent-eol-policy.mdx
- src/content/docs/apm/agents/java-agent/getting-started/java-agent-eol-policy.mdx
- src/content/docs/infrastructure/infrastructure-monitoring/get-started/infrastructure-agent-eol-policy.mdx
- src/content/docs/apm/agents/ruby-agent/getting-started/ruby-agent-eol-policy.mdx
- src/content/docs/apm/agents/nodejs-agent/getting-started/nodejs-agent-eol-policy.mdx
- src/content/docs/browser/browser-monitoring/getting-started/browser-agent-eol-policy.mdx
- src/content/docs/apm/agents/php-agent/getting-started/php-agent-eol-policy.mdx
- src/content/docs/apm/agents/net-agent/getting-started/net-agent-eol-policy.mdx
- src/content/docs/new-relic-solutions/build-nr-ui/sdk-component

excludeType:
ja-JP:
ko-KR:
es-LA:
pt-BR:
fr-FR:
35 changes: 22 additions & 13 deletions scripts/i18n_utility/__tests__/actions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,18 +171,18 @@ describe('actions tests', () => {
* Every 4 Booleans represents mocking if the file exists and therefore should be renamed or skipped for those locale paths
*/
[
// doc[0]: jp renamed, kr renamed, es renamed, pt renamed
true, true, true, true,
// doc[1]: jp renamed, kr skipped, es skipped, pt skipped
true, false, false, false,
// doc[2]: jp skipped, kr renamed, es skipped, pt skipped
false, true, false, false,
// doc[3]: jp skipped, kr skipped, es renamed, pt skipped
false, false, true, false,
// doc[4]: jp skipped, kr skipped, es skipped, pt renamed
false, false, false, true,
// doc[5]: jp skipped, kr skipped, es skipped, pt skipped
false, false, false, false,
// doc[0]: jp renamed, kr renamed, es renamed, pt renamed, fr renamed
true, true, true, true, true,
// doc[1]: jp renamed, kr skipped, es skipped, pt skipped, fr skipped
true, false, false, false, false,
// doc[2]: jp skipped, kr renamed, es skipped, pt skipped, fr skipped
false, true, false, false, false,
// doc[3]: jp skipped, kr skipped, es renamed, pt skipped, fr skipped
false, false, true, false, false,
// doc[4]: jp skipped, kr skipped, es skipped, pt renamed, fr skipped
false, false, false, true, false,
// doc[5]: jp skipped, kr skipped, es skipped, pt skipped, fr renamed
false, false, false, false, true,
].forEach(
(returnValue) => {
mockFs.existsSync.mockReturnValueOnce(returnValue);
Expand All @@ -191,7 +191,7 @@ describe('actions tests', () => {

const result = Actions.getRenameChanges(input);

expect(result.length).toBe(8);
expect(result.length).toBe(10);
expect(result).toStrictEqual([
{
from:
Expand All @@ -213,6 +213,11 @@ describe('actions tests', () => {
'src/i18n/content/pt/docs/accounts/accounts-billing/account-setup/choose-your-data-center.mdx',
to: 'src/i18n/content/pt/docs/choose-your-data-center.mdx',
},
{
from:
'src/i18n/content/fr/docs/accounts/accounts-billing/account-setup/choose-your-data-center.mdx',
to: 'src/i18n/content/fr/docs/choose-your-data-center.mdx',
},
{
from:
'src/i18n/content/jp/docs/apm/agents/c-sdk/get-started/images/c-apm-summary.png',
Expand All @@ -235,6 +240,10 @@ describe('actions tests', () => {
from: 'src/i18n/content/pt/docs/apm/auspicious-petite-moth.mdx',
to: 'src/i18n/content/pt/docs/apm/aesthetic-purple-moon.mdx',
},
{
from: 'src/i18n/content/fr/docs/apm/errors-inbox/errors-inbox-ui.mdx',
to: 'src/i18n/content/fr/docs/apm/errors-inbox-ui.mdx',
},

]);
});
Expand Down
5 changes: 4 additions & 1 deletion src/components/EolPage.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { format, isAfter, isSameDay, parseISO } from 'date-fns';
import { ja, ko, es, ptBR } from 'date-fns/locale';
import { ja, ko, es, ptBR, fr } from 'date-fns/locale';
import { useStaticQuery, graphql } from 'gatsby';
import { compareVersions } from 'compare-versions';
import getAgentName from '../utils/getAgentName.js';
Expand Down Expand Up @@ -65,6 +65,9 @@ const EolPage = ({ agent, locale = 'en' }) => {
if (locale === 'pt') {
return format(date, 'PPP', { locale: ptBR });
}
if (locale === 'fr') {
return format(date, 'PPP', { locale: fr });
}
return format(date, 'PP');
};

Expand Down
46 changes: 46 additions & 0 deletions src/components/FrNav.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import React from 'react';
import Navigation from './Navigation';
import { useStaticQuery, graphql } from 'gatsby';

const FrNav = ({ className }) => {
const { nav } = useStaticQuery(frQuery);
return <Navigation nav={nav} className={className} />;
};

const frQuery = graphql`
query {
nav(slug: "/") {
id
title(locale: "fr")
url
filterable
pages {
...MainLayout_navPagesfr
pages {
...MainLayout_navPagesfr
pages {
...MainLayout_navPagesfr
pages {
...MainLayout_navPagesfr
pages {
...MainLayout_navPagesfr
pages {
...MainLayout_navPagesfr
}
}
}
}
}
}
}
}
fragment MainLayout_navPagesfr on NavItem {
title(locale: "fr")
url
icon
label
}
`;

export default FrNav;
2 changes: 2 additions & 0 deletions src/components/InlinePopover/InlinePopover.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import jpJson from '../../data/popovers_jp.json';
import krJson from '../../data/popovers_kr.json';
import esJson from '../../data/popovers_es.json';
import ptJson from '../../data/popovers_pt.json';
import frJson from '../../data/popovers_fr.json';

import { TwoButton } from './layouts';

Expand All @@ -26,6 +27,7 @@ const InlinePopover = ({ type }) => {
if (locale === 'jp') return jpJson;
if (locale === 'es') return esJson;
if (locale === 'pt') return ptJson;
if (locale === 'fr') return frJson;
return enJson;
})();

Expand Down
2 changes: 2 additions & 0 deletions src/components/RootNavigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import JpNav from './JpNav';
import EsNav from './EsNav';
import PtNav from './PtNav';
import EnNav from './EnNav';
import FrNav from './FrNav';
import StyleGuideNav from './StyleGuideNav';

const RootNavigation = ({ locale, className, isStyleGuide }) => {
Expand All @@ -13,6 +14,7 @@ const RootNavigation = ({ locale, className, isStyleGuide }) => {
en: <EnNav className={className} />,
es: <EsNav className={className} />,
pt: <PtNav className={className} />,
fr: <FrNav className={className} />,
};
if (isStyleGuide) {
return <StyleGuideNav className={className} />;
Expand Down
Loading

0 comments on commit 2378417

Please sign in to comment.