Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Phrases not displaying when viewing draft entries on the frontend

Status Resolved
Add-on / Version Publisher 2.4.0
Severity
EE Version 3.5.2

TradeMark Media

Mar 31, 2017

Description: When viewing the draft version of the entry using the ?publisher_status=draft query string, none of the phrases are displaying

Detailed steps to reproduce the issue:
1. Save an entry as a draft
2. View the page on the frontend using the ?publisher_status=draft parameter e.g. https://dev.texasoncourse.org/es/about/house-bill-18?publisher_status=draft

 

#1

BoldMinded (Brian)

I’m unable to replicate locally and on my demo site. http://demo.boldminded.com/en/cards?publisher_status=draft

#2

BoldMinded (Brian)

I since redeployed the demo so my tests are gone. Feel free to mess around on the demo site to see if you can re-create the issue. I wasn’t able to.

#3

BoldMinded (Brian)

To test locally, find the Service/Frontend.php file and go to line 133 or so. With caching disabled, add this after line 151 at the end of the function:

var_dump($this->config->_global_vars); die;

Then see if the translations are in that array as expected.

#4

BoldMinded (Brian)

This also brings up the question, how are you loading the phrases in the template? Are you using {phrase:foo} or {exp:publisher:translate_phrase}?

#5

Mighty Citizen

Cool, I’ll try that var_dump - I’m using {phrase:foo}

#6

Mighty Citizen

Hey Brian,

var_dump on global_vars didn’t have the phrases but I did try dumping $phrases_js and

here’s what I get when viewing the live site array(37) { [“language_en”]=> string(7) “English” [“language_es”]=> string(11) “En Español” [“all_resources”]=> string(13) “All Resources” [“by_topic”]=> string(8) “By Topic” [“key_resources”]=> string(13) “Key Resources” [“by_grade_level”]=> string(14) “By Grade Level” [“categories”]=> string(10) “Categories” [“question”]=> string(20) “Question of the Week” [“students_parents”]=> string(18) “Students & Parents” [“educators”]=> string(9) “Educators” [“share”]=> string(5) “Share” [“about”]=> string(5) “About” [“reports”]=> string(15) “Reports Archive” [“previous”]=> string(13) “Previous Page” [“next”]=> string(9) “Next Page” [“recent_posts_from”]=> string(17) “Recent posts from” [“blog_archive”]=> string(12) “Blog Archive” [“blog”]=> string(4) “Blog” [“email”]=> string(13) “Email Address” [“email_requirements”]=> string(68) “Email address is required and must be in the format email@domain.com” [“subscribe”]=> string(9) “Subscribe” [“home”]=> string(4) “Home” [“search_results”]=> string(14) “Search Results” [“emergency”]=> string(21) “Emergency Information” [“privacy”]=> string(11) “Web Privacy” [“accessibility”]=> string(17) “Web Accessibility” [“site_map”]=> string(8) “Site Map” [“website_problem”]=> string(24) “Report a Website Problem” [“site_by”]=> string(7) “Site By” [“news_signup”]=> string(16) “Sign Up for News” [“contact”]=> string(10) “Contact Us” [“tagline”]=> string(23) “Plan Early. Plan Smart.” [“site_policies”]=> string(13) “Site Policies” [“search”]=> string(6) “Search” [“pilot_login”]=> string(11) “Pilot Login” [“back_to_top”]=> string(11) “Back to top” [“cse_id”]=> string(33) “002719215564656409185:wrttxjjsvpc” }

Here’s what I get when viewing a draft array(37) { [“language_en”]=> string(7) “English” [“language_es”]=> string(7) “Spanish” [“all_resources”]=> string(0) “” [“by_topic”]=> string(0) “” [“key_resources”]=> string(0) “” [“by_grade_level”]=> string(0) “” [“categories”]=> string(0) “” [“question”]=> string(0) “” [“students_parents”]=> string(0) “” [“educators”]=> string(0) “” [“share”]=> string(0) “” [“about”]=> string(0) “” [“reports”]=> string(0) “” [“previous”]=> string(0) “” [“next”]=> string(0) “” [“recent_posts_from”]=> string(0) “” [“blog_archive”]=> string(0) “” [“blog”]=> string(0) “” [“email”]=> string(0) “” [“email_requirements”]=> string(0) “” [“subscribe”]=> string(0) “” [“home”]=> string(0) “” [“search_results”]=> string(0) “” [“emergency”]=> string(0) “” [“privacy”]=> string(0) “” [“accessibility”]=> string(0) “” [“site_map”]=> string(0) “” [“website_problem”]=> string(0) “” [“site_by”]=> string(0) “” [“news_signup”]=> string(0) “” [“contact”]=> string(0) “” [“tagline”]=> string(0) “” [“site_policies”]=> string(0) “” [“search”]=> string(0) “” [“pilot_login”]=> string(0) “” [“back_to_top”]=> string(0) “” [“cse_id”]=> string(0) “” }

#7

BoldMinded (Brian)

I think I told you the wrong line. Sorry, try this instead:

https://www.dropbox.com/s/8g9lgsrrdnr4f1o/Screenshot 2017-04-12 14.14.38.png?dl=0

#8

Mighty Citizen

Alright, here’s what I get for the published live page (I’ve excluded my template partials and other unrelated global vars and am splitting the comment into two parts to bypass the max comment restriction): [“publisher:current_language_code”]=> string(2) “en” [“publisher:current_language_id”]=> int(1) [“publisher:default_language_code”]=> string(2) “en” [“publisher:default_language_id”]=> int(1) [“publisher:current_language_prefix”]=> string(0) “” [“publisher:reserved_category_word”]=> string(8) “category” [“publisher:entry_status”]=> string(0) “” [“publisher:current_url”]=> string(31) “http://texasoncourse.local/sass” [“publisher:current_uri”]=> string(5) “/sass” [“phrase:about”]=> string(5) “About” [“phrase:accessibility”]=> string(17) “Web Accessibility” [“phrase:all_resources”]=> string(13) “All Resources” [“phrase:back_to_top”]=> string(11) “Back to top” [“phrase:blog”]=> string(4) “Blog” [“phrase:blog_archive”]=> string(12) “Blog Archive” [“phrase:by_grade_level”]=> string(14) “By Grade Level” [“phrase:by_topic”]=> string(8) “By Topic” [“phrase:categories”]=> string(10) “Categories” [“phrase:contact”]=> string(10) “Contact Us” [“phrase:cse_id”]=> string(33) “002719215564656409185:wrttxjjsvpc” [“phrase:educators”]=> string(9) “Educators” [“phrase:email”]=> string(13) “Email Address” [“phrase:email_requirements”]=> string(68) “Email address is required and must be in the format email@domain.com” [“phrase:emergency”]=> string(21) “Emergency Information” [“phrase:home”]=> string(4) “Home” [“phrase:key_resources”]=> string(13) “Key Resources” [“phrase:language_en”]=> string(7) “English” [“phrase:language_es”]=> string(11) “En Español” [“phrase:news_signup”]=> string(16) “Sign Up for News” [“phrase:next”]=> string(9) “Next Page” [“phrase:pilot_login”]=> string(11) “Pilot Login” [“phrase:previous”]=> string(13) “Previous Page” [“phrase:privacy”]=> string(11) “Web Privacy” [“phrase:question”]=> string(20) “Question of the Week” [“phrase:recent_posts_from”]=> string(17) “Recent posts from” [“phrase:reports”]=> string(15) “Reports Archive” [“phrase:search”]=> string(6) “Search” [“phrase:search_results”]=> string(14) “Search Results” [“phrase:share”]=> string(5) “Share” [“phrase:site_by”]=> string(7) “Site By” [“phrase:site_map”]=> string(8) “Site Map” [“phrase:site_policies”]=> string(13) “Site Policies” [“phrase:students_parents”]=> string(18) “Students & Parents” [“phrase:subscribe”]=> string(9) “Subscribe” [“phrase:tagline”]=> string(23) “Plan Early. Plan Smart.” [“phrase:website_problem”]=> string(24) “Report a Website Problem” [“current_phrases”]=> string(1105) “{”about”:”About”,”accessibility”:”Web Accessibility”,”all_resources”:”All Resources”,”back_to_top”:”Back to top”,”blog”:”Blog”,”blog_archive”:”Blog Archive”,”by_grade_level”:”By Grade Level”,”by_topic”:”By Topic”,”categories”:”Categories”,”contact”:”Contact Us”,”cse_id”:”002719215564656409185:wrttxjjsvpc”,”educators”:”Educators”,”email”:”Email Address”,”email_requirements”:”Email address is required and must be in the format email@domain.com”,”emergency”:”Emergency Information”,”home”:”Home”,”key_resources”:”Key Resources”,”language_en”:”English”,”language_es”:”En Espa\u00f1ol”,”news_signup”:”Sign Up for News”,”next”:”Next Page”,”pilot_login”:”Pilot Login”,”previous”:”Previous Page”,”privacy”:”Web Privacy”,”question”:”Question of the Week”,”recent_posts_from”:”Recent posts from”,”reports”:”Reports Archive”,”search”:”Search”,”search_results”:”Search Results”,”share”:”Share”,”site_by”:”Site By”,”site_map”:”Site Map”,”site_policies”:”Site Policies”,”students_parents”:”Students & Parents”,”subscribe”:”Subscribe”,”tagline”:”Plan Early. Plan Smart.”,”website_problem”:”Report a Website Problem”}”

#9

Mighty Citizen

And here’s what I get when I append ?publisher_status=draft to the url

[“publisher:current_language_code”]=> string(2) “en” [“publisher:current_language_id”]=> int(1) [“publisher:default_language_code”]=> string(2) “en” [“publisher:default_language_id”]=> int(1) [“publisher:current_language_prefix”]=> string(0) “” [“publisher:reserved_category_word”]=> string(8) “category” [“publisher:entry_status”]=> string(11) “|open|Draft” [“publisher:current_url”]=> string(31) “http://texasoncourse.local/sass” [“publisher:current_uri”]=> string(5) “/sass” [“phrase:about”]=> string(0) “” [“phrase:accessibility”]=> string(0) “” [“phrase:all_resources”]=> string(0) “” [“phrase:back_to_top”]=> string(0) “” [“phrase:blog”]=> string(0) “” [“phrase:blog_archive”]=> string(0) “” [“phrase:by_grade_level”]=> string(0) “” [“phrase:by_topic”]=> string(0) “” [“phrase:categories”]=> string(0) “” [“phrase:contact”]=> string(0) “” [“phrase:cse_id”]=> string(0) “” [“phrase:educators”]=> string(0) “” [“phrase:email”]=> string(0) “” [“phrase:email_requirements”]=> string(0) “” [“phrase:emergency”]=> string(0) “” [“phrase:home”]=> string(0) “” [“phrase:key_resources”]=> string(0) “” [“phrase:language_en”]=> string(7) “English” [“phrase:language_es”]=> string(7) “Spanish” [“phrase:news_signup”]=> string(0) “” [“phrase:next”]=> string(0) “” [“phrase:pilot_login”]=> string(0) “” [“phrase:previous”]=> string(0) “” [“phrase:privacy”]=> string(0) “” [“phrase:question”]=> string(0) “” [“phrase:recent_posts_from”]=> string(0) “” [“phrase:reports”]=> string(0) “” [“phrase:search”]=> string(0) “” [“phrase:search_results”]=> string(0) “” [“phrase:share”]=> string(0) “” [“phrase:site_by”]=> string(0) “” [“phrase:site_map”]=> string(0) “” [“phrase:site_policies”]=> string(0) “” [“phrase:students_parents”]=> string(0) “” [“phrase:subscribe”]=> string(0) “” [“phrase:tagline”]=> string(0) “” [“phrase:website_problem”]=> string(0) “” [“current_phrases”]=> string(593) “{”about”:”“,”accessibility”:”“,”all_resources”:”“,”back_to_top”:”“,”blog”:”“,”blog_archive”:”“,”by_grade_level”:”“,”by_topic”:”“,”categories”:”“,”contact”:”“,”cse_id”:”“,”educators”:”“,”email”:”“,”email_requirements”:”“,”emergency”:”“,”home”:”“,”key_resources”:”“,”language_en”:”English”,”language_es”:”Spanish”,”news_signup”:”“,”next”:”“,”pilot_login”:”“,”previous”:”“,”privacy”:”“,”question”:”“,”recent_posts_from”:”“,”reports”:”“,”search”:”“,”search_results”:”“,”share”:”“,”site_by”:”“,”site_map”:”“,”site_policies”:”“,”students_parents”:”“,”subscribe”:”“,”tagline”:”“,”website_problem”:”“}” }

#10

Mighty Citizen

I can give you access to our repository and send you a copy of our database if that would help

#11

BoldMinded (Brian)

No need to send anything, I just made a simple test locally and am seeing the same thing you are. I’ll try to get a fix soon.

#12

BoldMinded (Brian)

Try this. Go to Model/Phrase.php line 554

https://www.dropbox.com/s/rz1zq1c5t885w1m/Screenshot 2017-04-12 14.53.57.png?dl=0

Change the conditional to

if ($defaultTranslation->getPhraseValue()) {
#13

Mighty Citizen

Awesome - that worked! Thanks so much for your help again!

#14

BoldMinded (Brian)

Sweet! Double check the phrases in a different language too just to be sure it doesn’t mess anything else up.

#15

Mighty Citizen

Oh dang, you’re right - the English (default language) draft is working but the Spanish draft is showing English translations still

#16

BoldMinded (Brian)

Comment has been marked private.

#17

Mighty Citizen

I’m still getting English phrase translations on the Spanish site using that build

#18

BoldMinded (Brian)

And you definitely have a Spanish value for the phrases?

#19

Mighty Citizen

Yep, the Spanish values are displayed correctly when viewing the published version - but get reverted to English when appending ?publisher_status=draft

#20

BoldMinded (Brian)

Comment has been marked private.

#21

Mighty Citizen

I tried that latest build and deleted one of the translations and recreated them and now the phrases aren’t working for draft versions for both English and Spanish for that phrase

#22

BoldMinded (Brian)

Do you have a dev environment I can login to?

Can you replicate the issue on demo.boldminded.com?

#23

Mighty Citizen

I updated the ticket with FTP and Super Admin credentials for our dev environment. You can tinker with it - but we have it connected to a repo so if you do make updates, just send me the updated build so that I can push the updates via the repo.

Thanks!

#24

BoldMinded (Brian)

Comment has been marked private.

#25

Mighty Citizen

It didn’t work off the bat when I recreated published versions of the phrase translations, but once I manually filled out the draft translations for the phrases, it worked!

Login to reply