Skip to content

update gulpfile and dependencies for building i18n files#1029

Merged
9larsons merged 1 commit into
mainfrom
update-deps-and-gulp
Mar 9, 2026
Merged

update gulpfile and dependencies for building i18n files#1029
9larsons merged 1 commit into
mainfrom
update-deps-and-gulp

Conversation

@cathysarisky
Copy link
Copy Markdown
Member

This adds a dependency on theme-translations, so that Casper can pull new strings as they become available, and new gulp behavior to include them on build & watch.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 9, 2026

Walkthrough

The pull request introduces translation support to the project's build pipeline. A new development dependency (@tryghost/theme-translations) is added to package.json. In gulpfile.js, a new locales task is created to merge translation files from a ./locales-local directory into a ./locales output directory. A corresponding file watcher is added to monitor ./locales-local/**/*.json for changes and trigger the merging process. The localesWatcher is integrated into the main watcher configuration, and the locales task is included in the overall build sequence.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: updating the gulpfile and dependencies to support internationalization (i18n) file building.
Description check ✅ Passed The description clearly relates to the changeset, explaining the addition of the theme-translations dependency and new gulp behavior for including translations in build and watch tasks.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch update-deps-and-gulp

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
package.json (1)

49-49: Consider wiring the package’s Renovate preset too.

Adding the devDependency enables the merge tooling, but the package’s own README treats automatic pickup of new shared strings as a separate step via github>TryGhost/Themes:packages/theme-translations/renovate-config. If the goal here is “pull new strings as they become available” without manual dependency refreshes, this repo still needs that extra Renovate extension. (github.com)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@package.json` at line 49, The repo added "@tryghost/theme-translations" as a
devDependency but didn't enable the package's Renovate preset; add a Renovate
configuration that extends
"github>TryGhost/Themes:packages/theme-translations/renovate-config" so Renovate
will automatically import new shared strings, e.g., by adding an extends entry
in your Renovate config (or a "renovate" field in package.json) pointing to that
preset; ensure the extends string exactly matches
github>TryGhost/Themes:packages/theme-translations/renovate-config and keep the
existing devDependency "@tryghost/theme-translations" intact.
gulpfile.js (1)

95-107: Add livereload trigger for locale changes in watch mode.

The locales watcher rebuilds ./locales when locales-local/**/*.json changes, but doesn't trigger a browser reload like the CSS, JS, and HBS watchers do. This breaks the development experience when editing locale overrides that power template {{t}} calls.

Since @tryghost/theme-translations exposes mergeLocales as a Gulp task helper, you can use it directly and compose a reload step:

♻️ Proposed fix
-function locales(done) {
-    mergeLocales({
-        local: './locales-local',
-        output: './locales'
-    })(done);
-}
+const locales = mergeLocales({
+    local: './locales-local',
+    output: './locales'
+});
+
+function reloadLocales(done) {
+    pump([
+        src('locales/**/*.json'),
+        livereload()
+    ], handleError(done));
+}
 
 const cssWatcher = () => watch('assets/css/**', css);
 const jsWatcher = () => watch('assets/js/**', js);
 const hbsWatcher = () => watch(['*.hbs', 'partials/**/*.hbs'], hbs);
-const localesWatcher = () => watch('./locales-local/**/*.json', locales);
+const localesWatcher = () => watch('./locales-local/**/*.json', series(locales, reloadLocales));
 const watcher = parallel(cssWatcher, jsWatcher, hbsWatcher, localesWatcher);
 const build = series(css, js, locales);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@gulpfile.js` around lines 95 - 107, The locales watcher rebuilds ./locales
but does not trigger browser reload; update the locales task/watcher so locale
changes also call the livereload step used by css/js/hbs watchers: use the
existing mergeLocales helper (mergeLocales(...)) as the locales Gulp task (or
wrap it) and compose it with the same reload step used elsewhere (i.e., make
locales a series of mergeLocales(...) followed by the reload function), and
change localesWatcher to invoke that composed task (or
watch('./locales-local/**/*.json', series(locales, reload))) so edits to
locales-local/**/*.json trigger a browser reload like css/js/hbs.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@gulpfile.js`:
- Around line 95-107: The locales watcher rebuilds ./locales but does not
trigger browser reload; update the locales task/watcher so locale changes also
call the livereload step used by css/js/hbs watchers: use the existing
mergeLocales helper (mergeLocales(...)) as the locales Gulp task (or wrap it)
and compose it with the same reload step used elsewhere (i.e., make locales a
series of mergeLocales(...) followed by the reload function), and change
localesWatcher to invoke that composed task (or
watch('./locales-local/**/*.json', series(locales, reload))) so edits to
locales-local/**/*.json trigger a browser reload like css/js/hbs.

In `@package.json`:
- Line 49: The repo added "@tryghost/theme-translations" as a devDependency but
didn't enable the package's Renovate preset; add a Renovate configuration that
extends "github>TryGhost/Themes:packages/theme-translations/renovate-config" so
Renovate will automatically import new shared strings, e.g., by adding an
extends entry in your Renovate config (or a "renovate" field in package.json)
pointing to that preset; ensure the extends string exactly matches
github>TryGhost/Themes:packages/theme-translations/renovate-config and keep the
existing devDependency "@tryghost/theme-translations" intact.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 336d030f-2388-42b3-a9ee-9545e207ea12

📥 Commits

Reviewing files that changed from the base of the PR and between 4950217 and 1de4486.

📒 Files selected for processing (2)
  • gulpfile.js
  • package.json

@cathysarisky cathysarisky requested a review from 9larsons March 9, 2026 19:56
@9larsons 9larsons merged commit 5d1865c into main Mar 9, 2026
1 check passed
@9larsons 9larsons deleted the update-deps-and-gulp branch March 9, 2026 19:57
nirajsanghvi pushed a commit to nirajsanghvi/casper_niraj that referenced this pull request Mar 14, 2026
#2)

* Updated date formatting

ref DES-937

- updated the format to DD MMM YYYY which is the preferred format in Ghost

* v5.8.1

* 2025

Co-authored-by: Hannah Wolfe github.erisds@gmail.com

* Added support for additional social links (TryGhost#991)

ref https://linear.app/ghost/issue/PLG-413/add-helpers-to-official-themes

* Added support for all of the new social links in Ghost
* Added icon classes to social icons so that we can display an icon for each link
* Switched to using the new social_url helper for all social links as it is cleaner
* Replaced Twitter with X logo so it's up to date

* Update dependency gscan to v4.48.0 (TryGhost#980)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Updated `caniuse-lite` browser list (#22907) (TryGhost#992)

- Running the yarn test command was logging a bunch of
warnings because our browser list hadn't been updated in 6 months

```
Browserslist: browsers data (caniuse-lite) is 6 months old. Please run:
  npx update-browserslist-db@latest
  Why you should do it regularly: https://github.com/browserslist/update-db#readme
```

- This commit fixes the warnings by updating the browsers list by
running `npx update-browserslist-db@latest` in the root of the repo, and
committing the result.

* Revert "Updated `caniuse-lite` browser list (#22907) (TryGhost#992)"

- This reverts commit e151531.
- This change results in further changes when running gulp build that will need verifying separately

* v5.9.0

* Update dependency gscan to v4.49.1

* Fixed line height issue for sub and sup elements

* Update dependency gscan to v5 (TryGhost#999)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency postcss to v8.4.31 [SECURITY] (TryGhost#961)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update CSS preprocessors (TryGhost#885)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency inquirer to v8.2.7 (TryGhost#905)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency pump to v3.0.3 (TryGhost#983)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency gulp to v5 (TryGhost#977)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update CSS preprocessors (TryGhost#932)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency gulp-postcss to v10 (TryGhost#973)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency gulp-zip to v6 (TryGhost#964)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency inquirer to v13 (TryGhost#1008)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Lock file maintenance (TryGhost#814)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency inquirer to v13.2.0 (TryGhost#1012)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Lock file maintenance (TryGhost#1013)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Lock file maintenance (TryGhost#1014)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* 2026

Co-authored-by: Hannah Wolfe <github.erisds@gmail.com>

* Update dependency gscan to v5.2.4 (TryGhost#1015)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency inquirer to v13.2.1 (TryGhost#1016)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency inquirer to v13.2.2 (TryGhost#1017)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency autoprefixer to v10.4.24 (TryGhost#1019)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Lock file maintenance (TryGhost#1020)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update README.md

* Add translations section to README (TryGhost#1026)

Added section on translations and contribution guidelines.

* Update translation contribution guidelines (TryGhost#1027)

Fixed error (wrong repo name - removed)

* 🌐 Enable theme translations for Casper (TryGhost#1028)


ref #23361

* add locale files (TryGhost#1030)

* Updated gulpfile and dependencies for building i18n files (TryGhost#1029)

ref TryGhost@63162e8

The above commit pushed the locales slightly ahead of this. Running the gulp file generates the locale files.

* Update theme asset builds (TryGhost#1031)

* update asset builds

* Ship v5.10.0 - now with translations enabled! (TryGhost#1032)

* fix Casper's postship (TryGhost#1033)

* Initial plan

---------

Co-authored-by: Sodbileg Gansukh <sodbileg.gansukh@gmail.com>
Co-authored-by: John O'Nolan <john@onolan.org>
Co-authored-by: Sanne de Vries <65487235+sanne-san@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Hannah Wolfe <github.erisds@gmail.com>
Co-authored-by: Cathy Sarisky <42299862+cathysarisky@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants