Skip to content

Commit cfe3e83

Browse files
authored
Add script to check links in translations (#457)
* Add note to old script that doesn't work with translation * Use script to update links in articles * Update scripts README
1 parent 10a93ae commit cfe3e83

12 files changed

Lines changed: 82 additions & 23 deletions

contributor/de/01-introduction-article-de.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ https://innersourcecommons.org/learn/learning-path/trusted-committer[_Trusted Co
2121
Manchmal übernimmt eine Person mehrere Rollen, z. B. die des Trusted Committer und des Product Owner speziell in kleineren Projekten.
2222

2323
Im Folgenden findest Du einen sehr kurzen Überblick über die anderen Rollen, aber wir möchten Dich ermutigen, die weiterführenden Artikel
24-
https://innersourcecommons.org/learn/learning-path/trusted-committer/01/[introductory article of the Trusted Committer role] und https://innersourcecommons.org/learn/learning-path/trusted-committer/05/[Lowering the barriers to entry] zu lesen, bevor Du Dich tiefer in die Details der Contributor Rolle in diesem Abschnitt einarbeitest.
25-
Alternativ kannst Du Dir auch unsere Videos zu den Themen anschauen: https://innersourcecommons.org/learn/learning-path/trusted-committer/01/[introduction], https://innersourcecommons.org/learn/learning-path/trusted-committer/05/[lowering the barriers to entry].
24+
https://innersourcecommons.org/de/learn/learning-path/trusted-committer/01/[introductory article of the Trusted Committer role] und https://innersourcecommons.org/de/learn/learning-path/trusted-committer/05/[Lowering the barriers to entry] zu lesen, bevor Du Dich tiefer in die Details der Contributor Rolle in diesem Abschnitt einarbeitest.
25+
Alternativ kannst Du Dir auch unsere Videos zu den Themen anschauen: https://innersourcecommons.org/de/learn/learning-path/trusted-committer/01/[introduction], https://innersourcecommons.org/de/learn/learning-path/trusted-committer/05/[lowering the barriers to entry].
2626

2727
==== Trusted Committer
2828

contributor/es/01-introduction-article-es.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ Por último, algunos colaboradores pueden convertirse en https://innersourcecomm
1919
Como Colaborador en una comunidad de InnerSource, interactuará con otras personas que desempeñan otros roles de InnerSource, como https://innersourcecommons.org/learn/learning-path/trusted-committer[_Trusted Committer_] o https://innersourcecommons.org/learn/learning-path/product-owner[_Product Owner_] y posiblemente con otros colaboradores.
2020
A veces, estos roles pueden ser desempeñados por la misma persona, como Trusted Committer y Product Owner en pequeños proyectos.
2121

22-
Esta sección le brinda una muy breve descripción general de los otros dos roles, pero nos gustaría animarle a que lea el https://innersourcecommons.org/learn/learning-path/trusted-committer[artículo de introducción al rol de Trusted Committer], y le recomendamos que lea también el artículo https://innersourcecommons.org/learn/learning-path/trusted-committer/05/[Bajando las barreras de entrada] antes de profundizar en los detalles del rol de Colaborador en esta sección.
23-
También puede ver los videos (https://innersourcecommons.org/learn/learning-path/trusted-committer[introducción], https://innersourcecommons.org/learn/learning-path/trusted-committer/05/[bajando las barreras de entrada]) en lugar de leer los artículos.
22+
Esta sección le brinda una muy breve descripción general de los otros dos roles, pero nos gustaría animarle a que lea el https://innersourcecommons.org/learn/learning-path/trusted-committer[artículo de introducción al rol de Trusted Committer], y le recomendamos que lea también el artículo https://innersourcecommons.org/es/learn/learning-path/trusted-committer/05/[Bajando las barreras de entrada] antes de profundizar en los detalles del rol de Colaborador en esta sección.
23+
También puede ver los videos (https://innersourcecommons.org/learn/learning-path/trusted-committer[introducción], https://innersourcecommons.org/es/learn/learning-path/trusted-committer/05/[bajando las barreras de entrada]) en lugar de leer los artículos.
2424

2525
==== Trusted Committer
2626

introduction/es/06-conclusion.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
En este módulo hemos visto una introducción a InnerSource.
44
InnerSource aplica las buenas prácticas de desarrollo de los proyectos de software libre en desarrollos internos.
55
Ofrece una opción adicional a los consumidores internos cuando los equipos de desarrollo no pueden atender una petición.
6-
Para llevar a cabo InnerSource de forma satisfactoria, se ha de involucrar al https://innersourcecommons.org/learn/learning-path/product-owner/01[_product owner_] y a los https://innersourcecommons.org/learn/learning-path/trusted-committer/01[_trusted committers_] del *equipo anfitrión* así como a https://innersourcecommons.org/learn/learning-path/contributor/01[_contribuidores_] del *equipo invitado*
6+
Para llevar a cabo InnerSource de forma satisfactoria, se ha de involucrar al https://innersourcecommons.org/learn/learning-path/product-owner/01[_product owner_] y a los https://innersourcecommons.org/es/learn/learning-path/trusted-committer/01[_trusted committers_] del *equipo anfitrión* así como a https://innersourcecommons.org/es/learn/learning-path/contributor/01[_contribuidores_] del *equipo invitado*
77
Un InnerSource efectivo beneficiará a ambas partes.
88
Los principios clave sobre los que se basa el trabajo de InnerSource son las *contribuciones voluntarias de código fuente* y la *priorización de actividades de mentoría*.
99

scripts/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ For example, to point all links to innersourcecommons.org:
1515
node substitute_article_urls.js isc
1616
```
1717

18+
## updates_links_in_translations.js
19+
20+
A node script to ensure article links point at the relevant translation if it exists, or default (English) if not.
21+
22+
### Usage:
23+
```
24+
npm ci
25+
node updates_links_in_translations.js
26+
```
27+
1828
## generate_learning_path_markdown.js
1929

2030
Node script to generate markdown files required for hosting Learning Path on innersourcecommons.org.

scripts/substitute_article_urls.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// TODO: Update to work with translations; may require changing the urls.yaml
2+
13
const fs = require('fs')
24
const YAML = require('yaml')
35
const { join } = require('path')
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
const fs = require('fs')
2+
const { join } = require('path')
3+
4+
const getArticleFiles = (path, translation) => {
5+
return fs.readdirSync(path, { withFileTypes: true }).map((dirent) => {
6+
const filePath = join(path, dirent.name)
7+
if (dirent.isDirectory()) {
8+
return getArticleFiles(filePath, dirent.name)
9+
} else {
10+
return {
11+
filePath,
12+
asciiDoc: fs.readFileSync(filePath, 'utf-8'),
13+
translation
14+
}
15+
}
16+
}).flat()
17+
}
18+
const articleFiles = [getArticleFiles(join('..', 'introduction')), getArticleFiles(join('..', 'product-owner')), getArticleFiles(join('..', 'trusted-committer')), getArticleFiles(join('..', 'contributor'))].flat()
19+
20+
const articleTranslationExists = (section, translation, segment) => {
21+
const searchTerm = join('..', section, translation, segment)
22+
return !!articleFiles.find(file => file.filePath.startsWith(searchTerm))
23+
}
24+
25+
articleFiles.forEach(({ asciiDoc, filePath, translation }) => {
26+
if (!translation) return
27+
28+
const matches = [...asciiDoc.matchAll(/https:\/\/innersourcecommons\.org\/([\w\-]+\/)?learn\/learning-path\/([\w\-]+)\/([\w\-]+)/gm)]
29+
matches.forEach((match) => {
30+
const url = match[0]
31+
const linkedTranslation = match[1] ? match[1].replace('/', '') : ''
32+
const section = match[2]
33+
const segment = match[3]
34+
35+
// Link to translation if exists
36+
if (translation !== linkedTranslation && articleTranslationExists(section, translation, segment)) {
37+
asciiDoc = asciiDoc.replace(url, `https://innersourcecommons.org/${translation}/learn/learning-path/${section}/${segment}`)
38+
}
39+
40+
// Link to default if does not exist
41+
if (translation === linkedTranslation && !articleTranslationExists(section, translation, segment)) {
42+
asciiDoc = asciiDoc.replace(url, `https://innersourcecommons.org/learn/learning-path/${section}/${segment}`)
43+
}
44+
45+
})
46+
fs.writeFileSync(filePath, asciiDoc)
47+
})

trusted-committer/de/01-introduction-de.asciidoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ kurzen Blick auf die Verantwortlichkeiten eines _Trusted Committers_ werfen.
5757

5858
_Trusted Committers_ haben verschiedene Verantwortlichkeiten, unter anderem:
5959

60-
* https://innersourcecommons.org/learn/learning-path/trusted-committer/02/[Ensuring product quality]
61-
* https://innersourcecommons.org/learn/learning-path/trusted-committer/03/[Keeping the community healthy]
62-
* https://innersourcecommons.org/learn/learning-path/trusted-committer/05/[Reducing the barriers to making contributions]
63-
* https://innersourcecommons.org/learn/learning-path/trusted-committer/04/[Upleveling the community]
64-
* https://innersourcecommons.org/learn/learning-path/trusted-committer/06/[Advocating the community's needs]
60+
* https://innersourcecommons.org/de/learn/learning-path/trusted-committer/02/[Ensuring product quality]
61+
* https://innersourcecommons.org/de/learn/learning-path/trusted-committer/03/[Keeping the community healthy]
62+
* https://innersourcecommons.org/de/learn/learning-path/trusted-committer/05/[Reducing the barriers to making contributions]
63+
* https://innersourcecommons.org/de/learn/learning-path/trusted-committer/04/[Upleveling the community]
64+
* https://innersourcecommons.org/de/learn/learning-path/trusted-committer/06/[Advocating the community's needs]
6565

66-
Wir werden diese Verantwortlichkeiten in den folgenden Kapiteln weiter vertiefen, bitte schau Dir dazu auch das Kapitel https://innersourcecommons.org/learn/learning-path/trusted-committer/07/[07 becoming a Trusted Committer] am Ende an.
66+
Wir werden diese Verantwortlichkeiten in den folgenden Kapiteln weiter vertiefen, bitte schau Dir dazu auch das Kapitel https://innersourcecommons.org/de/learn/learning-path/trusted-committer/07/[07 becoming a Trusted Committer] am Ende an.
6767
[role="pagenumrestart"]

trusted-committer/de/03-keeping-the-community-healthy-de.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Sie liefern die Theorie oder die Erfahrung bei Quellcodeänderungen und schlagen
2424

2525
Wir glauben, dass _Trusted Committer_ das Onboarding und Mentoring während der Pull Requests über das Erreichen von Releaseterminen stellen sollten, außer es sprechen triftige Gründe dagegen.
2626
Gute Betreuung während eines Pull Requests führt zu höherem Vertrauen und Bindung von https://innersourcecommons.org/learn/learning-path/contributor[_Contributors_], was im Gegenzug zu mehr Mitarbeit führt.
27-
Wir werden diesen Aspekt in https://innersourcecommons.org/learn/learning-path/trusted-committer/04/["Upleveling the Community"] näher betrachten.
27+
Wir werden diesen Aspekt in https://innersourcecommons.org/de/learn/learning-path/trusted-committer/04/["Upleveling the Community"] näher betrachten.
2828

2929
Schliesslich gibt es Menschen, die sich in _InnerSource Communities_ engagieren, weil sie sich dort auf das Entwickeln von Software konzentrieren können anstatt anderen Aufgaben nachzugehen, die häufig als überflüssig oder unnötig angesehen werden.
3030
Dies trifft häufig auf große Unternehmen mit einem starken Fokus auf Prozesse zu.
@@ -36,6 +36,6 @@ Allgemein gesprochen müssen _Trusted Committer_ sicherstellen, dass der Prozess
3636
Schließlich sollten _Trusted Committer_ ihre Community dazu befähigen, prozessbezogene Probleme zu finden und diese so gut wie möglich selbst anzupassen und zu verbessern.
3737

3838
Damit _Trusted Committer_ alle diese Verantwortlichkeiten erfüllen können, ist es wichtig, dass sie regelmäßig mit den Mitgliedern der Community kommunizieren und ein Gespür für die allgemeine Stimmung entwickeln.
39-
Wir werden dies näher im Kapitel https://innersourcecommons.org/learn/learning-path/trusted-committer/06/["Advocating the Community's Needs"] betrachten.
39+
Wir werden dies näher im Kapitel https://innersourcecommons.org/de/learn/learning-path/trusted-committer/06/["Advocating the Community's Needs"] betrachten.
4040

4141
Zusammengefasst sollten _Trusted Committer_ sich bemühen ein einladendes und annerkennendes Umfeld für ihre https://innersourcecommons.org/learn/learning-path/contributor[_Contributors_] zu erzeugen, welches diesen erlaubt, sich auf das Schreiben von Software zu konzentrieren und ihre Persönlichkeit weiterzuentwickeln indem sie von anderen Mitgliedern der Organisation lernen.

trusted-committer/de/04-uplevelling-community-members-de.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Letztendlich sind die _Trusted Committers_ dafür verantwortlich, https://inners
1515
Dies ist unserer Meinung nach die edelste Aufgabe eines _Trusted Committers_, und diese Aufgabe lohnt sich sowohl für den _Trusted Committer_ als auch für den _Contributor_.
1616
_Trusted Committer_ berichten, dass Mentoring und zu sehen, wie Menschen lernen und zur Community beitragen, mehr als genug Ersatz dafür ist, dass die _Trusted Committer_ weniger Zeit haben, selbst Software zu schreiben.
1717

18-
Wie in https://innersourcecommons.org/learn/learning-path/trusted-committer/03/[previous section] erwähnt, sind Lernen und persönliches Wachstum wesentliche Gründe für Menschen, einer InnerSoure Community beizutreten und dabei zu bleiben.
18+
Wie in https://innersourcecommons.org/de/learn/learning-path/trusted-committer/03/[previous section] erwähnt, sind Lernen und persönliches Wachstum wesentliche Gründe für Menschen, einer InnerSoure Community beizutreten und dabei zu bleiben.
1919
Die Weiterbildung ihrer https://innersourcecommons.org/learn/learning-path/contributor[_Contributors_] ist eines der stärksten Werkzeuge, welches _Trusted Committer_ zur Verfügung haben, um die Geschwindigkeit, den Output und die Langlebigkeit ihrer Communitiy zu erhöhen.
2020
Es ist auch eines der Hauptargumente, um das Management eines Unternehmens davon zu überzeugen, ihren Mitarbeitern zu erlauben an einer _InnerSource Community_ teilzunehmen, da dies ihre Mitarbeiter für das Unternehmen wertvoller macht und dem Unternehmen hilft, seine Top-Talente zu halten.
2121

trusted-committer/es/01-introduction-es.asciidoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ vamos a hechar un vistazo rápido a las responsabilidades de un Trusted Committe
6464

6565
=== Responsabilidades
6666

67-
* https://innersourcecommons.org/learn/learning-path/trusted-committer/02/[Asegurar la calidad del producto]
68-
* https://innersourcecommons.org/learn/learning-path/trusted-committer/03/[Mantener una comunidad sana]
69-
* https://innersourcecommons.org/learn/learning-path/trusted-committer/05/[Reducir las barreras para hacer contribuciones]
70-
* https://innersourcecommons.org/learn/learning-path/trusted-committer/04/[Subir de nível a la comunidad]
71-
* https://innersourcecommons.org/learn/learning-path/trusted-committer/06/[Abogar por las necesidades de la comunidad]
67+
* https://innersourcecommons.org/es/learn/learning-path/trusted-committer/02/[Asegurar la calidad del producto]
68+
* https://innersourcecommons.org/es/learn/learning-path/trusted-committer/03/[Mantener una comunidad sana]
69+
* https://innersourcecommons.org/es/learn/learning-path/trusted-committer/05/[Reducir las barreras para hacer contribuciones]
70+
* https://innersourcecommons.org/es/learn/learning-path/trusted-committer/04/[Subir de nível a la comunidad]
71+
* https://innersourcecommons.org/es/learn/learning-path/trusted-committer/06/[Abogar por las necesidades de la comunidad]
7272

73-
Vamos a ver estas responsabilidades más a fondo en las siguientes páginas, y también vamos a explorar el camino de https://innersourcecommons.org/learn/learning-path/trusted-committer/07/[llegar a ser un Trusted Committer] al final de este artículo.
73+
Vamos a ver estas responsabilidades más a fondo en las siguientes páginas, y también vamos a explorar el camino de https://innersourcecommons.org/es/learn/learning-path/trusted-committer/07/[llegar a ser un Trusted Committer] al final de este artículo.

0 commit comments

Comments
 (0)