From 4ba9062f95b4c17bef770eb698bf381f9a1de19b Mon Sep 17 00:00:00 2001 From: Landon Dyck Date: Fri, 6 May 2022 07:15:01 -0500 Subject: [PATCH] feat: check male translation and fall back to generic (#6039) --- app/Models/Relationship/RelationshipType.php | 10 +++++-- resources/lang/en/app.php | 30 ++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/app/Models/Relationship/RelationshipType.php b/app/Models/Relationship/RelationshipType.php index 53ae47ea669..e608c324d77 100644 --- a/app/Models/Relationship/RelationshipType.php +++ b/app/Models/Relationship/RelationshipType.php @@ -79,10 +79,16 @@ public function getLocalizedName(Contact $contact = null, bool $includeOpposite } $femaleVersion = trans('app.relationship_type_'.$this->name.'_female'); - $maleVersion = trans('app.relationship_type_'.$this->name); + $maleVersion = trans('app.relationship_type_'.$this->name.'_male'); + if ($maleVersion === 'app.relationship_type_'.$this->name.'_male') { + $maleVersion = trans('app.relationship_type_'.$this->name); + } if (! is_null($contact)) { - $maleVersionWithName = trans('app.relationship_type_'.$this->name.'_with_name', ['name' => $contact->name]); + $maleVersionWithName = trans('app.relationship_type_'.$this->name.'_male_with_name', ['name' => $contact->name]); + if ($maleVersionWithName === 'app.relationship_type_'.$this->name.'_male_with_name') { + $maleVersionWithName = trans('app.relationship_type_'.$this->name.'_with_name'); + } $femaleVersionWithName = trans('app.relationship_type_'.$this->name.'_female_with_name', ['name' => $contact->name]); // include the reverse of the relation in the string (masculine/feminine) diff --git a/resources/lang/en/app.php b/resources/lang/en/app.php index bf84f0ff954..da7bc31f40c 100644 --- a/resources/lang/en/app.php +++ b/resources/lang/en/app.php @@ -140,8 +140,10 @@ 'relationship_type_partner' => 'significant other', 'relationship_type_partner_female' => 'significant other', + 'relationship_type_partner_male' => 'significant other', 'relationship_type_partner_with_name' => ':name’s significant other', 'relationship_type_partner_female_with_name' => ':name’s significant other', + 'relationship_type_partner_male_with_name' => ':name’s significant other', 'relationship_type_spouse' => 'spouse', 'relationship_type_spouse_female' => 'wife', @@ -152,23 +154,31 @@ 'relationship_type_date' => 'date', 'relationship_type_date_female' => 'date', + 'relationship_type_date_male' => 'date', 'relationship_type_date_with_name' => ':name’s date', 'relationship_type_date_female_with_name' => ':name’s date', + 'relationship_type_date_male_with_name' => ':name’s date', 'relationship_type_lover' => 'lover', 'relationship_type_lover_female' => 'lover', + 'relationship_type_lover_male' => 'lover', 'relationship_type_lover_with_name' => ':name’s lover', 'relationship_type_lover_female_with_name' => ':name’s lover', + 'relationship_type_lover_male_with_name' => ':name’s lover', 'relationship_type_inlovewith' => 'in love with', 'relationship_type_inlovewith_female' => 'in love with', + 'relationship_type_inlovewith_male' => 'in love with', 'relationship_type_inlovewith_with_name' => 'someone :name is in love with', 'relationship_type_inlovewith_female_with_name' => 'someone :name is in love with', + 'relationship_type_inlovewith_male_with_name' => 'someone :name is in love with', 'relationship_type_lovedby' => 'loved by', 'relationship_type_lovedby_female' => 'loved by', + 'relationship_type_lovedby_male' => 'loved by', 'relationship_type_lovedby_with_name' => ':name’s secret lover', 'relationship_type_lovedby_female_with_name' => ':name’s secret lover', + 'relationship_type_lovedby_male_with_name' => ':name’s secret lover', 'relationship_type_ex' => 'ex-partner', 'relationship_type_ex_female' => 'ex-girlfriend', @@ -228,18 +238,24 @@ 'relationship_type_uncle' => 'uncle', 'relationship_type_uncle_female' => 'aunt', + 'relationship_type_uncle_male' => 'uncle', 'relationship_type_uncle_with_name' => ':name’s uncle', 'relationship_type_uncle_female_with_name' => ':name’s aunt', + 'relationship_type_uncle_male_with_name' => ':name’s uncle', 'relationship_type_nephew' => 'nephew', 'relationship_type_nephew_female' => 'niece', + 'relationship_type_nephew_male' => 'nephew', 'relationship_type_nephew_with_name' => ':name’s nephew', 'relationship_type_nephew_female_with_name' => ':name’s niece', + 'relationship_type_nephew_male_with_name' => ':name’s nephew', 'relationship_type_cousin' => 'cousin', 'relationship_type_cousin_female' => 'cousin', + 'relationship_type_cousin_male' => 'cousin', 'relationship_type_cousin_with_name' => ':name’s cousin', 'relationship_type_cousin_female_with_name' => ':name’s cousin', + 'relationship_type_cousin_male_with_name' => ':name’s cousin', 'relationship_type_godfather' => 'godparent', 'relationship_type_godfather_female' => 'godmother', @@ -257,38 +273,52 @@ 'relationship_type_friend' => 'friend', 'relationship_type_friend_female' => 'friend', + 'relationship_type_friend_male' => 'friend', 'relationship_type_friend_with_name' => ':name’s friend', 'relationship_type_friend_female_with_name' => ':name’s friend', + 'relationship_type_friend_male_with_name' => ':name’s friend', 'relationship_type_bestfriend' => 'best friend', 'relationship_type_bestfriend_female' => 'best friend', + 'relationship_type_bestfriend_male' => 'best friend', 'relationship_type_bestfriend_with_name' => ':name’s best friend', 'relationship_type_bestfriend_female_with_name' => ':name’s best friend', + 'relationship_type_bestfriend_male_with_name' => ':name’s best friend', 'relationship_type_colleague' => 'colleague', 'relationship_type_colleague_female' => 'colleague', + 'relationship_type_colleague_male' => 'colleague', 'relationship_type_colleague_with_name' => ':name’s colleague', 'relationship_type_colleague_female_with_name' => ':name’s colleague', + 'relationship_type_colleague_male_with_name' => ':name’s colleague', 'relationship_type_boss' => 'boss', 'relationship_type_boss_female' => 'boss', + 'relationship_type_boss_male' => 'boss', 'relationship_type_boss_with_name' => ':name’s boss', 'relationship_type_boss_female_with_name' => ':name’s boss', + 'relationship_type_boss_male_with_name' => ':name’s boss', 'relationship_type_subordinate' => 'subordinate', 'relationship_type_subordinate_female' => 'subordinate', + 'relationship_type_subordinate_male' => 'subordinate', 'relationship_type_subordinate_with_name' => ':name’s subordinate', 'relationship_type_subordinate_female_with_name' => ':name’s subordinate', + 'relationship_type_subordinate_male_with_name' => ':name’s subordinate', 'relationship_type_mentor' => 'mentor', 'relationship_type_mentor_female' => 'mentor', + 'relationship_type_mentor_male' => 'mentor', 'relationship_type_mentor_with_name' => ':name’s mentor', 'relationship_type_mentor_female_with_name' => ':name’s mentor', + 'relationship_type_mentor_male_with_name' => ':name’s mentor', 'relationship_type_protege' => 'protégé', 'relationship_type_protege_female' => 'protégé', + 'relationship_type_protege_male' => 'protégé', 'relationship_type_protege_with_name' => ':name’s protégé', 'relationship_type_protege_female_with_name' => ':name’s protégé', + 'relationship_type_protege_male_with_name' => ':name’s protégé', 'relationship_type_ex_husband' => 'ex-spouse', 'relationship_type_ex_husband_female' => 'ex-wife',