Skip to content

Commit

Permalink
Improve language switcher. Bump to 1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
mikesname committed Nov 14, 2023
1 parent 998a706 commit 648f7e6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 29 deletions.
15 changes: 2 additions & 13 deletions inc/template-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ function ehri_posted_on() {
)
);

if ( function_exists( "get_coauthors" ) && function_exists("coauthors_posts_links")) {
if ( function_exists( "get_coauthors" ) && function_exists( "coauthors_posts_links" ) ) {
$coauthors = get_coauthors();
$byline = apply_filters(
'ehri_posted_by', sprintf(
Expand Down Expand Up @@ -228,7 +228,6 @@ function ehri_has_gravitar( $user ) {
/**
* Experimental Polylang-based language switch widget.
*
* TODO: improve greatly.
*/
if ( ! function_exists( "ehri_post_translations" ) ) {
function ehri_post_translations( $post_id ) {
Expand All @@ -245,19 +244,9 @@ function ehri_post_translations( $post_id ) {
return;
}

// FIXME: where to lookup with info???
$langs = array(
"en" => "English",
"de" => "German",
"fr" => "French",
"cs" => "Czech",
"hu" => "Hungarian",
);

$links = "<ul>";
foreach ( $translations as $code => $other_id ) {
$links .= sprintf( '<li><a href="%s">%s</a></li>', get_permalink( $other_id ),
__( array_key_exists( $code, $langs ) ? $langs[ $code ] : $code ) );
$links .= sprintf( '<li><a href="%s">%s</a></li>', get_permalink( $other_id ), Locale::getDisplayLanguage( $code, $current_lang ) );
}
$links .= "</ul>"

Expand Down
28 changes: 14 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ehri-wp-theme",
"version": "1.0.2",
"version": "1.0.3",
"description": "EHRI Wordpress Theme",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Theme Name: EHRI
GitHub Theme URI: https://github.com/EHRI/ehri-wp-theme
Description: A theme for the EHRI Document Blog based on UnderStrap (http://github.com/understrap/understrap).
Version: 1.0.2
Version: 1.0.3
License: UnderStrap WordPress Theme, Copyright 2013-2017 Holger Koenemann
UnderStrap is distributed under the terms of the GNU GPL version 2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Expand Down

0 comments on commit 648f7e6

Please sign in to comment.