diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 41e8685e..e59aa936 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,10 +37,11 @@ jobs: - name: Check broken links shell: bash continue-on-error: false + # Exclude checking locales for each link 'lang=*' run: | set +e set +o pipefail - npx broken-link-checker http://localhost:8053/_test --recursive --ordered ---host-requests 50 -e --filter-level 3 --exclude '*/donate' | tee blc.log + npx broken-link-checker http://localhost:8053/_test --recursive --ordered ---host-requests 50 -e --filter-level 3 --exclude '*/donate' --exclude '*lang=*' | tee blc.log echo "BLC_RESULT=${PIPESTATUS[0]}" >> "$GITHUB_ENV" - name: Report on broken links diff --git a/_includes/2020/templates/Menu.php b/_includes/2020/templates/Menu.php index f3c7136c..4370f4dc 100644 --- a/_includes/2020/templates/Menu.php +++ b/_includes/2020/templates/Menu.php @@ -29,6 +29,56 @@ public static function render(array $fields): void { Menu::render_top_menu($fields); } + /** + * Generate the URL with query to change the UI language + * @param language - language tag to use + */ + private static function change_ui_language($language): string { + // Parse the current URI for populating the UI dropdown + $url = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/'; + $parts = parse_url($url); + + if (!empty($parts['query'])) { + parse_str($parts['query'], $queryParams); + } else { + $queryParams = []; + } + + // Set the language query + $queryParams['lang'] = $language; + $query = http_build_query($queryParams); + + return $parts['path'] . "?" . $query; + } + + /** + * Render the globe dropdown for changing the UI language. + * As UI languages get added, we'll need to update this + * @param number - Div number, default 0. + */ + private static function render_globe_dropdown($number = 0): void { + $divID = ($number == 1) ? "ui-language1" : "ui-language"; +echo << + +

+ @@ -117,6 +167,9 @@ private static function render_top_menu(object $fields): void {

Support" alt="help icon">

+
@@ -132,6 +185,9 @@ private static function render_top_menu(object $fields): void { Donate " alt="help icon" /> +