Skip to content

Commit

Permalink
Merge branch 'release/1.0.5'
Browse files Browse the repository at this point in the history
* release/1.0.5:
  Version bump
  Fixed English translation bug.
  • Loading branch information
beneverard committed Aug 17, 2020
2 parents f3f310b + 6afa1a0 commit 1321d83
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ The Idea Bureau, WordPresss Foundation

A collection of classes to base WordPress theme functionality on

Version 1.0.4
Version 1.0.5
12 changes: 12 additions & 0 deletions src/Translation.php
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,10 @@ function getDuplicateOfId($post_id = NULL) {
$post_id = get_the_ID();
}

if ( $this->getPostLanguage($post_id) !== $this->getLanguageCode() ) {
return true;
}

if ( ! metadata_exists('post', $post_id, '_icl_lang_duplicate_of') ) {
return false;
}
Expand All @@ -415,6 +419,10 @@ function getPostLanguage($post_id = NULL)

$post_details = apply_filters('wpml_post_language_details', NULL, $post_id);

if (is_wp_error($post_details)) {
return 'en';
}

return $post_details['language_code'];
}

Expand Down Expand Up @@ -502,6 +510,10 @@ function translateFilter(string $content, int $post_id, string $key) {
// get the original post language
$original_language = $this->getPostLanguage($original_id);

if ( ! $original_language ) {
return $content;
}

// return if the original and current languages are the same
if ( $original_language === $this->getLanguageCode() ) {
return $content;
Expand Down

0 comments on commit 1321d83

Please sign in to comment.