Skip to content

Commit 19a2907

Browse files
authored
fix: translate.php Gemini payload + drop /<lang>/ from php.net URLs (#2403)
## Summary - `docs/translate.php`: rebuild the Gemini request payload to match the v1beta API contract — use top-level `systemInstruction` and make `parts` an array of objects. The previous shape (`role: "model"` first + `parts` as a single object) returned `HTTP 400` (see [run 25736017574](https://github.com/php/frankenphp/actions/runs/25736017574/job/75573140561)). - Refresh the system and user prompts in `translate.php` - Drop the `/en/`, `/es/`, `/fr/`, `/zh/` language segments from every `php.net/manual/...` URL across `docs/**/*.md` so links resolve to the visitor's preferred language.
1 parent 9457da6 commit 19a2907

74 files changed

Lines changed: 400 additions & 401 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/cn/config.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ php_server
1717

1818
一个更高级的 `Caddyfile`,支持更多功能并提供方便的环境变量,可以在 [FrankenPHP 仓库中](https://github.com/php/frankenphp/blob/main/caddy/frankenphp/Caddyfile)找到,并随 Docker 镜像提供。
1919

20-
PHP 本身可以[使用 `php.ini` 文件](https://www.php.net/manual/en/configuration.file.php)进行配置。
20+
PHP 本身可以[使用 `php.ini` 文件](https://www.php.net/manual/configuration.file.php)进行配置。
2121

2222
根据你的安装方法,FrankenPHP 和 PHP 解释器将在以下位置查找配置文件。
2323

@@ -275,7 +275,7 @@ Workers 可以通过 `watch` 指令在文件更改时重新启动。
275275

276276
## PHP 配置
277277

278-
为了加载[附加的 PHP 配置文件](https://www.php.net/manual/en/configuration.file.php#configuration.file.scan),可以使用 `PHP_INI_SCAN_DIR` 环境变量。设置后,PHP 将加载给定目录中所有带有 `.ini` 扩展名的文件。
278+
为了加载[附加的 PHP 配置文件](https://www.php.net/manual/configuration.file.php#configuration.file.scan),可以使用 `PHP_INI_SCAN_DIR` 环境变量。设置后,PHP 将加载给定目录中所有带有 `.ini` 扩展名的文件。
279279

280280
您还可以通过在 `Caddyfile` 中使用 `php_ini` 指令来更改 PHP 配置:
281281

docs/cn/known-issues.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
| 名称 | 原因 | 替代方案 |
88
| ----------------------------------------------------------------------------------------------------------- | ------------ | -------------------------------------------------------------------------------------------------------------------- |
9-
| [imap](https://www.php.net/manual/en/imap.installation.php) | 不安全的线程 | [javanile/php-imap2](https://github.com/javanile/php-imap2), [webklex/php-imap](https://github.com/Webklex/php-imap) |
9+
| [imap](https://www.php.net/manual/imap.installation.php) | 不安全的线程 | [javanile/php-imap2](https://github.com/javanile/php-imap2), [webklex/php-imap](https://github.com/Webklex/php-imap) |
1010
| [newrelic](https://docs.newrelic.com/docs/apm/agents/php-agent/getting-started/introduction-new-relic-php/) | 不安全的线程 | - |
1111

1212
## 有缺陷的 PHP 扩展
@@ -15,15 +15,15 @@
1515

1616
| 名称 | 问题 |
1717
| ------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
18-
| [ext-openssl](https://www.php.net/manual/en/book.openssl.php) | 在使用静态构建的 FrankenPHP(使用 musl libc 构建)时,在重负载下 OpenSSL 扩展可能会崩溃。一个解决方法是使用动态链接的构建(如 Docker 镜像中使用的版本)。此错误正在由 PHP 跟踪。[查看问题](https://github.com/php/php-src/issues/13648)|
18+
| [ext-openssl](https://www.php.net/manual/book.openssl.php) | 在使用静态构建的 FrankenPHP(使用 musl libc 构建)时,在重负载下 OpenSSL 扩展可能会崩溃。一个解决方法是使用动态链接的构建(如 Docker 镜像中使用的版本)。此错误正在由 PHP 跟踪。[查看问题](https://github.com/php/php-src/issues/13648)|
1919

2020
## get_browser
2121

22-
[get_browser()](https://www.php.net/manual/en/function.get-browser.php) 函数在一段时间后似乎表现不佳。解决方法是缓存(例如使用 [APCu](https://www.php.net/manual/zh/book.apcu.php))每个 User-Agent,因为它们是不变的。
22+
[get_browser()](https://www.php.net/manual/function.get-browser.php) 函数在一段时间后似乎表现不佳。解决方法是缓存(例如使用 [APCu](https://www.php.net/manual/book.apcu.php))每个 User-Agent,因为它们是不变的。
2323

2424
## 独立的二进制和基于 Alpine 的 Docker 镜像
2525

26-
独立的二进制文件和基于 Alpine 的 Docker 镜像 (`dunglas/frankenphp:*-alpine`) 使用的是 [musl libc](https://musl.libc.org/) 而不是 [glibc and friends](https://www.etalabs.net/compare_libcs.html),为的是保持较小的二进制大小。这可能会导致一些兼容性问题。特别是,glob 标志 `GLOB_BRACE` [不可用](https://www.php.net/manual/en/function.glob.php)
26+
独立的二进制文件和基于 Alpine 的 Docker 镜像 (`dunglas/frankenphp:*-alpine`) 使用的是 [musl libc](https://musl.libc.org/) 而不是 [glibc and friends](https://www.etalabs.net/compare_libcs.html),为的是保持较小的二进制大小。这可能会导致一些兼容性问题。特别是,glob 标志 `GLOB_BRACE` [不可用](https://www.php.net/manual/function.glob.php)
2727

2828
## 在 Docker 中使用 `https://127.0.0.1`
2929

@@ -122,7 +122,7 @@ error:0A000086:SSL routines::certificate verify failed
122122

123123
由于静态二进制不捆绑 TLS 证书,因此您需要将 OpenSSL 指向本地 CA 证书安装。
124124

125-
检查 [`openssl_get_cert_locations()`](https://www.php.net/manual/en/function.openssl-get-cert-locations.php) 的输出,
125+
检查 [`openssl_get_cert_locations()`](https://www.php.net/manual/function.openssl-get-cert-locations.php) 的输出,
126126
以找到 CA 证书必须安装的位置,并将它们存储在该位置。
127127

128128
> [!WARNING]

docs/cn/performance.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
`max_threads` 可以帮助你确定需要多少线程来处理你的流量,并可以使服务器对延迟峰值更具弹性。
2424
如果设置为 `auto`,限制将基于你的 `php.ini` 中的 `memory_limit` 进行估算。如果无法这样做,
2525
`auto` 将默认为 2x `num_threads`。请记住,`auto` 可能会严重低估所需的线程数。
26-
`max_threads` 类似于 PHP FPM 的 [pm.max_children](https://www.php.net/manual/en/install.fpm.configuration.php#pm.max-children)。主要区别是 FrankenPHP 使用线程而不是
26+
`max_threads` 类似于 PHP FPM 的 [pm.max_children](https://www.php.net/manual/install.fpm.configuration.php#pm.max-children)。主要区别是 FrankenPHP 使用线程而不是
2727
进程,并根据需要自动在不同的 worker 脚本和"经典模式"之间委派它们。
2828

2929
## Worker 模式
@@ -160,10 +160,10 @@ FrankenPHP 使用官方 PHP 解释器。
160160

161161
特别是:
162162

163-
- 检查 [OPcache](https://www.php.net/manual/zh/book.opcache.php) 是否已安装、启用并正确配置
163+
- 检查 [OPcache](https://www.php.net/manual/book.opcache.php) 是否已安装、启用并正确配置
164164
- 启用 [Composer 自动加载器优化](https://getcomposer.org/doc/articles/autoloader-optimization.md)
165165
- 确保 `realpath` 缓存对于你的应用程序需求足够大
166-
- 使用[预加载](https://www.php.net/manual/zh/opcache.preloading.php)
166+
- 使用[预加载](https://www.php.net/manual/opcache.preloading.php)
167167

168168
有关更多详细信息,请阅读[专门的 Symfony 文档条目](https://symfony.com/doc/current/performance.html)
169169
(即使你不使用 Symfony,大多数提示也很有用)。

docs/cn/worker.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ frankenphp {
165165

166166
## 超全局变量行为
167167

168-
[PHP 超全局变量](https://www.php.net/manual/zh/language.variables.superglobals.php)`$_SERVER``$_ENV``$_GET`...)
168+
[PHP 超全局变量](https://www.php.net/manual/language.variables.superglobals.php)`$_SERVER``$_ENV``$_GET`...)
169169
行为如下:
170170

171171
- 在第一次调用 `frankenphp_handle_request()` 之前,超全局变量包含绑定到 worker 脚本本身的值

docs/compile.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Alternatively, [fully and mostly static builds](static.md) can also be created.
1212

1313
## Install PHP
1414

15-
FrankenPHP is compatible with PHP 8.2 and superior.
15+
FrankenPHP is compatible with PHP 8.2 and higher.
1616

1717
### With Homebrew (Linux and Mac)
1818

@@ -97,7 +97,7 @@ You can now build the final binary.
9797
### Using xcaddy
9898

9999
The recommended way is to use [xcaddy](https://github.com/caddyserver/xcaddy) to compile FrankenPHP.
100-
`xcaddy` also allows to easily add [custom Caddy modules](https://caddyserver.com/docs/modules/) and FrankenPHP extensions:
100+
`xcaddy` also makes it easy to add [custom Caddy modules](https://caddyserver.com/docs/modules/) and FrankenPHP extensions:
101101

102102
```console
103103
CGO_ENABLED=1 \

docs/config.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Configure FrankenPHP and Caddy via Caddyfile, JSON, or environment
55

66
# Configuration
77

8-
FrankenPHP, Caddy as well as the [Mercure](mercure.md) and [Vulcain](https://vulcain.rocks) modules can be configured using [the formats supported by Caddy](https://caddyserver.com/docs/getting-started#your-first-config).
8+
FrankenPHP, Caddy, as well as the [Mercure](mercure.md) and [Vulcain](https://vulcain.rocks) modules, can be configured using [the formats supported by Caddy](https://caddyserver.com/docs/getting-started#your-first-config).
99

1010
The most common format is the `Caddyfile`, which is a simple, human-readable text format.
1111
By default, FrankenPHP will look for a `Caddyfile` in the current directory.
@@ -25,7 +25,7 @@ php_server
2525
A more advanced `Caddyfile` enabling more features and providing convenient environment variables is provided [in the FrankenPHP repository](https://github.com/php/frankenphp/blob/main/caddy/frankenphp/Caddyfile),
2626
and with Docker images.
2727

28-
PHP itself can be configured [using a `php.ini` file](https://www.php.net/manual/en/configuration.file.php).
28+
PHP itself can be configured [using a `php.ini` file](https://www.php.net/manual/configuration.file.php).
2929

3030
Depending on your installation method, FrankenPHP and the PHP interpreter will look for configuration files in locations described below.
3131

@@ -301,11 +301,11 @@ The following environment variables can be used to inject Caddy directives in th
301301

302302
As for FPM and CLI SAPIs, environment variables are exposed by default in the `$_SERVER` superglobal.
303303

304-
The `S` value of [the `variables_order` PHP directive](https://www.php.net/manual/en/ini.core.php#ini.variables-order) is always equivalent to `ES` regardless of the placement of `E` elsewhere in this directive.
304+
The `S` value of [the `variables_order` PHP directive](https://www.php.net/manual/ini.core.php#ini.variables-order) is always equivalent to `ES` regardless of the placement of `E` elsewhere in this directive.
305305

306306
## PHP config
307307

308-
To load [additional PHP configuration files](https://www.php.net/manual/en/configuration.file.php#configuration.file.scan),
308+
To load [additional PHP configuration files](https://www.php.net/manual/configuration.file.php#configuration.file.scan),
309309
the `PHP_INI_SCAN_DIR` environment variable can be used.
310310
When set, PHP will load all the files with the `.ini` extension present in the given directories.
311311

@@ -338,7 +338,7 @@ If you want to use HTTPS with the `127.0.0.1` IP address instead of the `localho
338338
### Full duplex (HTTP/1)
339339

340340
When using HTTP/1.x, it may be desirable to enable full-duplex mode to allow writing a response before the entire body
341-
has been read. (for example: [Mercure](mercure.md), WebSocket, Server-Sent Events, etc.)
341+
has been read (for example: [Mercure](mercure.md), WebSocket, Server-Sent Events, etc.).
342342

343343
This is an opt-in configuration that needs to be added to the global options in the `Caddyfile`:
344344

docs/docker.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ COPY --from=builder /usr/local/bin/frankenphp /usr/local/bin/frankenphp
9292
```
9393

9494
The `builder` image provided by FrankenPHP contains a compiled version of `libphp`.
95-
[Builders images](https://hub.docker.com/r/dunglas/frankenphp/tags?name=builder) are provided for all versions of FrankenPHP and PHP, both for Debian and Alpine.
95+
[Builder images](https://hub.docker.com/r/dunglas/frankenphp/tags?name=builder) are provided for all versions of FrankenPHP and PHP, both for Debian and Alpine.
9696

9797
> [!TIP]
9898
>
@@ -121,7 +121,7 @@ docker run -v $PWD:/app/public -p 80:80 -p 443:443 -p 443:443/udp --tty my-php-a
121121

122122
> [!TIP]
123123
>
124-
> The `--tty` option allows to have nice human-readable logs instead of JSON logs.
124+
> The `--tty` option provides nice human-readable logs instead of JSON logs.
125125
126126
With Docker Compose:
127127

@@ -143,7 +143,7 @@ services:
143143
- ./:/app/public
144144
- caddy_data:/data
145145
- caddy_config:/config
146-
# comment the following line in production, it allows to have nice human-readable logs in dev
146+
# comment the following line in production, it provides nice human-readable logs in dev
147147
tty: true
148148

149149
# Volumes needed for Caddy certificates and configuration

docs/embed.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,5 +146,5 @@ To customize the extensions, use the `PHP_EXTENSIONS` environment variable.
146146

147147
On Linux, the created binary is compressed using [UPX](https://upx.github.io).
148148

149-
On Mac, to reduce the size of the file before sending it, you can compress it.
149+
On macOS, to reduce the size of the file before sending it, you can compress it.
150150
We recommend `xz`.

docs/es/classic.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Usando el Modo Clásico
1+
# Usando el modo clásico
22

33
Sin ninguna configuración adicional, FrankenPHP opera en modo clásico. En este modo, FrankenPHP funciona como un servidor PHP tradicional, sirviendo directamente archivos PHP. Esto lo convierte en un reemplazo directo para PHP-FPM o Apache con mod_php.
44

docs/es/config.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ php_server
2020
Un `Caddyfile` más avanzado que habilita más características y proporciona variables de entorno convenientes está disponible [en el repositorio de FrankenPHP](https://github.com/php/frankenphp/blob/main/caddy/frankenphp/Caddyfile),
2121
y con las imágenes de Docker.
2222

23-
PHP en sí puede configurarse [usando un archivo `php.ini`](https://www.php.net/manual/es/configuration.file.php).
23+
PHP en sí puede configurarse [usando un archivo `php.ini`](https://www.php.net/manual/configuration.file.php).
2424

2525
Dependiendo de su método de instalación, FrankenPHP y el intérprete de PHP buscarán archivos de configuración en las ubicaciones descritas a continuación.
2626

@@ -275,11 +275,11 @@ Las siguientes variables de entorno pueden usarse para inyectar directivas de Ca
275275

276276
Al igual que en FPM y SAPIs CLI, las variables de entorno se exponen por defecto en la superglobal `$_SERVER`.
277277

278-
El valor `S` de [la directiva `variables_order` de PHP](https://www.php.net/manual/en/ini.core.php#ini.variables-order) siempre es equivalente a `ES` independientemente de la ubicación de `E` en otro lugar de esta directiva.
278+
El valor `S` de [la directiva `variables_order` de PHP](https://www.php.net/manual/ini.core.php#ini.variables-order) siempre es equivalente a `ES` independientemente de la ubicación de `E` en otro lugar de esta directiva.
279279

280280
## Configuración de PHP
281281

282-
Para cargar [archivos de configuración adicionales de PHP](https://www.php.net/manual/en/configuration.file.php#configuration.file.scan),
282+
Para cargar [archivos de configuración adicionales de PHP](https://www.php.net/manual/configuration.file.php#configuration.file.scan),
283283
puede usarse la variable de entorno `PHP_INI_SCAN_DIR`.
284284
Cuando se establece, PHP cargará todos los archivos con la extensión `.ini` presentes en los directorios dados.
285285

0 commit comments

Comments
 (0)