From fef6b931d157ab61b6a1b39bc7138972ebeccaef Mon Sep 17 00:00:00 2001 From: NiclasNorin Date: Mon, 16 Oct 2023 17:46:22 +0200 Subject: [PATCH 1/4] Fix: Translations in controller --- source/php/Controller.php | 10 ++++++++++ views/single-job-listing.blade.php | 17 ++++++++--------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/source/php/Controller.php b/source/php/Controller.php index e3087b7..20bbf97 100644 --- a/source/php/Controller.php +++ b/source/php/Controller.php @@ -58,6 +58,16 @@ public function singleViewData($data) $data['sourceSystem'] = $this->getSourceSystem(); $data['preparedListData'] = $this->prepareData($data); + $data['lang'] = [ + 'applyNow' => __('Apply now', 'job-listing'), + 'applyHere' => __('Apply here', 'job-listing'), + 'contact' => __('Contact', 'job-listing'), + 'information' => __('Information', 'job-listing'), + 'login' => __('Log in', 'job-listing'), + 'daysLeft' => __('Days left', 'job-listing'), + 'periodEnded' => __('The application period has ended', 'job-listing'), + ]; + return $data; } diff --git a/views/single-job-listing.blade.php b/views/single-job-listing.blade.php index e96e4cd..e9d5741 100644 --- a/views/single-job-listing.blade.php +++ b/views/single-job-listing.blade.php @@ -31,11 +31,10 @@ @typography(["element" => "h1"]) {{the_title() }} @endtypography - @if(!$isExpired) @if($applyLink === '#job-listings-modal') @button([ - 'text' => __('Apply now', 'job-listings'), + 'text' => $lang['applyNow'], 'color' => 'primary', 'style' => 'filled', 'id' => 'job-listings-apply', @@ -47,7 +46,7 @@ @endbutton @else @button([ - 'text' => __('Apply now', 'job-listings'), + 'text' => $lang['applyNow'], 'color' => 'primary', 'style' => 'filled', 'href' => $applyLink, @@ -97,7 +96,7 @@ 'element' => "h2", 'variant' => "h2" ]) - {{__('Information', 'job-listings')}} + {{ $lang['information'] }} @endtypography
@@ -120,7 +119,7 @@ 'element' => "h2", 'variant' => "h2" ]) - {{__('Contact', 'job-listings')}} + {{ $lang['contact'] }} @endtypography @foreach($preparedListData['contacts'] as $contact) @@ -205,7 +204,7 @@
@button([ - 'text' => __('The application period has ended', 'job-listings'), + 'text' => $lang['periodEnded'], 'style' => 'filled', 'attributeList' => ['disabled' => 'true'] @@ -218,7 +217,7 @@ @if($applyLink === '#job-listings-modal')
@button([ - 'text' => __('Apply here','job-listings') . " (" . $daysLeft . " " . __('days left','job-listings') . ")", + 'text' => $lang['applyHere'] . " (" . $daysLeft . " " . $lang['daysLeft'] . ")", 'color' => 'primary', 'style' => 'filled', 'id' => 'job-listings-apply', @@ -233,7 +232,7 @@ @else
@button([ - 'text' => __('Apply here','job-listings') . " (" . $daysLeft . " " . __('days left','job-listings') . ")", + 'text' => $lang['applyHere'] . " (" . $daysLeft . " " . $lang['daysLeft'] . ")", 'color' => 'primary', 'style' => 'filled', 'href' => $applyLink, @@ -249,7 +248,7 @@ @button([ 'icon' => 'assignment_ind', 'reversePositions' => true, - 'text' => __('Log in'), + 'text' => $lang['login'], 'style' => 'filled', 'id' => 'job-listings-login', 'attributeList' => [ From 0707029b5a31ca87b9a9c9029db453a7eed8c368 Mon Sep 17 00:00:00 2001 From: Niclas Norin Date: Mon, 16 Oct 2023 17:56:26 +0200 Subject: [PATCH 2/4] Fix: As an object --- source/php/Controller.php | 2 +- views/single-job-listing.blade.php | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/source/php/Controller.php b/source/php/Controller.php index 20bbf97..b8ba270 100644 --- a/source/php/Controller.php +++ b/source/php/Controller.php @@ -58,7 +58,7 @@ public function singleViewData($data) $data['sourceSystem'] = $this->getSourceSystem(); $data['preparedListData'] = $this->prepareData($data); - $data['lang'] = [ + $data['lang'] = (object) [ 'applyNow' => __('Apply now', 'job-listing'), 'applyHere' => __('Apply here', 'job-listing'), 'contact' => __('Contact', 'job-listing'), diff --git a/views/single-job-listing.blade.php b/views/single-job-listing.blade.php index e9d5741..4757370 100644 --- a/views/single-job-listing.blade.php +++ b/views/single-job-listing.blade.php @@ -34,7 +34,7 @@ @if(!$isExpired) @if($applyLink === '#job-listings-modal') @button([ - 'text' => $lang['applyNow'], + 'text' => $lang->applyNow, 'color' => 'primary', 'style' => 'filled', 'id' => 'job-listings-apply', @@ -46,7 +46,7 @@ @endbutton @else @button([ - 'text' => $lang['applyNow'], + 'text' => $lang->applyNow, 'color' => 'primary', 'style' => 'filled', 'href' => $applyLink, @@ -96,7 +96,7 @@ 'element' => "h2", 'variant' => "h2" ]) - {{ $lang['information'] }} + {{ $lang->information }} @endtypography
@@ -119,7 +119,7 @@ 'element' => "h2", 'variant' => "h2" ]) - {{ $lang['contact'] }} + {{ $lang->contact }} @endtypography @foreach($preparedListData['contacts'] as $contact) @@ -204,7 +204,7 @@
@button([ - 'text' => $lang['periodEnded'], + 'text' => $lang->periodEnded, 'style' => 'filled', 'attributeList' => ['disabled' => 'true'] @@ -217,7 +217,7 @@ @if($applyLink === '#job-listings-modal')
@button([ - 'text' => $lang['applyHere'] . " (" . $daysLeft . " " . $lang['daysLeft'] . ")", + 'text' => $lang->applyHere . " (" . $daysLeft . " " . $lang->daysLeft . ")", 'color' => 'primary', 'style' => 'filled', 'id' => 'job-listings-apply', @@ -232,7 +232,7 @@ @else
@button([ - 'text' => $lang['applyHere'] . " (" . $daysLeft . " " . $lang['daysLeft'] . ")", + 'text' => $lang->applyHere . " (" . $daysLeft . " " . $lang->daysLeft . ")", 'color' => 'primary', 'style' => 'filled', 'href' => $applyLink, @@ -248,7 +248,7 @@ @button([ 'icon' => 'assignment_ind', 'reversePositions' => true, - 'text' => $lang['login'], + 'text' => $lang->login, 'style' => 'filled', 'id' => 'job-listings-login', 'attributeList' => [ From a573c609b361dfec82d38ff23954b348dc032d69 Mon Sep 17 00:00:00 2001 From: Niclas Norin Date: Mon, 16 Oct 2023 18:09:18 +0200 Subject: [PATCH 3/4] Fix: Lang --- languages/job-listings-sv_SE.mo | Bin 2923 -> 3239 bytes languages/job-listings-sv_SE.po | 76 ++++++++++++++++++-------------- 2 files changed, 43 insertions(+), 33 deletions(-) diff --git a/languages/job-listings-sv_SE.mo b/languages/job-listings-s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OkKB$B2_W6+% z^;hW+;n2oMAwNLFH16`gf@tHlNP%-mUvWQTiS?iY+KB!&U6bx!LI2n)Iz`lpT6O>H z(K@8N=|i$o6Smo@EY_f2q$~U1RQ7J9EctZ)nvxqp`jhfVzql$xp==ZC+CU@Q(nO>D z>gq$Xa4mW+495!LL~MU}5St3a@i$>8F_tRt=pQN<2Dj}T+ Date: Tue, 17 Oct 2023 08:15:43 +0200 Subject: [PATCH 4/4] fix: text-domain --- source/php/Controller.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/source/php/Controller.php b/source/php/Controller.php index b8ba270..af13750 100644 --- a/source/php/Controller.php +++ b/source/php/Controller.php @@ -59,13 +59,13 @@ public function singleViewData($data) $data['preparedListData'] = $this->prepareData($data); $data['lang'] = (object) [ - 'applyNow' => __('Apply now', 'job-listing'), - 'applyHere' => __('Apply here', 'job-listing'), - 'contact' => __('Contact', 'job-listing'), - 'information' => __('Information', 'job-listing'), - 'login' => __('Log in', 'job-listing'), - 'daysLeft' => __('Days left', 'job-listing'), - 'periodEnded' => __('The application period has ended', 'job-listing'), + 'applyNow' => __('Apply now', 'job-listings'), + 'applyHere' => __('Apply here', 'job-listings'), + 'contact' => __('Contact', 'job-listings'), + 'information' => __('Information', 'job-listings'), + 'login' => __('Log in', 'job-listings'), + 'daysLeft' => __('Days left', 'job-listings'), + 'periodEnded' => __('The application period has ended', 'job-listings'), ]; return $data;