[www-doc] [Git][VideoLAN.org/websites][master] 2 commits: header: add x-default to translated pages that are not index files
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Tue Nov 10 09:52:47 UTC 2026
Jean-Baptiste Kempf pushed to branch master at VideoLAN organization / websites
Commits:
79f488dc by Martin Finkel at 2026-11-09T19:27:32+07:00
header: add x-default to translated pages that are not index files
Only index files got one, so vlc/download-windows.html and
vlc/download-macosx.html had hreflang alternates without a fallback.
- - - - -
d2b2f8b4 by Martin Finkel at 2026-11-09T19:32:05+07:00
download: fall back on a translated title for Windows and macOS
The titles of these pages are not in the translation catalogs, so all
their translations were shown in English in search results. Build one
from "Download VLC", which is translated, until the catalogs catch up.
- - - - -
3 changed files:
- www.videolan.org/include/header.php
- www.videolan.org/vlc/download-macosx.php
- www.videolan.org/vlc/download-windows.php
Changes:
=====================================
www.videolan.org/include/header.php
=====================================
@@ -138,6 +138,16 @@ function start_head( $title,
setlocale(LC_ALL, $locale);
bindtextdomain("website", $_SERVER["DOCUMENT_ROOT"]."/locale");
textdomain("website");
+
+ /* Title not translated yet: build one from a string that is,
+ * array( msgid, untranslated suffix ) set by the page */
+ if( isset($GLOBALS['title_fallback']) && _( $title ) === $title ) {
+ $title_fallback = $GLOBALS['title_fallback'];
+ $fallback = _( $title_fallback[0] );
+ if( $fallback !== $title_fallback[0] ) {
+ $title = trim( $fallback )." (".$title_fallback[1].")";
+ }
+ }
}
?>
<!DOCTYPE html>
@@ -190,12 +200,11 @@ function start_head( $title,
foreach(array_merge(array("en"), $alternate_lang) as $lang) {
if( $lang == "en" ) {
$en_url = 'https://www.videolan.org/'.$root_filename[0].'.html';
- /* we need a ref to v.o/ or v.o/vlc/ but use this header as well for i.e. vlc/download-windows.html
- * so, only place it if we are in a "index" file */
+ /* index files are referred to by their directory: v.o/ or v.o/vlc/ */
if (strcasecmp(substr($root_filename[0], strlen($root_filename[0]) - 5),"index")===0) {
$en_url = 'https://www.videolan.org/'.substr($root_filename[0], 0, -5);
- echo ' <link rel="alternate" hreflang="x-default" href="'.$en_url.'" />'."\n";
}
+ echo ' <link rel="alternate" hreflang="x-default" href="'.$en_url.'" />'."\n";
echo ' <link rel="alternate" hreflang="en" href="'.$en_url.'" />'."\n";
}
else {
=====================================
www.videolan.org/vlc/download-macosx.php
=====================================
@@ -6,6 +6,7 @@
$additional_js = array("/js/slimbox2.js", "/js/slick-init.js", "/js/slick.min.js");
$additional_css = array("/js/css/slimbox2.css", "/style/slick.min.css");
+ $title_fallback = array("Download VLC", "macOS");
require($_SERVER["DOCUMENT_ROOT"]."/include/language.php");
require($_SERVER["DOCUMENT_ROOT"]."/include/header.php");
include($_SERVER["DOCUMENT_ROOT"]."/include/os-specific.php");
=====================================
www.videolan.org/vlc/download-windows.php
=====================================
@@ -4,6 +4,7 @@
$new_design = true;
$additional_js = array("/js/slimbox2.js", "/js/slick-init.js", "/js/slick.min.js");
$additional_css = array("/js/css/slimbox2.css", "/style/slick.min.css");
+ $title_fallback = array("Download VLC", "Windows");
require($_SERVER["DOCUMENT_ROOT"]."/include/language.php");
require($_SERVER["DOCUMENT_ROOT"]."/include/header.php");
include($_SERVER["DOCUMENT_ROOT"]."/include/os-specific.php");
View it on GitLab: https://code.videolan.org/VideoLAN.org/websites/-/compare/c7d22ac1621347281791c0d6cf3f106400a2cc66...d2b2f8b4ca39e90c36960b47c7bc87fa470edb20
--
View it on GitLab: https://code.videolan.org/VideoLAN.org/websites/-/compare/c7d22ac1621347281791c0d6cf3f106400a2cc66...d2b2f8b4ca39e90c36960b47c7bc87fa470edb20
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the www-doc
mailing list