diff --git a/content/asciidoc-pages/docs/faq/index.de.adoc b/content/asciidoc-pages/docs/faq/index.de.adoc index 17dbff071..35d540fcf 100644 --- a/content/asciidoc-pages/docs/faq/index.de.adoc +++ b/content/asciidoc-pages/docs/faq/index.de.adoc @@ -1,5 +1,6 @@ = Frequently Asked Questions :page-authors: gdams, HanSolo, sw-fox, aumann, hendrikebbers +:page-based-on: 56f8f9b0dd04a8cadd21fa9b68ee86430949c0b7 Auf dieser Seite haben wir versucht häufig gestellte Fragen (FAQs) für die Community zu beantworten. Alle weiteren Fragen können jederzeit gerne in unsere https://adoptium.net/slack.html[Slack-Channel] gestellt diff --git a/content/asciidoc-pages/docs/faq/index.es.adoc b/content/asciidoc-pages/docs/faq/index.es.adoc index b8db6f89c..99f8eeed2 100644 --- a/content/asciidoc-pages/docs/faq/index.es.adoc +++ b/content/asciidoc-pages/docs/faq/index.es.adoc @@ -1,5 +1,6 @@ = Frequently Asked Questions :page-authors: eddumelendez, czelabueno, jdluna, raulmj, tellison, gdams +:page-based-on: 50dc526fadcdd7dd03b386f112ac1ab4043bb554 Hemos reunido unas cuantas preguntas frecuentes (FAQs) en este documento. Si quieres conversar con nosotros sobre estos tópicos, o realizar preguntas adicionales @@ -22,6 +23,8 @@ action, y parte del soporte de Java de los proveedores de la nube. Los instaladores de Linux están disponibles en packages.adoptium.net. Para más información ver link:/installation/linux[esta guía]. +== ¿Temurin(TM) es de uso gratuito? + Sí. Los binarios de Eclipse Temurin son proporcionados para su uso sin ningún costo por Adoptium, por siempre, bajo los términos de la "GNU General Public License, version 2 with the Classpath Exception". Usted puede utilizar, modificar y compartir libremente el código como se describe en las licencias incluidas en la descarga. diff --git a/content/asciidoc-pages/docs/faq/index.zh-CN.adoc b/content/asciidoc-pages/docs/faq/index.zh-CN.adoc index 94a5bdb1d..57e2ca5dc 100644 --- a/content/asciidoc-pages/docs/faq/index.zh-CN.adoc +++ b/content/asciidoc-pages/docs/faq/index.zh-CN.adoc @@ -1,5 +1,6 @@ = Frequently Asked Questions :page-authors: zdtsw, gdams, tellison +:page-based-on: 50dc526fadcdd7dd03b386f112ac1ab4043bb554 在该文件中,我们收集了一些常见问题。如果您想讨论这些话题或有其他问题,最佳途径是通过以下链接 https://adoptium.net/slack.html[Slack] 或者在 diff --git a/content/asciidoc-pages/docs/first-timer-support/index.de.adoc b/content/asciidoc-pages/docs/first-timer-support/index.de.adoc index 42b6922d4..0cf83d410 100644 --- a/content/asciidoc-pages/docs/first-timer-support/index.de.adoc +++ b/content/asciidoc-pages/docs/first-timer-support/index.de.adoc @@ -1,12 +1,12 @@ = Eclipse Adoptium(R) First Timers Support :page-authors: gdams, HanSolo, hendrikebbers, tellison +:page-based-on: 50dc526fadcdd7dd03b386f112ac1ab4043bb554 :description: Support with first time contributions :keywords: adoptium documentation contribute first-time -:lang: en :icons: font -Wir bei Adoptium(R) wollen Menschen helfen, in OpenSource, Java und die Java Community einzusteigen. +Wir bei Adoptium wollen Menschen unterstützen, in OpenSource, Java und die Java Community einzusteigen. Deshalb ist es für uns wichtig, Menschen, die mit OpenSource arbeiten wollen, zu unterstützen. [NOTE] diff --git a/content/asciidoc-pages/docs/migration/index.de.adoc b/content/asciidoc-pages/docs/migration/index.de.adoc index fc0a568cb..b9bd0b0fe 100644 --- a/content/asciidoc-pages/docs/migration/index.de.adoc +++ b/content/asciidoc-pages/docs/migration/index.de.adoc @@ -1,5 +1,6 @@ = Migration Guide :page-authors: gdams, HanSolo, MBoegers, hendrikebbers, ojuschugh1 +:page-based-on: e0bae585804689459af34ceecc98fe74e8cfc3d6 :icons: font == Migration zu Eclipse Temurin diff --git a/content/asciidoc-pages/docs/qvs-policy/index.de.adoc b/content/asciidoc-pages/docs/qvs-policy/index.de.adoc index f090bfd63..962f40d74 100644 --- a/content/asciidoc-pages/docs/qvs-policy/index.de.adoc +++ b/content/asciidoc-pages/docs/qvs-policy/index.de.adoc @@ -4,6 +4,7 @@ :orgname: Eclipse Adoptium :lang: en :page-authors: gdams, HanSolo +:page-based-on: 50dc526fadcdd7dd03b386f112ac1ab4043bb554 == Überblick diff --git a/gatsby-node.js b/gatsby-node.js index 2a2b669a7..3aa2711f1 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -2,6 +2,8 @@ const crypto = require('crypto') const path = require('path') const fetch = require('node-fetch') const fs = require('fs') +const util = require('node:util') +const exec = util.promisify(require('node:child_process').exec) const { pipeline } = require('stream') const { promisify } = require('util') const { createFilePath } = require('gatsby-source-filesystem') @@ -87,7 +89,7 @@ exports.sourceNodes = async ({ actions, createNodeId }) => { createNode(MostRecentFeatureVersion) } -exports.onCreatePage = ({ page, actions }) => { +exports.onCreatePage = ({ page, actions, getNodes }) => { const { createPage, deletePage } = actions // Delete pages such as /about/index.de @@ -109,9 +111,12 @@ exports.onCreatePage = ({ page, actions }) => { : `${locales[lang].path}${page.path}` let locale = 'en' + let defaultGitSHA if (fs.existsSync(`./content/asciidoc-pages${page.path}index.${lang}.adoc`)) { locale = lang + // fetch fields.gitSHA from the default language file + defaultGitSHA = getNodes().find(n => n.fields && n.fields.slug === page.path).fields.gitSHA || null } return createPage({ @@ -126,6 +131,7 @@ exports.onCreatePage = ({ page, actions }) => { context: { ...page.context, locale, + defaultGitSHA, language: lang, i18n: { ...page.context.i18n, @@ -168,6 +174,17 @@ exports.onCreateNode = async ({ node, actions, getNode, getNodes }) => { // Find the key that has "default: true" set (in this case it returns "en") const defaultKey = findKey(locales, o => o.default === true) + if (isDefault) { + // Get Git SHA of the last commit to the file and add it as a field + const gitLastCommitCMD = `git log -1 --format=%H ${fetchFilePath.absolutePath}` + const { stdout, stderr } = await exec(gitLastCommitCMD) + if (stderr) { + console.error(stderr) + } + const gitLastCommit = stdout.trim() || null + gitLastCommit && createNodeField({ node, name: 'gitSHA', value: gitLastCommit }) + } + // Files are defined with "name-with-dashes.lang.adoc" // name returns "name-with-dashes.lang" // So grab the lang from that string diff --git a/locales/de/asciidoc.json b/locales/de/asciidoc.json new file mode 100644 index 000000000..bc4a4d631 --- /dev/null +++ b/locales/de/asciidoc.json @@ -0,0 +1,4 @@ +{ + "asciidoc.template.warn.default.locale": "Dies ist die englische Version der Seite, da aktuell noch keine deutsche Übersetzung verfügbar ist. Du kannst uns helfen diese Seite in deutsch bereitzustellen. In unserem Leitfaden zu Übersetzungen findest du mehr Informationen.", + "asciidoc.template.warn.outdated": "Die deutsche Übersetzung dieser Seite basiert auf einem nicht mehr aktuellen englischen Text. Daher ist es Möglich, dass Teile des Textes nicht mehr zutreffen. Du kannst helfen die Seite aktuell zu halten und eine überarbeitete Übersetzung der aktuellen englischen Seite/lastEnglishVersionLink> bereitzustellen. In unserem Leitfaden zu Übersetzungen findest du mehr Informationen." +} \ No newline at end of file diff --git a/locales/es/asciidoc.json b/locales/es/asciidoc.json new file mode 100644 index 000000000..0b811299b --- /dev/null +++ b/locales/es/asciidoc.json @@ -0,0 +1,4 @@ +{ + "asciidoc.template.warn.default.locale": "Esta página es la versión en inglés porque no está disponible en su idioma. Por favor, ayudenos traduciendo esta página a su idioma. Para más información, visite nuestra guía de traducción", + "asciidoc.template.warn.outdated": "La traducción de esta página está basada en una versión anterior de la página en inglés y puede no ser exacta. Por favor, ayúdenos actualizando esta página para que coincida con la última versión de la pagina en inglés. Para más información, visite nuestra guía de traducción." +} diff --git a/locales/fr/asciidoc.json b/locales/fr/asciidoc.json new file mode 100644 index 000000000..b6acd846c --- /dev/null +++ b/locales/fr/asciidoc.json @@ -0,0 +1,4 @@ +{ + "asciidoc.template.warn.default.locale": "Cette page est la version en anglais car elle n'existe pas dans votre langue. Aidez-nous à la traduire en français. Consultez notre guide de traduction pour plus d'informations.", + "asciidoc.template.warn.outdated": "Cette page est la version en anglais car elle n'existe pas dans votre langue. Aidez-nous à traduire la dernière version en anglais. Consultez notre guide de traduction pour plus d'informations." +} \ No newline at end of file diff --git a/src/templates/__tests__/asciidoc.test.tsx b/src/templates/__tests__/asciidoc.test.tsx index ecf4b387d..2322a3986 100644 --- a/src/templates/__tests__/asciidoc.test.tsx +++ b/src/templates/__tests__/asciidoc.test.tsx @@ -6,10 +6,15 @@ import { axe } from 'vitest-axe'; import { createAsciidocData } from '../../__fixtures__/page'; let mockData = createAsciidocData(); +const pageContext = { + locale: 'en', + defaultGitSHA: '1234567890', +} + describe('Asciidoc pages', () => { it('renders correctly', () => { - const { container } = render(); + const { container } = render(); // eslint-disable-next-line const pageContent = container.querySelector('main'); @@ -25,7 +30,7 @@ describe('Asciidoc pages', () => { it('renders correctly - installation slug', () => { mockData.asciidoc.fields.slug = '/installation/'; - const { container } = render(); + const { container } = render(); // eslint-disable-next-line const pageContent = container.querySelector('main'); @@ -33,8 +38,50 @@ describe('Asciidoc pages', () => { }); it('has no accessibility violations', async () => { - const { container } = render(); + const { container } = render(); const results = await axe(container); expect(results).toHaveNoViolations(); }); + + it('renders correctly - no warning when translation is up-to-date', () => { + let customMockData = createAsciidocData(); + customMockData.asciidoc.pageAttributes.based_on = '1234567890'; + + let customPageContext = { + locale: 'fr', + language: 'fr', + defaultGitSHA: '1234567890', + } + + const { container } = render(); + + expect(container.getElementsByClassName('alert-warning').length).toBe(0); + }); + + it('renders correctly - display warning when translation is outdated', () => { + let customMockData = createAsciidocData(); + customMockData.asciidoc.pageAttributes.based_on = '0987654321'; + + let customPageContext = { + locale: 'fr', + language: 'fr', + defaultGitSHA: '1234567890', + } + + const { container } = render(); + + expect(container.getElementsByClassName('alert-warning').length).toBe(1); + }); + + it('renders correctly - display warning when translation is the default one', () => { + let customPageContext = { + locale: 'en', + language: 'fr', + defaultGitSHA: '1234567890', + } + + const { container } = render(); + + expect(container.getElementsByClassName('alert-warning').length).toBe(1); + }); }); \ No newline at end of file diff --git a/src/templates/asciidocTemplate.tsx b/src/templates/asciidocTemplate.tsx index 23cfd8a45..3e5eff6a5 100644 --- a/src/templates/asciidocTemplate.tsx +++ b/src/templates/asciidocTemplate.tsx @@ -9,11 +9,13 @@ import EditLink from '../components/EditLink' import AuthorsList from '../components/AuthorList' import InstallTabs from '../components/InstallTabs' import Seo from '../components/Seo' +import { Trans } from 'gatsby-plugin-react-i18next'; +import LinkText from '../components/LinkText' import '@fortawesome/fontawesome-free/css/all.min.css' import '@fortawesome/fontawesome-free/css/v4-shims.min.css' -const AsciidocTemplate = ({ data }) => { +const AsciidocTemplate = ({ data, pageContext }) => { useEffect(() => { asciidocFormatter() highlightCode() @@ -21,7 +23,14 @@ const AsciidocTemplate = ({ data }) => { const { asciidoc } = data // data.asciidoc holds our data const { document, fields, html, pageAttributes } = asciidoc const pageAuthorList = pageAttributes.authors || '' - const { relativePath } = fields + const basedOnSha = pageAttributes.based_on || '' + const { relativePath, slug } = fields + const { defaultGitSHA, locale, language } = pageContext + + // Translated version of the page doesn't exist and isn't en-GB + const displayDefaultLocaleWarning = locale !== language && language !== 'en-GB'; + const displayOutdatedWarning = defaultGitSHA && basedOnSha && defaultGitSHA !== basedOnSha; + return (
@@ -31,7 +40,34 @@ const AsciidocTemplate = ({ data }) => {

- {fields.slug === '/installation/' && ( + {displayDefaultLocaleWarning && ( +
+ + , + translationGuideLink: + }} + /> +
+ )} + {displayOutdatedWarning && ( +
+ + , + lastEnglishVersionLink: , + translationGuideLink: + }} + /> +
+ )} + {slug === '/installation/' && (
@@ -77,6 +113,7 @@ export const pageQuery = graphql` } pageAttributes { authors + based_on } } locales: allLocale(filter: {language: {eq: $language}}) { diff --git a/src/types/index.tsx b/src/types/index.tsx index e426ab352..af1f01469 100644 --- a/src/types/index.tsx +++ b/src/types/index.tsx @@ -11,6 +11,7 @@ export interface AsciidocPage { }, pageAttributes: { authors: string; + based_on?: string; } }