Skip to content

Commit 7804a3d

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: Content and layout improvements: * Added IDs to headings in section above footer for direct linking. * Added `<code>` tag around operators and keywords for better readability. * Moved Just-In-Time Compilation section to a half-width column rather than full-width. This is more consistent with the other release pages, and makes it easier to read the description on large screens since the paragraph isn't so excessively wide. * Updated code examples to use 4-space indentation rather than 2-space, for consistency with all the other release pages. * Updated the "New Classes, Interfaces, and Functions" section to show the actual class name for `WeakMap` and `PhpToken` (which removed the need for translation there). * Moved both RFC links after the text for "Allow a trailing comma in parameter lists and closure use lists" for simplicity and consistency across translations. Translation-specific fixes and changes: * Fixed bug where header 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. * Georgian translation previously changed strings/comments in the code examples for Union Types and Match Expression. If this is still wanted we could add translation strings to include in these code blocks, but I don't think it's worth it since the examples already have translated descriptions, and these code blocks weren't altered for any other languages.
1 parent 95c7f62 commit 7804a3d

File tree

26 files changed

+1487
-6024
lines changed

26 files changed

+1487
-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)