Hacer Página Multilenguaje en JSON/PHP

1. in root, create en.json, es.json, fr.json... as needed
Content for example for en.json
{
    "home" : "Home",
}
Content for example for es.json
{
    "home" : "Inicio",
}
2. in nginx, rewrite URLs like that:
location / {
    # Try to resolve the actual files first
    try_files $uri $uri/ @rewrites;
}

location @rewrites {
# Language-specific pages with trailing slash
    rewrite ^/es/?$ /index.php?lang=es last;
    rewrite ^/fr/?$ /index.php?lang=fr last;

    # Language-specific rewrites
    rewrite ^/es/([a-z0-9\._-]+)/?$ /index.php?slug=$1&lang=es last;
    rewrite ^/fr/([a-z0-9\._-]+)/?$ /index.php?slug=$1&lang=fr last;

    # General rewrites for English or default language
    rewrite ^/([a-z0-9\._-]+)/?$ /index.php?slug=$1&lang=en last;
}
3. add in beginning of all pages:
$lang = isset($_GET['lang']) ? $_GET['lang'] : 'en';
$langFile = $_SERVER['DOCUMENT_ROOT'] . "/" . $lang . ".json";
$L = json_decode(file_get_contents($langFile), true);
4. Call translations like that:
<p><?=$L["home"]?></p>