Demonstrates localizing PHP language files with the Lingo.dev CLI (@lingo.dev/cli) push/pull flow. Covers two formats: Laravel-style lang/*.php arrays and a gettext .po catalog.
Full walkthrough: lingo.dev/en/guides/web-app
lang/en/*.php— Laravel language files (<?php return [ … ];)lang/en.po— gettext PO catalog.lingo/config.json— Lingo.dev CLI configuration (phpandpoformats)
Laravel files return a keyed array; only the string values are translated:
<?php
return [
'nav' => ['dashboard' => 'Dashboard', 'settings' => 'Settings'],
'greeting' => 'Welcome back, :name!',
];# 1. Install the CLI (or prefix commands with `npx`)
npm install -g @lingo.dev/cli
# 2. Authenticate and link this repo to your engine
lingo login
lingo link
# 3. Translate changed source into every locale
lingo push --waitTranslations are committed per locale: lang/<locale>/*.php mirrors the English files, and lang/<locale>.po sits next to lang/en.po. This repo ships fully translated. After you edit an English file, lingo push --wait translates only the delta. To bootstrap a brand-new locale, add it to .lingo/config.json and run lingo push --backfill-missing.
lingo push parses each source file, diffs it against .lingo/lock.json, and translates only the human-readable strings through your linked engine:
- PHP — only the string values in the returned array change. Keys, nested arrays, the
<?php … returnprefix, comments, and Laravel placeholders like:name/:attributeare preserved. - PO — the
msgstrvalues are translated while eachmsgidstays as the source key, and the header block is preserved.
Want translations on every push or PR without running the CLI yourself? See the CI/CD Workflows guide — the Lingo.dev GitHub App translates automatically once installed. The App reads engineId from the committed .lingo/config.json, so run lingo link and commit the updated file before installing it.
- Source:
en - Targets:
es,fr,de