Skip to content

Commit 752a199

Browse files
ricardochlSplaktar
authored andcommitted
feat(homepage): create and apply git patches for translations
1 parent 57c4707 commit 752a199

File tree

4 files changed

+105
-2
lines changed

4 files changed

+105
-2
lines changed

tools/build.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env zx
22

33
import { chalk } from 'zx';
4-
import { buildADEV, copyLocalizedFiles, resetBuildDir } from './lib/common.mjs';
4+
import { applyPatches, buildADEV, copyLocalizedFiles, resetBuildDir } from './lib/common.mjs';
55

66
try {
77
console.log(chalk.green('==== setup ===='));
@@ -24,6 +24,9 @@ async function preBuild() {
2424
// copy translated files
2525
console.log(chalk.cyan('Copy localized files...'));
2626
await copyLocalizedFiles();
27+
28+
console.log(chalk.cyan('Apply patches...'));
29+
await applyPatches();
2730
}
2831

2932
async function build() {
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
diff --git a/adev/src/app/features/home/home.component.html b/adev/src/app/features/home/home.component.html
2+
index 03bb94db37..3918a69707 100644
3+
--- a/adev/src/app/features/home/home.component.html
4+
+++ b/adev/src/app/features/home/home.component.html
5+
@@ -3,8 +3,8 @@
6+
<div class="adev-top-content">
7+
<!-- Banner(s) can be edited here! -->
8+
<a href="https://goo.gle/angular-dot-dev" class="adev-banner" target="_blank">
9+
- <h1 tabindex="-1">Welcome to Angular.dev &#8212; the future home for Angular!</h1>
10+
- <p class="adev-banner-cta">Read about our beta launch</p>
11+
+ <h1 tabindex="-1">Bienvenid&#64; a Angular.dev &#8212; la futura casa de Angular!</h1>
12+
+ <p class="adev-banner-cta">Lea sobre nuestro lanzamiento beta</p>
13+
</a>
14+
</div>
15+
</div>
16+
@@ -62,10 +62,10 @@
17+
<div class="adev-scale-text">
18+
<div class="adev-scale-container">
19+
<div class="adev-scale-wrapper">
20+
- <h2>Works at any scale</h2>
21+
+ <h2>Trabaja a cualquier escala</h2>
22+
<p>
23+
- Angular lets you start small on a well-lit path and supports you as your team and apps
24+
- grow.
25+
+ Angular te permite empezar poco a poco en un camino bien iluminado y te apoya a medida que tu equipo
26+
+ y tus aplicaciones crecen.
27+
</p>
28+
</div>
29+
</div>
30+
@@ -75,10 +75,10 @@
31+
<div class="adev-lines-text">
32+
<div class="adev-lines-container">
33+
<div class="adev-lines-wrapper">
34+
- <h2>Loved by millions</h2>
35+
+ <h2>Amado por millones</h2>
36+
<p>
37+
- Join the millions of developers all over the world building with Angular in a thriving
38+
- and friendly&nbsp;community.
39+
+ Únete a los millones de desarrolladores de todo el mundo que construyen con Angular
40+
+ en una comunidad próspera y amigable.
41+
</p>
42+
</div>
43+
</div>
44+
@@ -89,12 +89,12 @@
45+
<div class="adev-build-container">
46+
<div class="adev-build-wrapper">
47+
<h2>
48+
- Build for everyone
49+
- <div class="adev-gradient" aria-hidden="true">Build for everyone</div>
50+
+ Construir para todos
51+
+ <div class="adev-gradient" aria-hidden="true">Construir para todos</div>
52+
</h2>
53+
<p>
54+
- Rely on Angular's built-in hydration, internationalization, security, and accessibility
55+
- support to build for everyone around the world.
56+
+ Confía en el soporte integrado de hidratación, internacionalización, seguridad y accesibilidad
57+
+ de Angular para construir para todos en todo el mundo.
58+
</p>
59+
</div>
60+
</div>
61+
@@ -102,10 +102,10 @@
62+
<div class="adev-build-webgl-text" aria-hidden="true">
63+
<div class="adev-build-container">
64+
<div class="adev-build-wrapper">
65+
- <h2>Build for everyone</h2>
66+
+ <h2>Construir para todos</h2>
67+
<p>
68+
- Rely on Angular's built-in hydration, internationalization, security, and accessibility
69+
- support to build for everyone around the world.
70+
+ Confía en el soporte integrado de hidratación, internacionalización, seguridad y accesibilidad
71+
+ de Angular para construir para todos en todo el mundo.
72+
</p>
73+
</div>
74+
</div>
75+
@@ -123,8 +123,8 @@
76+
</div>
77+
<div class="adev-arrow"></div>
78+
<a routerLink="{{ctaLink}}" class="adev-cta">
79+
- <button class="docs-primary-btn" [attr.text]="'Learn Angular'" aria-label="Learn Angular">
80+
- Learn Angular
81+
+ <button class="docs-primary-btn" [attr.text]="'Aprende Angular'" aria-label="Aprende Angular">
82+
+ Aprende Angular
83+
</button>
84+
</a>
85+
</div>

tools/lib/common.mjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,17 @@ export async function watchLocalizedFiles(signal) {
6666
signal.addEventListener('abort', () => watcher.close());
6767
}
6868

69+
export async function applyPatches() {
70+
await within(async () => {
71+
cd(outDir);
72+
const patches = await glob('tools/git-patches/*.patch', { cwd: rootDir });
73+
for (const patch of patches) {
74+
const path = resolve(rootDir, patch);
75+
await $`git apply -p1 --ignore-whitespace ${path}`;
76+
}
77+
});
78+
}
79+
6980
export async function syncSubmodule() {
7081
await within(async () => {
7182
cd(rootDir);

tools/watch.mjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { argv, chalk } from 'zx';
2-
import { copyLocalizedFiles, resetBuildDir, watchADEV, watchLocalizedFiles } from './lib/common.mjs';
2+
import { applyPatches, copyLocalizedFiles, resetBuildDir, watchADEV, watchLocalizedFiles } from './lib/common.mjs';
33

44
try {
55
const { init = false } = argv;
@@ -32,6 +32,10 @@ async function preWatch({ init }) {
3232
// copy translated files
3333
console.log(chalk.cyan('Copy localized files...'));
3434
await copyLocalizedFiles();
35+
36+
// apply patches
37+
console.log(chalk.cyan('Apply patches...'));
38+
await applyPatches();
3539
}
3640
}
3741

0 commit comments

Comments
 (0)