Skip to content

Commit e6ef5af

Browse files
committed
Share common markup for PHP 8.0 release page translations
Adds a `release.inc` file for PHP 8.0 like the other release pages have, in order to avoid duplicating all the markup for every translation (making it much easier to maintain consistent content). Apart from the following exceptions, no content or translations have been changed: Consistency improvements: * Added IDs to headings in section above footer for direct linking (like the other release pages have). * Added `<code>` tag around operators and keywords for better readability (the other release pages do this). * Updated code examples to consistently use 4-space indentation (previously the attributes code example used four spaces and others used two spaces). Translation-specific fixes: * Fixed bug where heading links in the French and Japanese translations unexpectedly switched to the English translation of the page (caused by incorrect `$_SERVER['BASE_PAGE']` value). * Spanish, Italian, and Turkish pages previously incorrectly linked to English documentation for some or all of the documentation links. * French translation previously had a different code example for attributes, which didn't really make sense (it showed the same `/api/posts/{id}` Route attribute, but above a User class rather than on a `get` method in a PostsController class). * Fixed incorrect Static Return Type RFC link in Portuguese translation. * Fixed a couple minor spacing bugs in Spanish translation. * Chinese page previously was missing translation for Documentation link in a couple places. * Fixed missing blank lines in a few Chinese translation code blocks. * Fixed inconsistent strings in Georgian match expression example.
1 parent b0c6afa commit e6ef5af

File tree

27 files changed

+1552
-6024
lines changed

27 files changed

+1552
-6024
lines changed

releases/8.0/common.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,13 @@ function language_chooser(string $currentLang): void {
6969
</form>
7070
';
7171
}
72+
73+
function message($code, $language = 'en')
74+
{
75+
$original = require __DIR__ . '/languages/en.php';
76+
if (($language !== 'en') && file_exists(__DIR__ . '/languages/' . $language . '.php')) {
77+
$translation = require __DIR__ . '/languages/' . $language . '.php';
78+
}
79+
80+
return $translation[$code] ?? $original[$code] ?? $code;
81+
}

0 commit comments

Comments
 (0)